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.

184 lines
6.8 KiB

3 years ago
import 'package:flutter/material.dart';
import 'package:flutter_swiper_view/flutter_swiper_view.dart';
3 years ago
import 'package:huixiang/generated/l10n.dart';
import 'package:huixiang/data/activity.dart';
3 years ago
import 'package:huixiang/utils/font_weight.dart';
import 'package:huixiang/view_widget/custom_image.dart';
3 years ago
import 'package:huixiang/view_widget/item_title.dart';
3 years ago
import 'package:flutter_screenutil/flutter_screenutil.dart';
class StoreActivity extends StatefulWidget {
final Map? arguments;
final List<Activity>? activitys;
3 years ago
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(
3 years ago
margin: EdgeInsets.only(top: 20.h, bottom: 20.h),
child: ItemTitle(
text: S.of(context).xindianhuodong,
imgPath: "assets/image/icon_union_start_store.webp",
3 years ago
),
),
(widget.activitys?.isNotEmpty ?? false)
3 years ago
? Container(
margin: EdgeInsets.only(bottom: 30.h),
child: AspectRatio(
aspectRatio: 1.55,
child: buildSwiper2Bottom(),
),
)
3 years ago
: 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),
),
),
),
3 years ago
],
);
}
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) {
3 years ago
Navigator.of(context).pop();
} else {
Navigator.of(context).pushNamed('/router/web_page', arguments: {
"activityId": widget.activitys?[position].id,
"source": widget.arguments?["id"]
});
3 years ago
}
},
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!.length > position)
? (widget.activitys![position].coverImg ?? "")
3 years ago
: "",
aspectRatio: 2.2,
radius: BorderRadius.vertical(
top: Radius.circular(8),
),
fit: BoxFit.cover,
errorSrc: "assets/image/default_2_1.webp",
fadeSrc: "assets/image/default_2_1.webp",
3 years ago
),
Container(
padding: EdgeInsets.all(8),
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
(widget.activitys!.length > position)
? (widget.activitys![position].storeName ?? "")
3 years ago
: "",
style: TextStyle(
fontSize: 14.sp,
fontWeight: MyFontWeight.semi_bold,
color: Color(0xFF000000),
),
),
SizedBox(
height: 4.h,
),
Text(
(widget.activitys!.length > position)
? (widget.activitys![position].mainTitle ?? "")
3 years ago
: "",
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!.length > position)
? (widget.activitys![position].startTime?.split(" ")[0] ?? "")
3 years ago
: "",
style: TextStyle(
fontWeight: MyFontWeight.semi_bold,
fontSize: 12.sp,
color: Color(0xD9FFFFFF),
),
),
),
),
],
),
),
);
},
itemCount: widget.activitys?.length ?? 0,
3 years ago
),
);
}
}