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