Browse Source

safety

master
fmk 3 years ago
parent
commit
9088465f2e
  1. 242
      lib/store/store_view/store_activity.dart

242
lib/store/store_view/store_activity.dart

@ -1,15 +1,12 @@
import 'package:flutter/material.dart';
import 'package:flutter_swiper/flutter_swiper.dart';
import 'package:huixiang/retrofit/data/activity.dart';
import 'package:huixiang/utils/font_weight.dart';
import 'package:huixiang/view_widget/custom_image.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:huixiang/view_widget/no_data_view.dart';
class StoreActivity extends StatefulWidget {
final Map<String, dynamic> arguments;
final List<Activity> activitys;
@ -19,142 +16,153 @@ class StoreActivity extends StatefulWidget {
State<StatefulWidget> createState() {
return _StoreActivity();
}
}
class _StoreActivity extends State<StoreActivity> {
@override
Widget build(BuildContext context) {
return Container(
width: MediaQuery.of(context).size.width,
height: MediaQuery.of(context).size.height,
color: Colors.white,
child: Swiper(
viewportFraction: 0.95,
loop: false,
itemBuilder: (context, position) {
return InkWell(
onTap: () {
if (widget.arguments["source"] != null &&
widget.arguments["source"] == widget.activitys[position].id) {
Navigator.of(context).pop();
} else {
Navigator.of(context).pushNamed('/router/web_page', arguments: {
"activityId": widget.activitys[position].id,
"source": widget.arguments["id"]
});
}
},
child: Container(
margin: EdgeInsets.symmetric(horizontal: 5.w),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(8),
boxShadow: [
BoxShadow(
color: Color(0x0D000000),
offset: Offset(0, 3),
blurRadius: 14,
spreadRadius: 0,
),
],
),
child: Stack(
children: [
Container(
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.max,
children: [
MImage(
(widget.activitys != null &&
widget.activitys.length > position)
? widget.activitys[position].coverImg
: "",
aspectRatio: 2.2,
radius: BorderRadius.vertical(
top: Radius.circular(8),
),
fit: BoxFit.cover,
errorSrc: "assets/image/default_2_1.png",
fadeSrc: "assets/image/default_2_1.png",
return (widget.activitys == null || widget.activitys.length == 0)
? NoDataView(
isShowBtn: false,
text: "还没有活动~",
fontSize: 16.sp,
margin: EdgeInsets.only(top: 180.h),
)
: Container(
width: MediaQuery.of(context).size.width,
height: MediaQuery.of(context).size.height,
color: Colors.white,
child: Swiper(
viewportFraction: 0.95,
loop: false,
itemBuilder: (context, position) {
return InkWell(
onTap: () {
if (widget.arguments["source"] != null &&
widget.arguments["source"] ==
widget.activitys[position].id) {
Navigator.of(context).pop();
} else {
Navigator.of(context).pushNamed('/router/web_page',
arguments: {
"activityId": widget.activitys[position].id,
"source": widget.arguments["id"]
});
}
},
child: Container(
margin: EdgeInsets.symmetric(horizontal: 5.w),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(8),
boxShadow: [
BoxShadow(
color: Color(0x0D000000),
offset: Offset(0, 3),
blurRadius: 14,
spreadRadius: 0,
),
],
),
child: Stack(
children: [
Container(
padding: EdgeInsets.all(8),
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.max,
children: [
Text(
MImage(
(widget.activitys != null &&
widget.activitys.length > position)
? widget.activitys[position].storeName
widget.activitys.length > position)
? widget.activitys[position].coverImg
: "",
style: TextStyle(
fontSize: 14.sp,
fontWeight: MyFontWeight.semi_bold,
color: Color(0xFF000000),
aspectRatio: 2.2,
radius: BorderRadius.vertical(
top: Radius.circular(8),
),
fit: BoxFit.cover,
errorSrc: "assets/image/default_2_1.png",
fadeSrc: "assets/image/default_2_1.png",
),
SizedBox(
height: 4.h,
),
Text(
(widget.activitys != null &&
widget.activitys.length > position)
? widget.activitys[position].mainTitle
: "",
style: TextStyle(
fontSize: 12.sp,
fontWeight: MyFontWeight.semi_bold,
color: Color(0xFF727272),
Container(
padding: EdgeInsets.all(8),
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
(widget.activitys != null &&
widget.activitys.length >
position)
? widget.activitys[position].storeName
: "",
style: TextStyle(
fontSize: 14.sp,
fontWeight: MyFontWeight.semi_bold,
color: Color(0xFF000000),
),
),
SizedBox(
height: 4.h,
),
Text(
(widget.activitys != null &&
widget.activitys.length >
position)
? widget.activitys[position].mainTitle
: "",
style: TextStyle(
fontSize: 12.sp,
fontWeight: MyFontWeight.semi_bold,
color: Color(0xFF727272),
),
),
],
),
),
],
),
),
],
),
),
Positioned(
top: 0,
right: 0,
child: Container(
padding: EdgeInsets.symmetric(
vertical: 4.h,
horizontal: 8.w,
),
decoration: BoxDecoration(
color: Colors.black.withAlpha(76),
borderRadius: BorderRadius.only(
bottomLeft: Radius.circular(8),
topRight: Radius.circular(8),
),
),
child: Text(
(widget.activitys != null &&
widget.activitys.length > position)
? widget.activitys[position].startTime.split(" ")[0]
: "",
style: TextStyle(
fontWeight: MyFontWeight.semi_bold,
fontSize: 12.sp,
color: Color(0xD9FFFFFF),
Positioned(
top: 0,
right: 0,
child: Container(
padding: EdgeInsets.symmetric(
vertical: 4.h,
horizontal: 8.w,
),
decoration: BoxDecoration(
color: Colors.black.withAlpha(76),
borderRadius: BorderRadius.only(
bottomLeft: Radius.circular(8),
topRight: Radius.circular(8),
),
),
child: Text(
(widget.activitys != null &&
widget.activitys.length > position)
? widget.activitys[position].startTime
.split(" ")[0]
: "",
style: TextStyle(
fontWeight: MyFontWeight.semi_bold,
fontSize: 12.sp,
color: Color(0xD9FFFFFF),
),
),
),
),
),
],
),
),
],
),
);
},
itemCount:
(widget.activitys != null && widget.activitys.length > 0)
? widget.activitys.length
: 0,
),
);
},
itemCount: (widget.activitys != null && widget.activitys.length > 0)
? widget.activitys.length
: 0,
),
);
}
}
}

Loading…
Cancel
Save