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.
166 lines
5.7 KiB
166 lines
5.7 KiB
3 years ago
|
import 'package:flutter/material.dart';
|
||
|
import 'package:huixiang/retrofit/data/settleOrderInfo.dart';
|
||
|
import 'package:huixiang/retrofit/data/store_info.dart';
|
||
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||
|
import 'package:huixiang/utils/font_weight.dart';
|
||
|
import 'package:huixiang/view_widget/custom_image.dart';
|
||
|
import 'package:huixiang/view_widget/icon_text.dart';
|
||
|
import 'package:huixiang/view_widget/round_button.dart';
|
||
|
|
||
|
class ActivityWidget extends StatefulWidget {
|
||
|
final PromotionInfoListBean promotionInfoListBean;
|
||
|
final StoreInfo storeInfo;
|
||
|
final int index;
|
||
|
|
||
|
final Function() callback;
|
||
|
|
||
|
ActivityWidget(this.promotionInfoListBean, this.storeInfo, this.index, { this.callback, });
|
||
|
|
||
|
@override
|
||
|
State<StatefulWidget> createState() {
|
||
|
return _ActivityWidget();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
class _ActivityWidget extends State<ActivityWidget> {
|
||
|
@override
|
||
|
Widget build(BuildContext context) {
|
||
|
return Container(
|
||
|
height: 177,
|
||
|
width: double.infinity,
|
||
|
padding: EdgeInsets.all(16),
|
||
|
decoration: BoxDecoration(
|
||
|
color: Colors.white,
|
||
|
borderRadius: BorderRadius.circular(8),
|
||
|
boxShadow: [
|
||
|
BoxShadow(
|
||
|
color: Colors.black.withAlpha(12),
|
||
|
offset: Offset(0, 3),
|
||
|
blurRadius: 14,
|
||
|
spreadRadius: 0,
|
||
|
),
|
||
|
],
|
||
|
),
|
||
|
child: Column(
|
||
|
children: [
|
||
|
Expanded(
|
||
|
child: Row(
|
||
|
children: [
|
||
|
MImage(
|
||
|
widget.promotionInfoListBean != null
|
||
|
? widget.promotionInfoListBean.image
|
||
|
: "",
|
||
|
fit: BoxFit.cover,
|
||
|
aspectRatio: 1,
|
||
|
errorSrc: "assets/image/default_1.png",
|
||
|
fadeSrc: "assets/image/default_1.png",
|
||
|
),
|
||
|
SizedBox(
|
||
|
width: 12.w,
|
||
|
),
|
||
|
Expanded(
|
||
|
child: Column(
|
||
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||
|
children: [
|
||
|
Text(
|
||
|
widget.promotionInfoListBean != null
|
||
|
? (widget.promotionInfoListBean.name ?? "")
|
||
|
: "",
|
||
|
style: TextStyle(
|
||
|
fontWeight: MyFontWeight.medium,
|
||
|
fontSize: 14.sp,
|
||
|
color: Colors.black,
|
||
|
),
|
||
|
),
|
||
|
Text(
|
||
|
widget.promotionInfoListBean != null
|
||
|
? (widget.promotionInfoListBean.description ?? "")
|
||
|
: "",
|
||
|
maxLines: 2,
|
||
|
overflow: TextOverflow.ellipsis,
|
||
|
style: TextStyle(
|
||
|
color: Color(0xFF727272),
|
||
|
fontSize: 12.sp,
|
||
|
fontWeight: MyFontWeight.medium,
|
||
|
),
|
||
|
),
|
||
|
SizedBox(
|
||
|
height: 8.w,
|
||
|
),
|
||
|
IconText(
|
||
|
"全场通用",
|
||
|
leftIcon: Icons.circle,
|
||
|
iconColor: Color(0xFF32A060),
|
||
|
iconSize: 6,
|
||
|
textStyle: TextStyle(
|
||
|
fontSize: 12.sp,
|
||
|
fontWeight: MyFontWeight.regular,
|
||
|
color: Color(0xFF181818),
|
||
|
),
|
||
|
),
|
||
|
IconText(
|
||
|
widget.promotionInfoListBean != null
|
||
|
? ("${widget.promotionInfoListBean.activityStartTime.split(" ")[0].replaceAll("-", ".")}-${widget.promotionInfoListBean.activityEndTime.split(" ")[0].replaceAll("-", ".")}")
|
||
|
: "",
|
||
|
leftIcon: Icons.circle,
|
||
|
iconColor: Color(0xFF32A060),
|
||
|
iconSize: 6,
|
||
|
textStyle: TextStyle(
|
||
|
fontSize: 12.sp,
|
||
|
fontWeight: MyFontWeight.regular,
|
||
|
color: Color(0xFF181818),
|
||
|
),
|
||
|
),
|
||
|
],
|
||
|
),
|
||
|
),
|
||
|
],
|
||
|
),
|
||
|
flex: 1,
|
||
|
),
|
||
|
SizedBox(
|
||
|
height: 12.w,
|
||
|
),
|
||
|
Row(
|
||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||
|
children: [
|
||
|
Text(
|
||
|
"*优惠券与活动不可同时选择",
|
||
|
style: TextStyle(
|
||
|
fontSize: 12.sp,
|
||
|
fontWeight: MyFontWeight.regular,
|
||
|
color: Color(0xFFACACAC),
|
||
|
),
|
||
|
),
|
||
|
if (widget.promotionInfoListBean != null &&
|
||
|
widget.promotionInfoListBean.canPartake)
|
||
|
RoundButton(
|
||
|
text: "选择活动",
|
||
|
textColor: Colors.white,
|
||
|
padding: EdgeInsets.symmetric(
|
||
|
vertical: 4,
|
||
|
horizontal: 8,
|
||
|
),
|
||
|
backgroup: Color(0xFF32A060),
|
||
|
radius: 12,
|
||
|
callback: widget.callback,
|
||
|
)
|
||
|
else
|
||
|
Text(
|
||
|
"条件未达",
|
||
|
style: TextStyle(
|
||
|
color: Color(0xFF868686),
|
||
|
fontWeight: MyFontWeight.medium,
|
||
|
fontSize: 12.sp,
|
||
|
),
|
||
|
),
|
||
|
],
|
||
|
),
|
||
|
],
|
||
|
),
|
||
|
);
|
||
|
}
|
||
|
}
|