sms_manager.dart
13.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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:one_key/models/sms_info.dart';
import 'package:one_key/provider/my_model.dart';
import 'package:one_key/res/colors.dart';
import 'package:one_key/route/navigator_util.dart';
import 'package:one_key/utils/event_bus.dart';
import 'package:one_key/utils/utils.dart';
import 'package:one_key/widgets/MyDivider.dart';
import 'package:one_key/widgets/h_empty_view.dart';
import 'package:one_key/widgets/round_button.dart';
import 'package:one_key/widgets/system_app_bar.dart';
import 'package:one_key/widgets/v_empty_view.dart';
import 'package:provider/provider.dart';
class SmsManagerPage extends StatefulWidget {
SmsInfoData infoData;
SmsManagerPage({Key key, this.infoData}) : super(key: key);
@override
_SmsManagerPageState createState() => _SmsManagerPageState();
}
class _SmsManagerPageState extends State<SmsManagerPage> {
bool isShow = false;
@override
void initState() {
// TODO: implement initState
super.initState();
isShow = widget.infoData.meals.any((element) => element.discount != '0');
Utils.changeStatusColor(color: MyColours.color_199095);
EventBus().on('refreshSmsNum', (arg) {
_getSmsInfo(context);
});
}
@override
void dispose() {
// TODO: implement dispose
super.dispose();
EventBus().emit('changeStatusColor');
EventBus().emit('refreshMySms');
EventBus().off('refreshSmsNum');
}
_getSmsInfo(context) async {
MyModel myModel = Provider.of<MyModel>(context, listen: false);
widget.infoData = await myModel.getSmsInfo(context);
isShow = widget.infoData.meals.any((element) => element.discount != '0');
setState(() {});
// setState(() {
// if (smsInfoData != null) {
// smsInfo = smsInfoData?.lastNum;
// }
// });
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: SystemAppBar(
'短信管理',
bgColor: MyColours.color_199095,
needWhite: true,
),
body: NestedScrollView(
// controller: _scrollViewController,
headerSliverBuilder:
(BuildContext context, bool innerBoxIsScrolled) {
return <Widget>[
SliverAppBar(
pinned: false,
floating: false,
leading: Container(),
backgroundColor: MyColours.color_F8F9FD,
expandedHeight: ScreenUtil().setWidth(320 + 40),
flexibleSpace: FlexibleSpaceBar(
title: null,
collapseMode: CollapseMode.pin,
background: Consumer<MyModel>(builder:
(BuildContext context, MyModel model, Widget child) {
return Container(
width: double.infinity,
height: ScreenUtil().setHeight(320 + 30),
color: MyColours.color_199095,
child: Padding(
padding:
EdgeInsets.only(left: ScreenUtil().setWidth(30)),
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
VEmptyView(80),
Container(
height: ScreenUtil().setWidth(40),
child: Text(
'短信余量',
style: TextStyle(
color: MyColours.color_ffffff,
fontSize: ScreenUtil().setSp(30)),
),
),
VEmptyView(10),
Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Container(
// height: ScreenUtil().setWidth(40),
child: Text(
widget.infoData.lastNum,
style: TextStyle(
color: MyColours.color_ffffff,
fontWeight: FontWeight.bold,
fontSize: ScreenUtil().setSp(36)),
)),
Container(
// height: ScreenUtil().setWidth(40),
child: Text(
' 条',
style: TextStyle(
color: MyColours.color_ffffff,
fontSize: ScreenUtil().setSp(30)),
))
],
),
VEmptyView(80),
Stack(children: [
RoundButton(
text: '立即充值',
gradientStart: MyColours.color_ffffff,
gradientEnd: MyColours.color_ffffff,
borderColor: Color.fromRGBO(255, 255, 255, 0.2),
width: ScreenUtil().setWidth(225),
height: ScreenUtil().setWidth(80),
textColor: MyColours.color_199095,
radius: ScreenUtil().setWidth(10),
fontSize: 28,
isBold: true,
imgWidth: 26,
onPressed: () {
NavigatorUtil.goSmsRechargePage(context,
smsInfoData: widget.infoData);
},
),
isShow
? Positioned(
top: 0,
right: 0,
child: Container(
// padding: EdgeInsets.symmetric(horizontal: ScreenUtil().setWidth(16),vertical: ScreenUtil().setWidth(4)),
padding: EdgeInsets.only(
left: ScreenUtil().setWidth(6)),
alignment: Alignment.center,
width: ScreenUtil().setWidth(34 * 2),
height: ScreenUtil().setWidth(30),
decoration: BoxDecoration(
// color: Colors.red,
image: DecorationImage(
image: ExactAssetImage(
Utils.getImgPath('sms_manager'),
),
fit: BoxFit.cover,
),
),
child: Text(
'特惠',
style: TextStyle(
color: MyColours.color_fefefe,
fontSize:
ScreenUtil().setSp(24)),
)),
)
: SizedBox()
])
],
)),
);
}),
),
)
];
}, body: Consumer<MyModel>(
builder: (BuildContext context, MyModel model, Widget child) {
return MediaQuery.removePadding(
context: context,
child: SingleChildScrollView(
child: Padding(
padding: EdgeInsets.symmetric(
horizontal: ScreenUtil().setWidth(40)),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
VEmptyView(60),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
MyDivider(ScreenUtil().setWidth(130),
ScreenUtil().setWidth(2)),
HEmptyView(40),
Text(
'常见问题说明',
style: TextStyle(
fontSize: ScreenUtil().setSp(28),
color: MyColours.color_333333),
),
HEmptyView(40),
MyDivider(ScreenUtil().setWidth(130),
ScreenUtil().setWidth(2))
],
),
VEmptyView(40),
Text(
"1.短信计费",
style: TextStyle(
color: MyColours.color_333333,
fontSize: ScreenUtil().setSp(28),
fontWeight: FontWeight.bold),
),
Container(
margin: EdgeInsets.only(
top: ScreenUtil().setWidth(20),
bottom: ScreenUtil().setWidth(20)),
child: Text(
"· 短信计费统一根据三大运营商标注计算;\n· 当短信内容字符数≤70,短信按照一条计费;\n· 当短信内容字符数>70个字符时,按照每70个字符为一条短信;",
style: TextStyle(
color: MyColours.color_333333,
fontSize: ScreenUtil().setSp(28),
),
strutStyle: StrutStyle(
forceStrutHeight: true,
height: 1,
leading: 0.3),
),
),
MyDivider(
double.infinity, ScreenUtil().setWidth(1)),
VEmptyView(40),
Text(
"2.短信统计",
style: TextStyle(
color: MyColours.color_333333,
fontSize: ScreenUtil().setSp(28),
fontWeight: FontWeight.bold),
),
Container(
margin: EdgeInsets.only(
top: ScreenUtil().setWidth(20),
bottom: ScreenUtil().setWidth(20)),
child: Text(
"· 短信统计只统计计费短信,与订单数量无关,一个订单可能会发送多条短信,则计费时按照多条短信计费;",
style: TextStyle(
color: MyColours.color_333333,
fontSize: ScreenUtil().setSp(28),
),
strutStyle: StrutStyle(
forceStrutHeight: true,
height: 1,
leading: 0.3),
),
),
MyDivider(
double.infinity, ScreenUtil().setWidth(1)),
VEmptyView(40),
Text(
"3.充值说明",
style: TextStyle(
color: MyColours.color_333333,
fontSize: ScreenUtil().setSp(28),
fontWeight: FontWeight.bold),
),
Container(
margin: EdgeInsets.only(
top: ScreenUtil().setWidth(20),
bottom: ScreenUtil().setWidth(20)),
child: Text(
"· 短信统一在订座商户小程序上进行充值,充值记录和详细使用情况统一在小程序上查看。",
style: TextStyle(
color: MyColours.color_333333,
fontSize: ScreenUtil().setSp(28),
),
strutStyle: StrutStyle(
forceStrutHeight: true,
height: 1,
leading: 0.3),
),
),
]))));
})));
}
}