coupon_item.dart
4.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:one_key/provider/coupon_provider.dart';
import 'package:one_key/res/colors.dart';
import 'package:one_key/widgets/h_empty_view.dart';
import 'package:one_key/widgets/round_button.dart';
import 'package:one_key/widgets/v_empty_view.dart';
class CouponItem extends StatefulWidget {
final int index;
final VoidCallback onPressed;
final CouponProvider couponProvider;
CouponItem({Key key, this.index, this.onPressed, this.couponProvider})
: super(key: key);
@override
_CouponItemState createState() => _CouponItemState();
}
class _CouponItemState extends State<CouponItem> {
@override
Widget build(BuildContext context) {
bool switchState = widget.couponProvider.swichStateData[widget.index];
return Padding(
padding: EdgeInsets.all(ScreenUtil().setWidth(20)),
child: Container(
height: ScreenUtil().setWidth(300),
padding: EdgeInsets.all(ScreenUtil().setWidth(20)),
decoration: BoxDecoration(
color: switchState ? MyColours.app_main : MyColours.color_E0E0E0,
borderRadius: BorderRadius.circular(ScreenUtil().setWidth(10))),
child: Stack(
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
crossAxisAlignment: CrossAxisAlignment.end,
children: [
Text(
'九折券',
style: TextStyle(
color: MyColours.color_ffffff,
fontSize: ScreenUtil().setSp(50),
fontWeight: FontWeight.bold),
),
Text('(无门槛)',
style: TextStyle(
color: MyColours.color_ffffff,
fontSize: ScreenUtil().setSp(22),
fontWeight: FontWeight.bold))
],
),
VEmptyView(20),
Container(
padding: EdgeInsets.all(ScreenUtil().setWidth(20)),
child: Text(
'说明:大家发哈接电话发费哈咖啡的哈快递费哈就快递费哈加客服哈艰苦奋斗哈佛等哈快回复解答快回复',
style: TextStyle(
color: switchState
? MyColours.app_main
: MyColours.color_e5e5e5,
fontSize: ScreenUtil().setSp(22))),
decoration: BoxDecoration(
color: MyColours.color_ffffff,
borderRadius:
BorderRadius.circular(ScreenUtil().setWidth(10))),
),
Container(
padding: EdgeInsets.only(top: ScreenUtil().setWidth(20)),
child: Text('有效期:2021.01.01 00:00:00 至 2021.01.31 23:59:59',
style: TextStyle(
color: MyColours.color_ffffff,
fontSize: ScreenUtil().setSp(22))),
),
],
),
Positioned(
top: 0,
right: 0,
child: Row(
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text('被领取:99张',
style: TextStyle(
color: MyColours.color_ffffff,
fontSize: ScreenUtil().setSp(22))),
Text('已使用:9张',
style: TextStyle(
color: MyColours.color_ffffff,
fontSize: ScreenUtil().setSp(22))),
],
),
HEmptyView(20),
RoundButton(
width: ScreenUtil().setWidth(100),
height: ScreenUtil().setWidth(50),
radius: ScreenUtil().setWidth(10),
text: switchState ? '停用' : '启用',
textColor: MyColours.color_666666,
gradientStart: Colors.white,
gradientEnd: Colors.white,
onPressed: widget.onPressed,
)
],
),
)
],
),
));
}
}