|
...
|
...
|
@@ -5,7 +5,9 @@ import 'package:one_key/constant/state.dart'; |
|
|
|
import 'package:one_key/pages/coupon/coupon_item.dart';
|
|
|
|
import 'package:one_key/provider/coupon_provider.dart';
|
|
|
|
import 'package:one_key/res/colors.dart';
|
|
|
|
import 'package:one_key/utils/event_bus.dart';
|
|
|
|
import 'package:one_key/utils/navigator_util.dart';
|
|
|
|
import 'package:one_key/utils/utils.dart';
|
|
|
|
import 'package:one_key/widgets/h_empty_view.dart';
|
|
|
|
import 'package:one_key/widgets/page_exception.dart';
|
|
|
|
import 'package:one_key/widgets/round_button.dart';
|
|
...
|
...
|
@@ -49,6 +51,7 @@ class _CouponSelectPageState extends State<CouponSelectPage> { |
|
|
|
'优惠券',
|
|
|
|
onTap: () {
|
|
|
|
Navigator.pop(context);
|
|
|
|
Utils.changeStatusColor(color: Colors.transparent);
|
|
|
|
},
|
|
|
|
rightImgName: couponProvider.checkValue ? '取消全选' : '全选',
|
|
|
|
onTapRight: () {
|
|
...
|
...
|
@@ -59,117 +62,124 @@ class _CouponSelectPageState extends State<CouponSelectPage> { |
|
|
|
}
|
|
|
|
},
|
|
|
|
),
|
|
|
|
body: Column(
|
|
|
|
children: [
|
|
|
|
Expanded(child: Consumer<CouponProvider>(
|
|
|
|
builder: (context, model, _) {
|
|
|
|
if (model.pageStateSelect != PageState.Success) {
|
|
|
|
return ExceptionPage(
|
|
|
|
pageState: model.pageStateSelect,
|
|
|
|
callback: () {
|
|
|
|
// offset = 0;
|
|
|
|
// getMessage(showLoading: true);
|
|
|
|
body: WillPopScope(
|
|
|
|
child: Column(
|
|
|
|
children: [
|
|
|
|
Expanded(child: Consumer<CouponProvider>(
|
|
|
|
builder: (context, model, _) {
|
|
|
|
if (model.pageStateSelect != PageState.Success) {
|
|
|
|
return ExceptionPage(
|
|
|
|
pageState: model.pageStateSelect,
|
|
|
|
callback: () {
|
|
|
|
// offset = 0;
|
|
|
|
// getMessage(showLoading: true);
|
|
|
|
},
|
|
|
|
emptyMsg: "暂时没有列表信息哦",
|
|
|
|
emptyImg: "empty_search",
|
|
|
|
showMsg: "加载中,请稍后...",
|
|
|
|
);
|
|
|
|
} else {
|
|
|
|
return EasyRefresh.custom(
|
|
|
|
controller: _controller,
|
|
|
|
shrinkWrap: true,
|
|
|
|
slivers: [
|
|
|
|
SliverList(
|
|
|
|
delegate: SliverChildBuilderDelegate(
|
|
|
|
(BuildContext context, int index) {
|
|
|
|
return InkWell(
|
|
|
|
onTap: () {
|
|
|
|
couponProvider.listData[index]['checked'] =
|
|
|
|
!couponProvider.listData[index]['checked'];
|
|
|
|
if (couponProvider.listData[index]['checked']) {
|
|
|
|
couponProvider.addData(index);
|
|
|
|
} else {
|
|
|
|
couponProvider.cancelData(index);
|
|
|
|
}
|
|
|
|
couponProvider.getCheckValue();
|
|
|
|
},
|
|
|
|
child: Row(
|
|
|
|
children: [
|
|
|
|
HEmptyView(30),
|
|
|
|
Checkbox(
|
|
|
|
value: couponProvider.listData[index]
|
|
|
|
['checked'],
|
|
|
|
checkColor: MyColours.color_ffffff,
|
|
|
|
activeColor: MyColours.app_main,
|
|
|
|
onChanged: (bool value) {
|
|
|
|
couponProvider.listData[index]['checked'] =
|
|
|
|
!couponProvider.listData[index]
|
|
|
|
['checked'];
|
|
|
|
if (couponProvider.listData[index]
|
|
|
|
['checked']) {
|
|
|
|
couponProvider.addData(index);
|
|
|
|
} else {
|
|
|
|
couponProvider.cancelData(index);
|
|
|
|
}
|
|
|
|
couponProvider.getCheckValue();
|
|
|
|
},
|
|
|
|
),
|
|
|
|
// Image.asset(
|
|
|
|
// couponProvider.listData[index]['checked']
|
|
|
|
// ? 'assets/select.png'
|
|
|
|
// : 'assets/unselect.png',
|
|
|
|
// width: ScreenUtil().setWidth(44)),
|
|
|
|
Expanded(
|
|
|
|
child: CouponItem(
|
|
|
|
index: index,
|
|
|
|
couponProvider: couponProvider,
|
|
|
|
onPressed: () {
|
|
|
|
couponProvider.listData[index]['checked'] =
|
|
|
|
!couponProvider.listData[index]
|
|
|
|
['checked'];
|
|
|
|
if (couponProvider.listData[index]
|
|
|
|
['checked']) {
|
|
|
|
couponProvider.addData(index);
|
|
|
|
} else {
|
|
|
|
couponProvider.cancelData(index);
|
|
|
|
}
|
|
|
|
couponProvider.getCheckValue();
|
|
|
|
},
|
|
|
|
))
|
|
|
|
],
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}, childCount: couponProvider.listData.length),
|
|
|
|
)
|
|
|
|
],
|
|
|
|
onRefresh: () async {
|
|
|
|
// offset = 0;
|
|
|
|
// getMessage(showLoading: false);
|
|
|
|
},
|
|
|
|
onLoad: () async {
|
|
|
|
// offset++;
|
|
|
|
// getMessage(showLoading: false);
|
|
|
|
},
|
|
|
|
);
|
|
|
|
}
|
|
|
|
},
|
|
|
|
)),
|
|
|
|
VEmptyView(20),
|
|
|
|
Padding(
|
|
|
|
padding: EdgeInsets.fromLTRB(ScreenUtil().setWidth(40), 0,
|
|
|
|
ScreenUtil().setWidth(40), ScreenUtil().setWidth(40)),
|
|
|
|
child: RoundButton(
|
|
|
|
onPressed: () {
|
|
|
|
Navigator.pop(context);
|
|
|
|
},
|
|
|
|
emptyMsg: "暂时没有列表信息哦",
|
|
|
|
emptyImg: "empty_search",
|
|
|
|
showMsg: "加载中,请稍后...",
|
|
|
|
);
|
|
|
|
} else {
|
|
|
|
return EasyRefresh.custom(
|
|
|
|
controller: _controller,
|
|
|
|
shrinkWrap: true,
|
|
|
|
slivers: [
|
|
|
|
SliverList(
|
|
|
|
delegate: SliverChildBuilderDelegate(
|
|
|
|
(BuildContext context, int index) {
|
|
|
|
return InkWell(
|
|
|
|
onTap: () {
|
|
|
|
couponProvider.listData[index]['checked'] =
|
|
|
|
!couponProvider.listData[index]['checked'];
|
|
|
|
if (couponProvider.listData[index]['checked']) {
|
|
|
|
couponProvider.addData(index);
|
|
|
|
} else {
|
|
|
|
couponProvider.cancelData(index);
|
|
|
|
}
|
|
|
|
couponProvider.getCheckValue();
|
|
|
|
},
|
|
|
|
child: Row(
|
|
|
|
children: [
|
|
|
|
HEmptyView(30),
|
|
|
|
Checkbox(
|
|
|
|
value: couponProvider.listData[index]
|
|
|
|
['checked'],
|
|
|
|
checkColor: MyColours.color_ffffff,
|
|
|
|
activeColor: MyColours.app_main,
|
|
|
|
onChanged: (bool value) {
|
|
|
|
couponProvider.listData[index]['checked'] =
|
|
|
|
!couponProvider.listData[index]
|
|
|
|
['checked'];
|
|
|
|
if (couponProvider.listData[index]
|
|
|
|
['checked']) {
|
|
|
|
couponProvider.addData(index);
|
|
|
|
} else {
|
|
|
|
couponProvider.cancelData(index);
|
|
|
|
}
|
|
|
|
couponProvider.getCheckValue();
|
|
|
|
},
|
|
|
|
),
|
|
|
|
// Image.asset(
|
|
|
|
// couponProvider.listData[index]['checked']
|
|
|
|
// ? 'assets/select.png'
|
|
|
|
// : 'assets/unselect.png',
|
|
|
|
// width: ScreenUtil().setWidth(44)),
|
|
|
|
Expanded(
|
|
|
|
child: CouponItem(
|
|
|
|
index: index,
|
|
|
|
couponProvider: couponProvider,
|
|
|
|
onPressed: () {
|
|
|
|
couponProvider.listData[index]['checked'] =
|
|
|
|
!couponProvider.listData[index]
|
|
|
|
['checked'];
|
|
|
|
if (couponProvider.listData[index]
|
|
|
|
['checked']) {
|
|
|
|
couponProvider.addData(index);
|
|
|
|
} else {
|
|
|
|
couponProvider.cancelData(index);
|
|
|
|
}
|
|
|
|
couponProvider.getCheckValue();
|
|
|
|
},
|
|
|
|
))
|
|
|
|
],
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}, childCount: couponProvider.listData.length),
|
|
|
|
)
|
|
|
|
],
|
|
|
|
onRefresh: () async {
|
|
|
|
// offset = 0;
|
|
|
|
// getMessage(showLoading: false);
|
|
|
|
},
|
|
|
|
onLoad: () async {
|
|
|
|
// offset++;
|
|
|
|
// getMessage(showLoading: false);
|
|
|
|
},
|
|
|
|
);
|
|
|
|
}
|
|
|
|
},
|
|
|
|
)),
|
|
|
|
VEmptyView(20),
|
|
|
|
Padding(
|
|
|
|
padding: EdgeInsets.fromLTRB(ScreenUtil().setWidth(40), 0,
|
|
|
|
ScreenUtil().setWidth(40), ScreenUtil().setWidth(40)),
|
|
|
|
child: RoundButton(
|
|
|
|
onPressed: () {
|
|
|
|
Navigator.pop(context);
|
|
|
|
},
|
|
|
|
text: '已选${couponProvider.coupons.length}个 确定',
|
|
|
|
fontSize: 34,
|
|
|
|
isBold: false,
|
|
|
|
height: ScreenUtil().setWidth(80),
|
|
|
|
width: double.infinity,
|
|
|
|
radius: ScreenUtil().setWidth(10),
|
|
|
|
))
|
|
|
|
],
|
|
|
|
text: '已选${couponProvider.coupons.length}个 确定',
|
|
|
|
fontSize: 34,
|
|
|
|
isBold: false,
|
|
|
|
height: ScreenUtil().setWidth(80),
|
|
|
|
width: double.infinity,
|
|
|
|
radius: ScreenUtil().setWidth(10),
|
|
|
|
))
|
|
|
|
],
|
|
|
|
),
|
|
|
|
onWillPop: () async {
|
|
|
|
Utils.changeStatusColor(color: Colors.transparent);
|
|
|
|
Navigator.of(context).pop();
|
|
|
|
return true;
|
|
|
|
},
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
...
|
...
|
|