|
|
|
1
|
+import 'package:common_utils/common_utils.dart';
|
|
|
|
2
|
+import 'package:flutter/material.dart';
|
|
|
|
3
|
+import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
|
|
4
|
+import 'package:one_key/res/colors.dart';
|
|
|
|
5
|
+import 'package:one_key/utils/dialog_util.dart';
|
|
|
|
6
|
+import 'package:one_key/utils/utils.dart';
|
|
|
|
7
|
+import 'package:one_key/widgets/h_empty_view.dart';
|
|
|
|
8
|
+import 'package:one_key/widgets/system_app_bar.dart';
|
|
|
|
9
|
+import 'package:video_compress/video_compress.dart';
|
|
|
|
10
|
+
|
|
|
|
11
|
+typedef ClickCallback = void Function(String value);
|
|
|
|
12
|
+enum TimeType { TimeTypeStart, TimeTypeEnd, TimeTypeDefalt }
|
|
|
|
13
|
+
|
|
|
|
14
|
+class StatisticsPage extends StatefulWidget {
|
|
|
|
15
|
+ StatisticsPage({Key key}) : super(key: key);
|
|
|
|
16
|
+
|
|
|
|
17
|
+ @override
|
|
|
|
18
|
+ _StatisticsPageState createState() => _StatisticsPageState();
|
|
|
|
19
|
+}
|
|
|
|
20
|
+
|
|
|
|
21
|
+class _StatisticsPageState extends State<StatisticsPage> {
|
|
|
|
22
|
+ String dateS = "开始日期"; //开始时间
|
|
|
|
23
|
+ String dateE = "结束日期"; //结束时间
|
|
|
|
24
|
+ DateTime datetimeS; //开始时间
|
|
|
|
25
|
+ DateTime datetimeE; //结束时间
|
|
|
|
26
|
+ DateTime dateNow; //当前日期
|
|
|
|
27
|
+ bool showWidget = false;
|
|
|
|
28
|
+ List<String> selectList;
|
|
|
|
29
|
+ int currentIndex = 0;
|
|
|
|
30
|
+ TextEditingController controller = TextEditingController();
|
|
|
|
31
|
+
|
|
|
|
32
|
+ @override
|
|
|
|
33
|
+ void initState() {
|
|
|
|
34
|
+ super.initState();
|
|
|
|
35
|
+
|
|
|
|
36
|
+ datetimeS = DateTime.now();
|
|
|
|
37
|
+ datetimeE = datetimeS.add(Duration(days: 1));
|
|
|
|
38
|
+ // dateS = DateUtil.formatDate(datetimeS, format: DateFormats.y_mo_d);
|
|
|
|
39
|
+ // dateE = DateUtil.formatDate(datetimeE, format: DateFormats.y_mo_d);
|
|
|
|
40
|
+ dateNow = datetimeS;
|
|
|
|
41
|
+ selectList = ['预订次数多到少', '消费总金额高到低', '人均高到低'];
|
|
|
|
42
|
+ controller.text = '50';
|
|
|
|
43
|
+ }
|
|
|
|
44
|
+
|
|
|
|
45
|
+ ///筛选条件
|
|
|
|
46
|
+ Widget _menuWidget(DateTime date) {
|
|
|
|
47
|
+ return Container(
|
|
|
|
48
|
+ padding: EdgeInsets.symmetric(vertical: ScreenUtil().setWidth(26)),
|
|
|
|
49
|
+ height: ScreenUtil().setWidth(100),
|
|
|
|
50
|
+ child: Row(
|
|
|
|
51
|
+ children: [
|
|
|
|
52
|
+ GestureDetector(
|
|
|
|
53
|
+ onTap: () {
|
|
|
|
54
|
+ DialogUtil.showCalendarDialog(context, date).then((day) {
|
|
|
|
55
|
+ if (day != null) {}
|
|
|
|
56
|
+ });
|
|
|
|
57
|
+ },
|
|
|
|
58
|
+ child: Container(
|
|
|
|
59
|
+ child: Text(
|
|
|
|
60
|
+ dateS,
|
|
|
|
61
|
+ style: TextStyle(
|
|
|
|
62
|
+ color: MyColours.color_199095,
|
|
|
|
63
|
+ fontSize: ScreenUtil().setSp(26)),
|
|
|
|
64
|
+ ),
|
|
|
|
65
|
+ ),
|
|
|
|
66
|
+ ),
|
|
|
|
67
|
+ ],
|
|
|
|
68
|
+ ),
|
|
|
|
69
|
+ );
|
|
|
|
70
|
+ }
|
|
|
|
71
|
+
|
|
|
|
72
|
+ _buttonChoose(String title, ClickCallback callback,
|
|
|
|
73
|
+ {TimeType timeType = TimeType.TimeTypeDefalt}) {
|
|
|
|
74
|
+ return InkWell(
|
|
|
|
75
|
+ onTap: () {
|
|
|
|
76
|
+ callback(title);
|
|
|
|
77
|
+ },
|
|
|
|
78
|
+ child: Container(
|
|
|
|
79
|
+ padding: EdgeInsets.symmetric(
|
|
|
|
80
|
+ horizontal: ScreenUtil().setWidth(10),
|
|
|
|
81
|
+ vertical: ScreenUtil().setWidth(6)),
|
|
|
|
82
|
+ height: ScreenUtil().setWidth(48),
|
|
|
|
83
|
+ decoration: BoxDecoration(
|
|
|
|
84
|
+ border: Border.all(
|
|
|
|
85
|
+ width: ScreenUtil().setWidth(2),
|
|
|
|
86
|
+ color: MyColours.color_199095),
|
|
|
|
87
|
+ borderRadius: BorderRadius.circular(ScreenUtil().setWidth(10))),
|
|
|
|
88
|
+ child: Row(
|
|
|
|
89
|
+ children: [
|
|
|
|
90
|
+ Text(
|
|
|
|
91
|
+ title,
|
|
|
|
92
|
+ style: TextStyle(
|
|
|
|
93
|
+ color: title == '开始日期' || title == '结束日期' || title == '排序'
|
|
|
|
94
|
+ ? MyColours.color_999999
|
|
|
|
95
|
+ : MyColours.color_199095,
|
|
|
|
96
|
+ fontSize: ScreenUtil().setWidth(26)),
|
|
|
|
97
|
+ ),
|
|
|
|
98
|
+ timeType != TimeType.TimeTypeDefalt
|
|
|
|
99
|
+ ? SizedBox()
|
|
|
|
100
|
+ : HEmptyView(10),
|
|
|
|
101
|
+ timeType != TimeType.TimeTypeDefalt
|
|
|
|
102
|
+ ? SizedBox()
|
|
|
|
103
|
+ : Image.asset(
|
|
|
|
104
|
+ Utils.getImgPath('enter_order_arrow'),
|
|
|
|
105
|
+ width: ScreenUtil().setWidth(20),
|
|
|
|
106
|
+ height: ScreenUtil().setWidth(10),
|
|
|
|
107
|
+ )
|
|
|
|
108
|
+ ],
|
|
|
|
109
|
+ )));
|
|
|
|
110
|
+ }
|
|
|
|
111
|
+
|
|
|
|
112
|
+ _selectWidget(List<String> data, CustomCallBack onTap) {
|
|
|
|
113
|
+ return Container(
|
|
|
|
114
|
+ decoration: BoxDecoration(
|
|
|
|
115
|
+ color: MyColours.color_ffffff,
|
|
|
|
116
|
+ borderRadius: BorderRadius.circular(ScreenUtil().setWidth(10)),
|
|
|
|
117
|
+ border: Border.all(
|
|
|
|
118
|
+ color: MyColours.color_cccccc,
|
|
|
|
119
|
+ width: ScreenUtil().setWidth(2))),
|
|
|
|
120
|
+ width: ScreenUtil().setWidth(132 * 2),
|
|
|
|
121
|
+ constraints: BoxConstraints(
|
|
|
|
122
|
+ maxHeight: ScreenUtil().setWidth(104 * 2),
|
|
|
|
123
|
+ ),
|
|
|
|
124
|
+ child: ListView.builder(
|
|
|
|
125
|
+ padding:
|
|
|
|
126
|
+ EdgeInsets.symmetric(horizontal: ScreenUtil().setWidth(20)),
|
|
|
|
127
|
+ itemCount: data.length,
|
|
|
|
128
|
+ itemBuilder: (context, index) {
|
|
|
|
129
|
+ return InkWell(
|
|
|
|
130
|
+ onTap: () {
|
|
|
|
131
|
+ onTap(index);
|
|
|
|
132
|
+ },
|
|
|
|
133
|
+ child: Container(
|
|
|
|
134
|
+ padding:
|
|
|
|
135
|
+ EdgeInsets.symmetric(vertical: ScreenUtil().setWidth(20)),
|
|
|
|
136
|
+ decoration: BoxDecoration(
|
|
|
|
137
|
+ border: Border(
|
|
|
|
138
|
+ bottom: BorderSide(
|
|
|
|
139
|
+ color: MyColours.color_efefef,
|
|
|
|
140
|
+ width: data.length - 1 == index
|
|
|
|
141
|
+ ? 0
|
|
|
|
142
|
+ : ScreenUtil().setWidth(2)))),
|
|
|
|
143
|
+ child: Text(data[index],
|
|
|
|
144
|
+ style: TextStyle(
|
|
|
|
145
|
+ color: MyColours.color_199095,
|
|
|
|
146
|
+ fontWeight: FontWeight.bold,
|
|
|
|
147
|
+ fontSize: ScreenUtil().setSp(28))),
|
|
|
|
148
|
+ ),
|
|
|
|
149
|
+ );
|
|
|
|
150
|
+ }));
|
|
|
|
151
|
+ }
|
|
|
|
152
|
+
|
|
|
|
153
|
+ @override
|
|
|
|
154
|
+ Widget build(BuildContext context) {
|
|
|
|
155
|
+ return Scaffold(
|
|
|
|
156
|
+ backgroundColor: MyColours.color_ffffff,
|
|
|
|
157
|
+ appBar: SystemAppBar(
|
|
|
|
158
|
+ '统计列表',
|
|
|
|
159
|
+ rightImgName: '清空',
|
|
|
|
160
|
+ onTapRight: () {
|
|
|
|
161
|
+ //
|
|
|
|
162
|
+ },
|
|
|
|
163
|
+ onTap: () {
|
|
|
|
164
|
+ Navigator.pop(context);
|
|
|
|
165
|
+ },
|
|
|
|
166
|
+ ),
|
|
|
|
167
|
+ body: Column(
|
|
|
|
168
|
+ crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
169
|
+ children: [
|
|
|
|
170
|
+ Padding(
|
|
|
|
171
|
+ padding:
|
|
|
|
172
|
+ EdgeInsets.symmetric(horizontal: ScreenUtil().setWidth(40)),
|
|
|
|
173
|
+ child: Container(
|
|
|
|
174
|
+ height: ScreenUtil().setWidth(100),
|
|
|
|
175
|
+ child: Row(
|
|
|
|
176
|
+ children: [
|
|
|
|
177
|
+ _buttonChoose(dateS, (value) {
|
|
|
|
178
|
+ DialogUtil.showCalendarDialog(context, datetimeS)
|
|
|
|
179
|
+ .then((day) {
|
|
|
|
180
|
+ if (day != null) {
|
|
|
|
181
|
+ setState(() {
|
|
|
|
182
|
+ datetimeS = day;
|
|
|
|
183
|
+ dateS = DateUtil.formatDate(datetimeS,
|
|
|
|
184
|
+ format: DateFormats.y_mo_d);
|
|
|
|
185
|
+ });
|
|
|
|
186
|
+ }
|
|
|
|
187
|
+ });
|
|
|
|
188
|
+ }, timeType: TimeType.TimeTypeStart),
|
|
|
|
189
|
+ HEmptyView(10),
|
|
|
|
190
|
+ Text(
|
|
|
|
191
|
+ '至',
|
|
|
|
192
|
+ style: TextStyle(
|
|
|
|
193
|
+ fontSize: ScreenUtil().setSp(28),
|
|
|
|
194
|
+ color: MyColours.color_199095,
|
|
|
|
195
|
+ fontWeight: FontWeight.bold),
|
|
|
|
196
|
+ ),
|
|
|
|
197
|
+ HEmptyView(10),
|
|
|
|
198
|
+ _buttonChoose(dateE, (value) {
|
|
|
|
199
|
+ DialogUtil.showCalendarDialog(context, datetimeE)
|
|
|
|
200
|
+ .then((day) {
|
|
|
|
201
|
+ if (day != null) {
|
|
|
|
202
|
+ setState(() {
|
|
|
|
203
|
+ datetimeE = day;
|
|
|
|
204
|
+ dateE = DateUtil.formatDate(datetimeE,
|
|
|
|
205
|
+ format: DateFormats.y_mo_d);
|
|
|
|
206
|
+ });
|
|
|
|
207
|
+ }
|
|
|
|
208
|
+ });
|
|
|
|
209
|
+ }, timeType: TimeType.TimeTypeEnd),
|
|
|
|
210
|
+ HEmptyView(10),
|
|
|
|
211
|
+ Stack(clipBehavior: Clip.none, children: [
|
|
|
|
212
|
+ _buttonChoose('排序', (value) {
|
|
|
|
213
|
+ setState(() {
|
|
|
|
214
|
+ showWidget = !showWidget;
|
|
|
|
215
|
+ print('1');
|
|
|
|
216
|
+ });
|
|
|
|
217
|
+ }),
|
|
|
|
218
|
+ Positioned(
|
|
|
|
219
|
+ left: 0,
|
|
|
|
220
|
+ top: ScreenUtil().setWidth(58),
|
|
|
|
221
|
+ child: Material(
|
|
|
|
222
|
+ color: Colors.transparent,
|
|
|
|
223
|
+ child: Offstage(
|
|
|
|
224
|
+ offstage: showWidget,
|
|
|
|
225
|
+ child: _selectWidget(selectList, (index) {
|
|
|
|
226
|
+ setState(() {
|
|
|
|
227
|
+ showWidget = !showWidget;
|
|
|
|
228
|
+ currentIndex = index;
|
|
|
|
229
|
+ });
|
|
|
|
230
|
+ }),
|
|
|
|
231
|
+ ))),
|
|
|
|
232
|
+ ])
|
|
|
|
233
|
+ ],
|
|
|
|
234
|
+ ),
|
|
|
|
235
|
+ )),
|
|
|
|
236
|
+ Container(
|
|
|
|
237
|
+ alignment: Alignment.centerLeft,
|
|
|
|
238
|
+ padding:
|
|
|
|
239
|
+ EdgeInsets.symmetric(horizontal: ScreenUtil().setWidth(40)),
|
|
|
|
240
|
+ color: MyColours.color_f5f5f5,
|
|
|
|
241
|
+ // width: double.infinity,
|
|
|
|
242
|
+ height: ScreenUtil().setWidth(80),
|
|
|
|
243
|
+ child: Row(
|
|
|
|
244
|
+ children: [
|
|
|
|
245
|
+ Text(
|
|
|
|
246
|
+ '显示前 ',
|
|
|
|
247
|
+ style: TextStyle(
|
|
|
|
248
|
+ fontSize: ScreenUtil().setSp(26),
|
|
|
|
249
|
+ color: MyColours.color_333333),
|
|
|
|
250
|
+ ),
|
|
|
|
251
|
+ Container(
|
|
|
|
252
|
+ alignment: Alignment.center,
|
|
|
|
253
|
+ margin: EdgeInsets.symmetric(
|
|
|
|
254
|
+ vertical: ScreenUtil().setWidth(20)),
|
|
|
|
255
|
+ // alignment: Alignment.centerLeft,
|
|
|
|
256
|
+ // height: ScreenUtil().setWidth(80),
|
|
|
|
257
|
+ constraints: BoxConstraints(
|
|
|
|
258
|
+ maxWidth: ScreenUtil().setWidth(50 * 2)),
|
|
|
|
259
|
+ decoration: BoxDecoration(
|
|
|
|
260
|
+ border: Border(
|
|
|
|
261
|
+ bottom: BorderSide(
|
|
|
|
262
|
+ width: ScreenUtil().setWidth(2),
|
|
|
|
263
|
+ color: MyColours.color_199095))),
|
|
|
|
264
|
+ child: IntrinsicWidth(
|
|
|
|
265
|
+ child: TextField(
|
|
|
|
266
|
+ controller: controller,
|
|
|
|
267
|
+ maxLines: 1,
|
|
|
|
268
|
+ // inputFormatters: [
|
|
|
|
269
|
+ // LengthLimitingTextInputFormatter(9),
|
|
|
|
270
|
+ // WhitelistingTextInputFormatter.digitsOnly
|
|
|
|
271
|
+ // ],
|
|
|
|
272
|
+
|
|
|
|
273
|
+ // inputFormatters: [
|
|
|
|
274
|
+ // NumLengthInputFormatter(
|
|
|
|
275
|
+ // decimalLength: 2, integerLength: 6),
|
|
|
|
276
|
+ // ],
|
|
|
|
277
|
+ // focusNode: numberFocusNode,
|
|
|
|
278
|
+
|
|
|
|
279
|
+ //光标颜色
|
|
|
|
280
|
+ cursorColor: MyColours.color_199095,
|
|
|
|
281
|
+ //输入文本的样式
|
|
|
|
282
|
+ style: TextStyle(
|
|
|
|
283
|
+ fontSize: ScreenUtil().setSp(26),
|
|
|
|
284
|
+ color: MyColours.color_199095),
|
|
|
|
285
|
+ textAlign: TextAlign.center,
|
|
|
|
286
|
+ textInputAction: TextInputAction.done,
|
|
|
|
287
|
+ decoration: InputDecoration(
|
|
|
|
288
|
+ isDense: true,
|
|
|
|
289
|
+ hintText: "输入",
|
|
|
|
290
|
+ hintStyle: TextStyle(
|
|
|
|
291
|
+ color: MyColours.color_999999,
|
|
|
|
292
|
+ fontSize: ScreenUtil().setSp(26),
|
|
|
|
293
|
+ ),
|
|
|
|
294
|
+
|
|
|
|
295
|
+ contentPadding: EdgeInsets.zero, //ios 17
|
|
|
|
296
|
+ border: InputBorder.none,
|
|
|
|
297
|
+ ),
|
|
|
|
298
|
+ onChanged: (value) {},
|
|
|
|
299
|
+ onEditingComplete: () {
|
|
|
|
300
|
+ FocusScope.of(context)
|
|
|
|
301
|
+ .requestFocus(FocusNode()); //隐藏键盘
|
|
|
|
302
|
+ // _updateMoney();
|
|
|
|
303
|
+ },
|
|
|
|
304
|
+ keyboardType:
|
|
|
|
305
|
+ TextInputType.numberWithOptions(decimal: true),
|
|
|
|
306
|
+ )))
|
|
|
|
307
|
+ ],
|
|
|
|
308
|
+ )),
|
|
|
|
309
|
+ ],
|
|
|
|
310
|
+ ),
|
|
|
|
311
|
+ );
|
|
|
|
312
|
+ }
|
|
|
|
313
|
+} |