fmk
3 years ago
5 changed files with 465 additions and 418 deletions
@ -0,0 +1,160 @@
|
||||
|
||||
|
||||
|
||||
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'; |
||||
|
||||
class StoreActivity extends StatefulWidget { |
||||
|
||||
final Map<String, dynamic> arguments; |
||||
final List<Activity> activitys; |
||||
|
||||
StoreActivity(this.arguments, this.activitys); |
||||
|
||||
@override |
||||
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", |
||||
), |
||||
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), |
||||
), |
||||
), |
||||
), |
||||
), |
||||
], |
||||
), |
||||
), |
||||
); |
||||
}, |
||||
itemCount: (widget.activitys != null && widget.activitys.length > 0) |
||||
? widget.activitys.length |
||||
: 0, |
||||
), |
||||
); |
||||
} |
||||
|
||||
} |
Loading…
Reference in new issue