You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
195 lines
6.9 KiB
195 lines
6.9 KiB
|
|
|
|
|
|
import 'package:flutter/material.dart'; |
|
import 'package:flutter_swiper/flutter_swiper.dart'; |
|
import 'package:huixiang/generated/l10n.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:huixiang/view_widget/item_title.dart'; |
|
import 'package:flutter_screenutil/flutter_screenutil.dart'; |
|
|
|
class StoreActivity extends StatefulWidget { |
|
|
|
final Map 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 Column( |
|
children: [ |
|
Container( |
|
margin: EdgeInsets.only(top: 20.h, bottom: 20.h), |
|
child: ItemTitle( |
|
text: S.of(context).xindianhuodong, |
|
imgPath: "assets/image/icon_union_start_store.png", |
|
), |
|
), |
|
(widget.activitys != null && widget.activitys.length > 0) |
|
? Container( |
|
margin: EdgeInsets.only(bottom: 30.h), |
|
child: AspectRatio( |
|
aspectRatio: 1.55, |
|
child: buildSwiper2Bottom(), |
|
), |
|
) |
|
: Container( |
|
width: double.infinity, |
|
height: 30.h, |
|
margin: EdgeInsets.only(bottom: 30.h), |
|
alignment: Alignment.center, |
|
child: Text( |
|
S.of(context).muqianzanwuxingdianhuodong, |
|
style: TextStyle( |
|
fontSize: 14.sp, |
|
fontWeight: MyFontWeight.semi_bold, |
|
color: Color(0xFFA0A0A0), |
|
), |
|
), |
|
), |
|
], |
|
); |
|
} |
|
|
|
|
|
Widget buildSwiper2Bottom() { |
|
return Container( |
|
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, |
|
), |
|
); |
|
} |
|
|
|
|
|
} |