|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:huixiang/retrofit/data/settleOrderInfo.dart';
|
|
|
|
import 'package:huixiang/retrofit/data/store_info.dart';
|
|
|
|
import 'package:huixiang/settlement/settlement_view/activity.dart';
|
|
|
|
import 'package:huixiang/settlement/settlement_view/coupon.dart';
|
|
|
|
import 'package:huixiang/utils/font_weight.dart';
|
|
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
|
|
|
|
|
|
class SettlementActivity extends StatefulWidget {
|
|
|
|
|
|
|
|
final StoreInfo storeInfo;
|
|
|
|
final SettleOrderInfo settleOrderInfo;
|
|
|
|
|
|
|
|
SettlementActivity(this.settleOrderInfo, this.storeInfo);
|
|
|
|
|
|
|
|
@override
|
|
|
|
State<StatefulWidget> createState() {
|
|
|
|
return _SettlementActivity();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
class _SettlementActivity extends State<SettlementActivity> {
|
|
|
|
List<PromotionInfoListBean> promotionInfoCan = [];
|
|
|
|
List<PromotionInfoListBean> promotionInfoNo = [];
|
|
|
|
|
|
|
|
@override
|
|
|
|
void initState() {
|
|
|
|
super.initState();
|
|
|
|
|
|
|
|
promotionInfoCan.clear();
|
|
|
|
promotionInfoNo.clear();
|
|
|
|
|
|
|
|
if (widget.settleOrderInfo != null &&
|
|
|
|
widget.settleOrderInfo.promotionInfoList != null &&
|
|
|
|
widget.settleOrderInfo.promotionInfoList.length > 0) {
|
|
|
|
widget.settleOrderInfo.promotionInfoList.forEach((element) {
|
|
|
|
if (element.canPartake) {
|
|
|
|
promotionInfoCan.add(element);
|
|
|
|
} else {
|
|
|
|
promotionInfoNo.add(element);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
setState(() {});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
return StatefulBuilder(
|
|
|
|
builder: (context1, state) {
|
|
|
|
return Container(
|
|
|
|
alignment: Alignment.topCenter,
|
|
|
|
width: double.infinity,
|
|
|
|
height: MediaQuery.of(context).size.height / 3 * 2,
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
color: Colors.white,
|
|
|
|
borderRadius: BorderRadius.only(
|
|
|
|
topLeft: Radius.circular(8),
|
|
|
|
topRight: Radius.circular(8),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
child: SingleChildScrollView(
|
|
|
|
physics: BouncingScrollPhysics(),
|
|
|
|
child: Column(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
Container(
|
|
|
|
padding: EdgeInsets.only(
|
|
|
|
top: 16,
|
|
|
|
left: 16,
|
|
|
|
right: 16,
|
|
|
|
bottom: 8,
|
|
|
|
),
|
|
|
|
child: Row(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
Expanded(
|
|
|
|
child: Text(
|
|
|
|
"可参加的活动(${promotionInfoCan.length})",
|
|
|
|
style: TextStyle(
|
|
|
|
color: Color(0xFF000000),
|
|
|
|
fontSize: 14.sp,
|
|
|
|
fontWeight: MyFontWeight.medium,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
InkWell(
|
|
|
|
onTap: () {
|
|
|
|
Navigator.of(context).pop();
|
|
|
|
},
|
|
|
|
child: Image.asset(
|
|
|
|
"assets/image/cancel.webp",
|
|
|
|
width: 24,
|
|
|
|
height: 24,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Container(
|
|
|
|
padding: EdgeInsets.only(
|
|
|
|
top: 8,
|
|
|
|
left: 16,
|
|
|
|
right: 16,
|
|
|
|
),
|
|
|
|
child: ListView.builder(
|
|
|
|
itemCount: (promotionInfoCan == null ||
|
|
|
|
promotionInfoCan.length == 0)
|
|
|
|
? 0
|
|
|
|
: promotionInfoCan.length,
|
|
|
|
shrinkWrap: true,
|
|
|
|
physics: NeverScrollableScrollPhysics(),
|
|
|
|
itemBuilder: (context, position) {
|
|
|
|
return ActivityWidget(
|
|
|
|
promotionInfoCan[position],
|
|
|
|
widget.storeInfo,
|
|
|
|
position,
|
|
|
|
callback: (){
|
|
|
|
Navigator.of(context).pop(promotionInfoCan[position]);
|
|
|
|
},
|
|
|
|
);
|
|
|
|
},
|
|
|
|
),
|
|
|
|
),
|
|
|
|
if (promotionInfoNo != null || promotionInfoNo.length > 0)
|
|
|
|
Container(
|
|
|
|
padding: EdgeInsets.only(
|
|
|
|
top: 16,
|
|
|
|
left: 16,
|
|
|
|
right: 16,
|
|
|
|
bottom: 8,
|
|
|
|
),
|
|
|
|
child: Text(
|
|
|
|
"不可参加的活动",
|
|
|
|
style: TextStyle(
|
|
|
|
color: Color(0xFF000000),
|
|
|
|
fontSize: 14.sp,
|
|
|
|
fontWeight: MyFontWeight.medium,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
if (promotionInfoNo != null || promotionInfoNo.length > 0)
|
|
|
|
Container(
|
|
|
|
padding: EdgeInsets.only(
|
|
|
|
top: 8,
|
|
|
|
left: 16,
|
|
|
|
right: 16,
|
|
|
|
),
|
|
|
|
child: ListView.builder(
|
|
|
|
itemCount: (promotionInfoNo == null ||
|
|
|
|
promotionInfoNo.length == 0)
|
|
|
|
? 0
|
|
|
|
: promotionInfoNo.length,
|
|
|
|
shrinkWrap: true,
|
|
|
|
physics: NeverScrollableScrollPhysics(),
|
|
|
|
itemBuilder: (context, position) {
|
|
|
|
return ActivityWidget(
|
|
|
|
promotionInfoNo[position],
|
|
|
|
widget.storeInfo,
|
|
|
|
position,
|
|
|
|
);
|
|
|
|
},
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
},
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|