|
1
|
import 'package:flutter/material.dart';
|
1
|
import 'package:flutter/material.dart';
|
|
2
|
-import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
|
|
3
|
import 'package:one_key/widgets/MyDivider.dart';
|
2
|
import 'package:one_key/widgets/MyDivider.dart';
|
|
4
|
import 'package:one_key/widgets/system_app_bar.dart';
|
3
|
import 'package:one_key/widgets/system_app_bar.dart';
|
|
5
|
import 'package:one_key/widgets/v_empty_view.dart';
|
4
|
import 'package:one_key/widgets/v_empty_view.dart';
|
|
6
|
|
5
|
|
|
7
|
import '../../../models/filter_btn_model.dart';
|
6
|
import '../../../models/filter_btn_model.dart';
|
|
|
|
7
|
+import '../../../models/settime.dart';
|
|
8
|
import '../../../res/colors.dart';
|
8
|
import '../../../res/colors.dart';
|
|
9
|
import '../../../utils/dialog_util.dart';
|
9
|
import '../../../utils/dialog_util.dart';
|
|
10
|
import '../../../utils/screen_util.dart';
|
10
|
import '../../../utils/screen_util.dart';
|
|
11
|
import '../../../utils/utils.dart';
|
11
|
import '../../../utils/utils.dart';
|
|
12
|
import '../../../widgets/h_empty_view.dart';
|
12
|
import '../../../widgets/h_empty_view.dart';
|
|
13
|
import '../../../widgets/round_button.dart';
|
13
|
import '../../../widgets/round_button.dart';
|
|
14
|
-import 'package:calendar_date_picker2/calendar_date_picker2.dart';
|
|
|
|
15
|
-import 'dart:math';
|
14
|
+import '../../../widgets/set_time_widget.dart';
|
|
16
|
|
15
|
|
|
17
|
/**
|
16
|
/**
|
|
18
|
* 多时段编辑页面
|
17
|
* 多时段编辑页面
|
|
@@ -32,24 +31,34 @@ class _BookTimeSettingEditPageState extends State<BookTimeSettingEditPage> { |
|
@@ -32,24 +31,34 @@ class _BookTimeSettingEditPageState extends State<BookTimeSettingEditPage> { |
|
32
|
List<FilterBtnModel> weekData = [];
|
31
|
List<FilterBtnModel> weekData = [];
|
|
33
|
String weekShow = '点击选择日期(可多选)';
|
32
|
String weekShow = '点击选择日期(可多选)';
|
|
34
|
|
33
|
|
|
35
|
- List<DateTime> _multiDatePickerValueWithDefaultValue = [
|
|
|
|
36
|
- DateTime(DateTime.now().year, DateTime.now().month, 1),
|
|
|
|
37
|
- DateTime(DateTime.now().year, DateTime.now().month, 5),
|
|
|
|
38
|
- DateTime(DateTime.now().year, DateTime.now().month, 14),
|
|
|
|
39
|
- DateTime(DateTime.now().year, DateTime.now().month, 17),
|
|
|
|
40
|
- DateTime(DateTime.now().year, DateTime.now().month, 25),
|
|
|
|
41
|
- ];
|
34
|
+ List<DateTime> _selectPickerValues = [];
|
|
42
|
|
35
|
|
|
43
|
- List<DateTime> _dialogCalendarPickerValue = [
|
|
|
|
44
|
- DateTime(DateTime.now().year, DateTime.now().month, 1),
|
|
|
|
45
|
- DateTime(DateTime.now().year, DateTime.now().month, 5),
|
|
|
|
46
|
- ];
|
36
|
+ List swichState;
|
|
|
|
37
|
+ SetTime morning = SetTime();
|
|
|
|
38
|
+ SetTime noon = SetTime();
|
|
|
|
39
|
+ SetTime night = SetTime();
|
|
47
|
|
40
|
|
|
48
|
- ScrollController yearC = ScrollController();
|
41
|
+ TextEditingController _booktime1 = TextEditingController();
|
|
|
|
42
|
+ TextEditingController _booktime2 = TextEditingController();
|
|
|
|
43
|
+ TextEditingController _booktime3 = TextEditingController();
|
|
|
|
44
|
+ TextEditingController _booktime4 = TextEditingController();
|
|
|
|
45
|
+ TextEditingController _booktime5 = TextEditingController();
|
|
49
|
|
46
|
|
|
50
|
@override
|
47
|
@override
|
|
51
|
void initState() {
|
48
|
void initState() {
|
|
52
|
super.initState();
|
49
|
super.initState();
|
|
|
|
50
|
+ _booktime1.text = '早茶';
|
|
|
|
51
|
+ _booktime2.text = '午餐';
|
|
|
|
52
|
+ _booktime3.text = '晚餐';
|
|
|
|
53
|
+ _booktime4.text = '夜宵';
|
|
|
|
54
|
+
|
|
|
|
55
|
+ morning.start = '07:00';
|
|
|
|
56
|
+ morning.end = '10:00';
|
|
|
|
57
|
+ noon.start = '11:00';
|
|
|
|
58
|
+ noon.end = '14:30';
|
|
|
|
59
|
+ night.start = '16:00';
|
|
|
|
60
|
+ night.end = '21:00';
|
|
|
|
61
|
+ swichState = [false, true, true, false, false];
|
|
53
|
_initWeekData();
|
62
|
_initWeekData();
|
|
54
|
WidgetsBinding.instance.addPostFrameCallback((_) {});
|
63
|
WidgetsBinding.instance.addPostFrameCallback((_) {});
|
|
55
|
}
|
64
|
}
|
|
@@ -87,32 +96,34 @@ class _BookTimeSettingEditPageState extends State<BookTimeSettingEditPage> { |
|
@@ -87,32 +96,34 @@ class _BookTimeSettingEditPageState extends State<BookTimeSettingEditPage> { |
|
87
|
}
|
96
|
}
|
|
88
|
|
97
|
|
|
89
|
String _getValueText(
|
98
|
String _getValueText(
|
|
90
|
- CalendarDatePicker2Type datePickerType,
|
99
|
+ // CalendarDatePicker2Type datePickerType,
|
|
91
|
List<DateTime> values,
|
100
|
List<DateTime> values,
|
|
92
|
) {
|
101
|
) {
|
|
93
|
- values =
|
|
|
|
94
|
- values.map((e) => e != null ? DateUtils.dateOnly(e) : null).toList();
|
|
|
|
95
|
- var valueText = (values.isNotEmpty ? values[0] : null)
|
|
|
|
96
|
- .toString()
|
|
|
|
97
|
- .replaceAll('00:00:00.000', '');
|
102
|
+ // values =
|
|
|
|
103
|
+ // values.map((e) => e != null ? DateUtils.dateOnly(e) : null).toList();
|
|
|
|
104
|
+ // var valueText = (values.isNotEmpty ? values[0] : null)
|
|
|
|
105
|
+ // .toString()
|
|
|
|
106
|
+ // .replaceAll('00:00:00.000', '');
|
|
98
|
|
107
|
|
|
99
|
- if (datePickerType == CalendarDatePicker2Type.multi) {
|
|
|
|
100
|
- valueText = values.isNotEmpty
|
|
|
|
101
|
- ? values
|
|
|
|
102
|
- .map((v) => v.toString().replaceAll('00:00:00.000', ''))
|
|
|
|
103
|
- .join(', ')
|
|
|
|
104
|
- : 'null';
|
|
|
|
105
|
- } else if (datePickerType == CalendarDatePicker2Type.range) {
|
|
|
|
106
|
- if (values.isNotEmpty) {
|
|
|
|
107
|
- final startDate = values[0].toString().replaceAll('00:00:00.000', '');
|
|
|
|
108
|
- final endDate = values.length > 1
|
|
|
|
109
|
- ? values[1].toString().replaceAll('00:00:00.000', '')
|
|
|
|
110
|
- : 'null';
|
|
|
|
111
|
- valueText = '$startDate to $endDate';
|
|
|
|
112
|
- } else {
|
|
|
|
113
|
- return 'null';
|
|
|
|
114
|
- }
|
|
|
|
115
|
- }
|
108
|
+ // if (datePickerType == CalendarDatePicker2Type.multi) {
|
|
|
|
109
|
+ var valueText = values.isNotEmpty
|
|
|
|
110
|
+ ? values
|
|
|
|
111
|
+ .map((v) =>
|
|
|
|
112
|
+ v.toString().replaceAll('00:00:00.000', '').substring(2) +
|
|
|
|
113
|
+ '${Utils.lunarCalendarHolidaysShow(v)}')
|
|
|
|
114
|
+ .join(' ')
|
|
|
|
115
|
+ : '点击选择日期(可多选)';
|
|
|
|
116
|
+ // } else if (datePickerType == CalendarDatePicker2Type.range) {
|
|
|
|
117
|
+ // if (values.isNotEmpty) {
|
|
|
|
118
|
+ // final startDate = values[0].toString().replaceAll('00:00:00.000', '');
|
|
|
|
119
|
+ // final endDate = values.length > 1
|
|
|
|
120
|
+ // ? values[1].toString().replaceAll('00:00:00.000', '')
|
|
|
|
121
|
+ // : 'null';
|
|
|
|
122
|
+ // valueText = '$startDate to $endDate';
|
|
|
|
123
|
+ // } else {
|
|
|
|
124
|
+ // return 'null';
|
|
|
|
125
|
+ // }
|
|
|
|
126
|
+ // }
|
|
116
|
|
127
|
|
|
117
|
return valueText;
|
128
|
return valueText;
|
|
118
|
}
|
129
|
}
|
|
@@ -131,351 +142,23 @@ class _BookTimeSettingEditPageState extends State<BookTimeSettingEditPage> { |
|
@@ -131,351 +142,23 @@ class _BookTimeSettingEditPageState extends State<BookTimeSettingEditPage> { |
|
131
|
}
|
142
|
}
|
|
132
|
}
|
143
|
}
|
|
133
|
|
144
|
|
|
134
|
- //显示日历弹框
|
|
|
|
135
|
- Future<DateTime> showCalendarDialogMultiple(BuildContext context) {
|
|
|
|
136
|
- return showModalBottomSheet<DateTime>(
|
|
|
|
137
|
- context: context,
|
|
|
|
138
|
- isScrollControlled: true,
|
|
|
|
139
|
- builder: (BuildContext context) {
|
|
|
|
140
|
- BuildContext dialogContext = context;
|
|
|
|
141
|
- Widget widget = StatefulBuilder(builder: (context, _setState) {
|
|
|
|
142
|
- return Container(
|
|
|
|
143
|
- color: MyColours.color_ffffff,
|
|
|
|
144
|
- child: Column(
|
|
|
|
145
|
- mainAxisSize: MainAxisSize.min,
|
|
|
|
146
|
- children: <Widget>[
|
|
|
|
147
|
- _buildMultiDatePickerWithValue(),
|
|
|
|
148
|
- VEmptyView(4),
|
|
|
|
149
|
- Row(
|
|
|
|
150
|
- mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
|
|
|
151
|
- children: [
|
|
|
|
152
|
- RoundButton(
|
|
|
|
153
|
- onPressed: () async {
|
|
|
|
154
|
- // _calendarController
|
|
|
|
155
|
- // .setSelectedDay(DateTime.now());
|
|
|
|
156
|
- _setState(() {});
|
|
|
|
157
|
- },
|
|
|
|
158
|
- text: '取消',
|
|
|
|
159
|
- fontSize: 28,
|
|
|
|
160
|
- isBold: false,
|
|
|
|
161
|
- height: ScreenUtil().setWidth(70),
|
|
|
|
162
|
- width: ScreenUtil().setWidth(220),
|
|
|
|
163
|
- gradientStart: MyColours.color_2bb5b7,
|
|
|
|
164
|
- gradientEnd: MyColours.color_2bb5b7,
|
|
|
|
165
|
- radius: ScreenUtil().setWidth(10),
|
|
|
|
166
|
- ),
|
|
|
|
167
|
- RoundButton(
|
|
|
|
168
|
- onPressed: () async {
|
|
|
|
169
|
- Navigator.pop(context);
|
|
|
|
170
|
- },
|
|
|
|
171
|
- text: '确定',
|
|
|
|
172
|
- fontSize: 28,
|
|
|
|
173
|
- isBold: false,
|
|
|
|
174
|
- textColor: MyColours.color_333333,
|
|
|
|
175
|
- borderColor: Color.fromRGBO(119, 119, 119, 1),
|
|
|
|
176
|
- height: ScreenUtil().setWidth(70),
|
|
|
|
177
|
- width: ScreenUtil().setWidth(220),
|
|
|
|
178
|
- gradientStart: Colors.transparent,
|
|
|
|
179
|
- gradientEnd: Colors.transparent,
|
|
|
|
180
|
- radius: ScreenUtil().setWidth(10),
|
|
|
|
181
|
- )
|
|
|
|
182
|
- ],
|
|
|
|
183
|
- ),
|
|
|
|
184
|
- VEmptyView(40)
|
|
|
|
185
|
- ],
|
|
|
|
186
|
- ))
|
|
|
|
187
|
-
|
|
|
|
188
|
- // Positioned(
|
|
|
|
189
|
- // right: ScreenUtil().setWidth(62),
|
|
|
|
190
|
- // bottom: ScreenUtil().setHeight(20),
|
|
|
|
191
|
- // child: Container(
|
|
|
|
192
|
- // child: GestureDetector(
|
|
|
|
193
|
- // onTap: () {
|
|
|
|
194
|
- // _calendarController.setSelectedDay(DateTime.now());
|
|
|
|
195
|
- // _setState(() {});
|
|
|
|
196
|
- // },
|
|
|
|
197
|
- // child: Container(
|
|
|
|
198
|
- // child: ClipOval(
|
|
|
|
199
|
- // child: Container(
|
|
|
|
200
|
- // width: ScreenUtil().setWidth(100),
|
|
|
|
201
|
- // height: ScreenUtil().setWidth(100),
|
|
|
|
202
|
- // alignment: Alignment.center,
|
|
|
|
203
|
- // color: MyColours.color_2bb5b7,
|
|
|
|
204
|
- // child: Text(
|
|
|
|
205
|
- // "回到\n今天",
|
|
|
|
206
|
- // style: TextStyle(
|
|
|
|
207
|
- // color: MyColours.color_ffffff,
|
|
|
|
208
|
- // fontSize: ScreenUtil().setSp(26)),
|
|
|
|
209
|
- // ),
|
|
|
|
210
|
- // )),
|
|
|
|
211
|
- // ),
|
|
|
|
212
|
- // ),
|
|
|
|
213
|
- // ),
|
|
|
|
214
|
- // )
|
|
|
|
215
|
- // ],
|
|
|
|
216
|
- ;
|
|
|
|
217
|
- });
|
|
|
|
218
|
- return SizedBox(
|
|
|
|
219
|
- width: double.infinity,
|
|
|
|
220
|
- // height: ScreenUtil().setWidth(975),
|
|
|
|
221
|
- child: widget,
|
|
|
|
222
|
- );
|
|
|
|
223
|
- });
|
|
|
|
224
|
- }
|
|
|
|
225
|
-
|
|
|
|
226
|
- String intToWeek(int week) {
|
|
|
|
227
|
- String str = '';
|
|
|
|
228
|
- switch (week) {
|
|
|
|
229
|
- case 0:
|
|
|
|
230
|
- str = '周日';
|
|
|
|
231
|
- break;
|
|
|
|
232
|
- case 1:
|
|
|
|
233
|
- str = '周一';
|
|
|
|
234
|
- break;
|
|
|
|
235
|
- case 2:
|
|
|
|
236
|
- str = '周二';
|
|
|
|
237
|
- break;
|
|
|
|
238
|
- case 3:
|
|
|
|
239
|
- str = '周三';
|
|
|
|
240
|
- break;
|
|
|
|
241
|
- case 4:
|
|
|
|
242
|
- str = '周四';
|
|
|
|
243
|
- break;
|
|
|
|
244
|
- case 5:
|
|
|
|
245
|
- str = '周五';
|
|
|
|
246
|
- break;
|
|
|
|
247
|
- case 6:
|
|
|
|
248
|
- str = '周六';
|
|
|
|
249
|
- break;
|
|
|
|
250
|
- }
|
|
|
|
251
|
- return str;
|
|
|
|
252
|
- }
|
|
|
|
253
|
-
|
|
|
|
254
|
- Widget _buildMultiDatePickerWithValue() {
|
|
|
|
255
|
- final config = CalendarDatePicker2Config(
|
|
|
|
256
|
- disableMonthPicker: true,
|
|
|
|
257
|
- calendarType: CalendarDatePicker2Type.multi,
|
|
|
|
258
|
- currentDate: DateTime.now(),
|
|
|
|
259
|
- dynamicCalendarRows: true,
|
|
|
|
260
|
- yearViewController: yearC,
|
|
|
|
261
|
- centerAlignModePicker: true,
|
|
|
|
262
|
- controlsTextStyle: TextStyle(color: MyColours.color_F8F9FD),
|
|
|
|
263
|
- lastMonthIcon: Image.asset(
|
|
|
|
264
|
- Utils.getImgPath('date_m_l'),
|
|
|
|
265
|
- width: w(8),
|
|
|
|
266
|
- ),
|
|
|
|
267
|
- nextMonthIcon: Image.asset(
|
|
|
|
268
|
- Utils.getImgPath('date_m_r'),
|
|
|
|
269
|
- width: w(8),
|
|
|
|
270
|
- ),
|
|
|
|
271
|
-
|
|
|
|
272
|
- // firstDayOfWeek: 0,
|
|
|
|
273
|
- // controlsHeight: w(100),
|
|
|
|
274
|
- // yearBuilder: (({decoration, isCurrentYear, isDisabled, isSelected, textStyle, year}) {
|
|
|
|
275
|
- // return Container(
|
|
|
|
276
|
- // width: 50,
|
|
|
|
277
|
- // height: 50,
|
|
|
|
278
|
- // color: Colors.red,
|
|
|
|
279
|
- // );
|
|
|
|
280
|
- // }),
|
|
|
|
281
|
-
|
|
|
|
282
|
- selectedDayHighlightColor: MyColours.color_438E93,
|
|
|
|
283
|
- weekdayLabelBuilder: ({isScrollViewTopHeader, weekday}) {
|
|
|
|
284
|
- return Container(
|
|
|
|
285
|
- color: MyColours.color_438E93,
|
|
|
|
286
|
- alignment: Alignment.center,
|
|
|
|
287
|
- margin: EdgeInsets.only(
|
|
|
|
288
|
- bottom: ScreenUtil().setWidth(30), right: weekday == 6 ? 0 : 1),
|
|
|
|
289
|
- // padding: EdgeInsets.symmetric(vertical: ScreenUtil().setWidth(15)),
|
|
|
|
290
|
- child: Text(
|
|
|
|
291
|
- intToWeek(weekday),
|
|
|
|
292
|
- style: TextStyle(
|
|
|
|
293
|
- color: MyColours.color_F8F9FD,
|
|
|
|
294
|
- fontSize: ScreenUtil().setSp(28)),
|
|
|
|
295
|
- ),
|
|
|
|
296
|
- );
|
|
|
|
297
|
- },
|
|
|
|
298
|
- dayMaxWidth: w(51),
|
|
|
|
299
|
-
|
|
|
|
300
|
- dayBorderRadius: BorderRadius.circular(r(5)),
|
|
|
|
301
|
- dayBuilder: ((
|
|
|
|
302
|
- {date, decoration, isDisabled, isSelected, isToday, textStyle}) {
|
|
|
|
303
|
- return Container(
|
|
|
|
304
|
- margin: EdgeInsets.all(w(4)),
|
|
|
|
305
|
- decoration: BoxDecoration(
|
|
|
|
306
|
- borderRadius: BorderRadius.circular(r(5)),
|
|
|
|
307
|
- color: isSelected
|
|
|
|
308
|
- ? MyColours.color_438E93
|
|
|
|
309
|
- : isToday
|
|
|
|
310
|
- ? MyColours.color_2bb5b7
|
|
|
|
311
|
- : MyColours.color_ffffff),
|
|
|
|
312
|
- child: Column(
|
|
|
|
313
|
- mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
314
|
- children: [
|
|
|
|
315
|
- Text(
|
|
|
|
316
|
- // "${_parseDateDay(date)}",
|
|
|
|
317
|
- '${Utils.addZeroNumber(date.day)}',
|
|
|
|
318
|
- style: TextStyle().copyWith(
|
|
|
|
319
|
- fontSize: ScreenUtil().setSp(32),
|
|
|
|
320
|
- color: isSelected
|
|
|
|
321
|
- ? MyColours.color_F8F9FD
|
|
|
|
322
|
- : isToday
|
|
|
|
323
|
- ? MyColours.color_F8F9FD
|
|
|
|
324
|
- : MyColours.color_353535,
|
|
|
|
325
|
- fontWeight: FontWeight.bold)),
|
|
|
|
326
|
- Text(
|
|
|
|
327
|
- "${_parseDateDay(date)}",
|
|
|
|
328
|
- textAlign: TextAlign.center,
|
|
|
|
329
|
- maxLines: 1,
|
|
|
|
330
|
- overflow: TextOverflow.ellipsis,
|
|
|
|
331
|
- style: TextStyle().copyWith(
|
|
|
|
332
|
- fontSize: ScreenUtil().setSp(18),
|
|
|
|
333
|
- color: isSelected
|
|
|
|
334
|
- ? MyColours.color_F8F9FD
|
|
|
|
335
|
- : isToday
|
|
|
|
336
|
- ? MyColours.color_F8F9FD
|
|
|
|
337
|
- : MyColours.color_353535),
|
|
|
|
338
|
- ),
|
|
|
|
339
|
- ],
|
|
|
|
340
|
- ),
|
|
|
|
341
|
- );
|
|
|
|
342
|
- }),
|
|
|
|
343
|
-
|
|
|
|
344
|
- // dayBuilder: (context, date, _) {
|
|
|
|
345
|
- //
|
|
|
|
346
|
- // },
|
|
|
|
347
|
- );
|
|
|
|
348
|
-
|
|
|
|
349
|
- // selectedDayBuilder: (context, date, _) {
|
|
|
|
350
|
- // return Container(
|
|
|
|
351
|
- // // alignment: Alignment.center,
|
|
|
|
352
|
- // // margin: EdgeInsets.fromLTRB(
|
|
|
|
353
|
- // // ScreenUtil().setWidth(12),
|
|
|
|
354
|
- // // ScreenUtil().setWidth(12),
|
|
|
|
355
|
- // // ScreenUtil().setWidth(12),
|
|
|
|
356
|
- // // ScreenUtil().setWidth(32)),
|
|
|
|
357
|
- // padding: EdgeInsets.only(
|
|
|
|
358
|
- // bottom: ScreenUtil().setWidth(10),
|
|
|
|
359
|
- // left: ScreenUtil().setWidth(5),
|
|
|
|
360
|
- // right: ScreenUtil().setWidth(5),
|
|
|
|
361
|
- // top: ScreenUtil().setWidth(10)),
|
|
|
|
362
|
- // child: Container(
|
|
|
|
363
|
- // decoration: BoxDecoration(
|
|
|
|
364
|
- // borderRadius: BorderRadius.circular(
|
|
|
|
365
|
- // ScreenUtil().setWidth(10)),
|
|
|
|
366
|
- // color: Color.fromRGBO(42, 110, 109, 1)),
|
|
|
|
367
|
- // child: Column(
|
|
|
|
368
|
- // mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
369
|
- // children: [
|
|
|
|
370
|
- // Text(
|
|
|
|
371
|
- // // "${_parseDateDay(date)}",
|
|
|
|
372
|
- // '${Utils.addZeroNumber(date.day)}',
|
|
|
|
373
|
- // style: TextStyle().copyWith(
|
|
|
|
374
|
- // color: MyColours.color_ffffff,
|
|
|
|
375
|
- // fontSize: ScreenUtil().setSp(32),
|
|
|
|
376
|
- // fontWeight: FontWeight.bold),
|
|
|
|
377
|
- // ),
|
|
|
|
378
|
- // Text(
|
|
|
|
379
|
- // "${_parseDateDay(date)}",
|
|
|
|
380
|
- // // '${Utils.lunarCalendarHolidaysShow(date)}',
|
|
|
|
381
|
- // style: TextStyle().copyWith(
|
|
|
|
382
|
- // fontSize: ScreenUtil().setSp(22),
|
|
|
|
383
|
- // color: MyColours.color_ffffff),
|
|
|
|
384
|
- // )
|
|
|
|
385
|
- // ],
|
|
|
|
386
|
- // ),
|
|
|
|
387
|
- // ),
|
|
|
|
388
|
- // );
|
|
|
|
389
|
- // },
|
|
|
|
390
|
- // todayDayBuilder: (context, date, _) {
|
|
|
|
391
|
- // return Container(
|
|
|
|
392
|
- // // alignment: Alignment.center,
|
|
|
|
393
|
- // // margin: EdgeInsets.fromLTRB(
|
|
|
|
394
|
- // // ScreenUtil().setWidth(12),
|
|
|
|
395
|
- // // ScreenUtil().setWidth(12),
|
|
|
|
396
|
- // // ScreenUtil().setWidth(12),
|
|
|
|
397
|
- // // ScreenUtil().setWidth(32)),
|
|
|
|
398
|
- // padding: EdgeInsets.only(
|
|
|
|
399
|
- // bottom: ScreenUtil().setWidth(10),
|
|
|
|
400
|
- // left: ScreenUtil().setWidth(5),
|
|
|
|
401
|
- // right: ScreenUtil().setWidth(5),
|
|
|
|
402
|
- // top: ScreenUtil().setWidth(10)),
|
|
|
|
403
|
- // child: Container(
|
|
|
|
404
|
- // decoration: BoxDecoration(
|
|
|
|
405
|
- // borderRadius: BorderRadius.circular(
|
|
|
|
406
|
- // ScreenUtil().setWidth(10)),
|
|
|
|
407
|
- // color: MyColours.color_2bb5b7),
|
|
|
|
408
|
- // child: Column(
|
|
|
|
409
|
- // mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
410
|
- // children: [
|
|
|
|
411
|
- // Text(
|
|
|
|
412
|
- // // "${_parseDateDay(date)}",
|
|
|
|
413
|
- // '${Utils.addZeroNumber(date.day)}',
|
|
|
|
414
|
- // style: TextStyle().copyWith(
|
|
|
|
415
|
- // color: MyColours.color_ffffff,
|
|
|
|
416
|
- // fontSize: ScreenUtil().setSp(32),
|
|
|
|
417
|
- // fontWeight: FontWeight.bold),
|
|
|
|
418
|
- // ),
|
|
|
|
419
|
- // Text(
|
|
|
|
420
|
- // "${_parseDateDay(date)}",
|
|
|
|
421
|
- // // '${Utils.lunarCalendarHolidaysShow(date)}',
|
|
|
|
422
|
- // style: TextStyle().copyWith(
|
|
|
|
423
|
- // fontSize: ScreenUtil().setSp(22),
|
|
|
|
424
|
- // color: MyColours.color_ffffff),
|
|
|
|
425
|
- // )
|
|
|
|
426
|
- // ],
|
|
|
|
427
|
- // ),
|
|
|
|
428
|
- // ),
|
|
|
|
429
|
- // );
|
|
|
|
430
|
- // );
|
|
|
|
431
|
- return SizedBox(
|
|
|
|
432
|
- width: double.infinity,
|
|
|
|
433
|
- child: Column(
|
|
|
|
434
|
- mainAxisSize: MainAxisSize.min,
|
|
|
|
435
|
- children: [
|
|
|
|
436
|
- CalendarDatePicker2(
|
|
|
|
437
|
- config: config,
|
|
|
|
438
|
- value: _multiDatePickerValueWithDefaultValue,
|
|
|
|
439
|
- onValueChanged: (dates) =>
|
|
|
|
440
|
- setState(() => _multiDatePickerValueWithDefaultValue = dates),
|
|
|
|
441
|
- ),
|
|
|
|
442
|
- const SizedBox(height: 10),
|
|
|
|
443
|
- Wrap(
|
|
|
|
444
|
- children: [
|
|
|
|
445
|
- const Text('Selection(s): '),
|
|
|
|
446
|
- const SizedBox(width: 10),
|
|
|
|
447
|
- Text(
|
|
|
|
448
|
- _getValueText(
|
|
|
|
449
|
- config.calendarType,
|
|
|
|
450
|
- _multiDatePickerValueWithDefaultValue,
|
|
|
|
451
|
- ),
|
|
|
|
452
|
- overflow: TextOverflow.ellipsis,
|
|
|
|
453
|
- maxLines: 10,
|
|
|
|
454
|
- softWrap: false,
|
|
|
|
455
|
- ),
|
|
|
|
456
|
- ],
|
|
|
|
457
|
- ),
|
|
|
|
458
|
- const SizedBox(height: 25),
|
|
|
|
459
|
- ],
|
|
|
|
460
|
- ),
|
|
|
|
461
|
- );
|
|
|
|
462
|
- }
|
|
|
|
463
|
-
|
|
|
|
464
|
///时间选择
|
145
|
///时间选择
|
|
465
|
Widget _select1(String title, GestureTapCallback onTap) {
|
146
|
Widget _select1(String title, GestureTapCallback onTap) {
|
|
466
|
return InkWell(
|
147
|
return InkWell(
|
|
467
|
onTap: onTap,
|
148
|
onTap: onTap,
|
|
468
|
child: Container(
|
149
|
child: Container(
|
|
469
|
- padding: EdgeInsets.only(left: w(16)),
|
150
|
+ padding: EdgeInsets.only(left: w(16), top: w(7), bottom: w(12)),
|
|
470
|
child: Row(
|
151
|
child: Row(
|
|
471
|
crossAxisAlignment: CrossAxisAlignment.center,
|
152
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
472
|
mainAxisAlignment: MainAxisAlignment.center,
|
153
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
473
|
children: [
|
154
|
children: [
|
|
474
|
- Container(
|
155
|
+ Expanded(
|
|
|
|
156
|
+ child: Container(
|
|
475
|
// height: ScreenUtil().setWidth(40),
|
157
|
// height: ScreenUtil().setWidth(40),
|
|
476
|
// color: Colors.red,
|
158
|
// color: Colors.red,
|
|
477
|
child: Text(
|
159
|
child: Text(
|
|
478
|
title,
|
160
|
title,
|
|
|
|
161
|
+ maxLines: 10,
|
|
479
|
style: TextStyle(
|
162
|
style: TextStyle(
|
|
480
|
height: 1.5,
|
163
|
height: 1.5,
|
|
481
|
color: title == '点击选择日期(可多选)'
|
164
|
color: title == '点击选择日期(可多选)'
|
|
@@ -483,9 +166,9 @@ class _BookTimeSettingEditPageState extends State<BookTimeSettingEditPage> { |
|
@@ -483,9 +166,9 @@ class _BookTimeSettingEditPageState extends State<BookTimeSettingEditPage> { |
|
483
|
: MyColours.color_515151,
|
166
|
: MyColours.color_515151,
|
|
484
|
fontSize: font(16)),
|
167
|
fontSize: font(16)),
|
|
485
|
),
|
168
|
),
|
|
486
|
- ),
|
169
|
+ )),
|
|
487
|
// HEmptyView(20),
|
170
|
// HEmptyView(20),
|
|
488
|
- Spacer(),
|
171
|
+ // Spacer(),
|
|
489
|
// Text(hintText,
|
172
|
// Text(hintText,
|
|
490
|
// style: TextStyle(
|
173
|
// style: TextStyle(
|
|
491
|
// color: hintText == '点击设置开始日期' || hintText == '点击设置结束日期'
|
174
|
// color: hintText == '点击设置开始日期' || hintText == '点击设置结束日期'
|
|
@@ -505,6 +188,386 @@ class _BookTimeSettingEditPageState extends State<BookTimeSettingEditPage> { |
|
@@ -505,6 +188,386 @@ class _BookTimeSettingEditPageState extends State<BookTimeSettingEditPage> { |
|
505
|
);
|
188
|
);
|
|
506
|
}
|
189
|
}
|
|
507
|
|
190
|
|
|
|
|
191
|
+ Widget _itemMorningNoonAngNight(int tag, TextEditingController booktimes) {
|
|
|
|
192
|
+ return Row(
|
|
|
|
193
|
+ mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
194
|
+ children: [
|
|
|
|
195
|
+ swichState[tag]
|
|
|
|
196
|
+ ? Expanded(
|
|
|
|
197
|
+ child: Container(
|
|
|
|
198
|
+ // height: ScreenUtil().setWidth(50),
|
|
|
|
199
|
+ // padding: EdgeInsets.symmetric(horizontal: ScreenUtil().setWidth(24)),
|
|
|
|
200
|
+ decoration: BoxDecoration(
|
|
|
|
201
|
+ color: MyColours.color_ffffff,
|
|
|
|
202
|
+ borderRadius: BorderRadius.circular(r(14))),
|
|
|
|
203
|
+ child: TextField(
|
|
|
|
204
|
+ controller: booktimes,
|
|
|
|
205
|
+ maxLines: 1,
|
|
|
|
206
|
+ // inputFormatters: [
|
|
|
|
207
|
+ // LengthLimitingTextInputFormatter(
|
|
|
|
208
|
+ // 15),
|
|
|
|
209
|
+ // // FilteringTextInputFormatter.digitsOnly
|
|
|
|
210
|
+ // ],
|
|
|
|
211
|
+
|
|
|
|
212
|
+ // //光标颜色
|
|
|
|
213
|
+ // cursorColor:
|
|
|
|
214
|
+ // widget.isSelect ? Colors.white : MyColours.color_199095,
|
|
|
|
215
|
+ //输入文本的样式
|
|
|
|
216
|
+ style: TextStyle(
|
|
|
|
217
|
+ fontSize: font(14), color: MyColours.color_515151),
|
|
|
|
218
|
+ // focusNode: _phoneFocusNode,
|
|
|
|
219
|
+ decoration: InputDecoration(
|
|
|
|
220
|
+ border: OutlineInputBorder(borderSide: BorderSide.none),
|
|
|
|
221
|
+ hintText: '请输入餐段名称',
|
|
|
|
222
|
+ hintStyle: TextStyle(
|
|
|
|
223
|
+ color: MyColours.color_BFC4D4,
|
|
|
|
224
|
+ fontSize: font(14),
|
|
|
|
225
|
+ ),
|
|
|
|
226
|
+ contentPadding: EdgeInsets.zero,
|
|
|
|
227
|
+ isCollapsed: true, //重点,相当于高度包裹的意思,必须设置为true,不然有默认奇妙的最小高度
|
|
|
|
228
|
+ enabledBorder: new UnderlineInputBorder(
|
|
|
|
229
|
+ borderSide: BorderSide.none,
|
|
|
|
230
|
+ ),
|
|
|
|
231
|
+
|
|
|
|
232
|
+ focusedBorder: new UnderlineInputBorder(
|
|
|
|
233
|
+ borderSide: BorderSide.none,
|
|
|
|
234
|
+ ),
|
|
|
|
235
|
+ ),
|
|
|
|
236
|
+ onChanged: (value) {
|
|
|
|
237
|
+ // if (editingController == _nameController) {
|
|
|
|
238
|
+ // _nameController.text = value;
|
|
|
|
239
|
+ // }
|
|
|
|
240
|
+ },
|
|
|
|
241
|
+ onEditingComplete: () {
|
|
|
|
242
|
+ FocusScope.of(context)
|
|
|
|
243
|
+ .requestFocus(FocusNode()); //点击空白处隐藏键盘
|
|
|
|
244
|
+ },
|
|
|
|
245
|
+ keyboardType: TextInputType.text,
|
|
|
|
246
|
+ ),
|
|
|
|
247
|
+ ))
|
|
|
|
248
|
+ : Spacer(),
|
|
|
|
249
|
+ // Text(title,
|
|
|
|
250
|
+ // style: TextStyle(
|
|
|
|
251
|
+ // fontSize: ScreenUtil().setSp(28),
|
|
|
|
252
|
+ // color: MyColours.color_999999)),
|
|
|
|
253
|
+ InkWell(
|
|
|
|
254
|
+ onTap: () {
|
|
|
|
255
|
+ setState(() {
|
|
|
|
256
|
+ swichState[tag] = !swichState[tag];
|
|
|
|
257
|
+ });
|
|
|
|
258
|
+ },
|
|
|
|
259
|
+ child: Image.asset(
|
|
|
|
260
|
+ Utils.getImgPath(
|
|
|
|
261
|
+ swichState[tag] ? 'store_swich_on' : 'store_swich_off'),
|
|
|
|
262
|
+ width: w(38))),
|
|
|
|
263
|
+ ],
|
|
|
|
264
|
+ );
|
|
|
|
265
|
+ }
|
|
|
|
266
|
+
|
|
|
|
267
|
+ ///从时间选择器中获取分钟数字符串 00 or 30
|
|
|
|
268
|
+ String _getMinuteStrFromPickerBookTime(List data, List value) {
|
|
|
|
269
|
+ // if (data.length == 1) {
|
|
|
|
270
|
+ // return '30';
|
|
|
|
271
|
+ // } else {
|
|
|
|
272
|
+ Map map = data[value[0]];
|
|
|
|
273
|
+
|
|
|
|
274
|
+ int minute = map.values.last[value[1]];
|
|
|
|
275
|
+ if (minute == 0) {
|
|
|
|
276
|
+ return '00';
|
|
|
|
277
|
+ }
|
|
|
|
278
|
+ return '${minute}';
|
|
|
|
279
|
+ // if (value[1] == 0) {
|
|
|
|
280
|
+ // return '00';
|
|
|
|
281
|
+ // } else if (value[1] == 1) {
|
|
|
|
282
|
+ // return '15';
|
|
|
|
283
|
+ // } else if (value[1] == 2) {
|
|
|
|
284
|
+ // return '30';
|
|
|
|
285
|
+ // } else {
|
|
|
|
286
|
+ // return '45';
|
|
|
|
287
|
+ // }
|
|
|
|
288
|
+ // }
|
|
|
|
289
|
+ }
|
|
|
|
290
|
+
|
|
|
|
291
|
+ Widget _itemBookTime(String start, String end, int tag) {
|
|
|
|
292
|
+ return Row(
|
|
|
|
293
|
+ children: [
|
|
|
|
294
|
+ Expanded(
|
|
|
|
295
|
+ child: InkWell(
|
|
|
|
296
|
+ onTap: () {
|
|
|
|
297
|
+ if (swichState[tag]) {
|
|
|
|
298
|
+ List data = SetTimeWidget.dateData;
|
|
|
|
299
|
+ if (tag == 0) {
|
|
|
|
300
|
+ //早市
|
|
|
|
301
|
+ data = SetTimeWidget.dateData;
|
|
|
|
302
|
+ } else if (tag == 1) {
|
|
|
|
303
|
+ //午市
|
|
|
|
304
|
+ data = Utils.getPickerData(
|
|
|
|
305
|
+ morning.end, SetTimeWidget.dateData);
|
|
|
|
306
|
+ } else if (tag == 2) {
|
|
|
|
307
|
+ //晚市
|
|
|
|
308
|
+ data =
|
|
|
|
309
|
+ Utils.getPickerData(noon.end, SetTimeWidget.dateData);
|
|
|
|
310
|
+ }
|
|
|
|
311
|
+
|
|
|
|
312
|
+ SetTimeWidget().showTimeSelector(context, data, start,
|
|
|
|
313
|
+ (value) {
|
|
|
|
314
|
+ if (value != null) {
|
|
|
|
315
|
+ String tempMinute =
|
|
|
|
316
|
+ _getMinuteStrFromPickerBookTime(data, value);
|
|
|
|
317
|
+ print(data[value[0]].keys.first);
|
|
|
|
318
|
+ String time = Utils.getTimeString(
|
|
|
|
319
|
+ Utils.getHourFromTitle(data[value[0]].keys.first),
|
|
|
|
320
|
+ tempMinute);
|
|
|
|
321
|
+ setState(() {
|
|
|
|
322
|
+ if (tag == 0) {
|
|
|
|
323
|
+ //早市
|
|
|
|
324
|
+ morning.start = time;
|
|
|
|
325
|
+ setState(() {
|
|
|
|
326
|
+ Utils.compareDateTime(morning.end, time,
|
|
|
|
327
|
+ (needChange) {
|
|
|
|
328
|
+ if (needChange) {
|
|
|
|
329
|
+ morning.end = time;
|
|
|
|
330
|
+ }
|
|
|
|
331
|
+ });
|
|
|
|
332
|
+ Utils.compareDateTime(noon.start, time,
|
|
|
|
333
|
+ (needChange) {
|
|
|
|
334
|
+ if (needChange) {
|
|
|
|
335
|
+ noon.start = time;
|
|
|
|
336
|
+ }
|
|
|
|
337
|
+ });
|
|
|
|
338
|
+ Utils.compareDateTime(noon.end, time,
|
|
|
|
339
|
+ (needChange) {
|
|
|
|
340
|
+ if (needChange) {
|
|
|
|
341
|
+ noon.end = time;
|
|
|
|
342
|
+ }
|
|
|
|
343
|
+ });
|
|
|
|
344
|
+ Utils.compareDateTime(night.start, time,
|
|
|
|
345
|
+ (needChange) {
|
|
|
|
346
|
+ if (needChange) {
|
|
|
|
347
|
+ night.start = time;
|
|
|
|
348
|
+ }
|
|
|
|
349
|
+ });
|
|
|
|
350
|
+ Utils.compareDateTime(night.end, time,
|
|
|
|
351
|
+ (needChange) {
|
|
|
|
352
|
+ if (needChange) {
|
|
|
|
353
|
+ night.end = time;
|
|
|
|
354
|
+ }
|
|
|
|
355
|
+ });
|
|
|
|
356
|
+ });
|
|
|
|
357
|
+ } else if (tag == 1) {
|
|
|
|
358
|
+ //午市
|
|
|
|
359
|
+ noon.start = time;
|
|
|
|
360
|
+ setState(() {
|
|
|
|
361
|
+ Utils.compareDateTime(noon.end, time,
|
|
|
|
362
|
+ (needChange) {
|
|
|
|
363
|
+ if (needChange) {
|
|
|
|
364
|
+ noon.end = time;
|
|
|
|
365
|
+ }
|
|
|
|
366
|
+ });
|
|
|
|
367
|
+ Utils.compareDateTime(night.start, time,
|
|
|
|
368
|
+ (needChange) {
|
|
|
|
369
|
+ if (needChange) {
|
|
|
|
370
|
+ night.start = time;
|
|
|
|
371
|
+ }
|
|
|
|
372
|
+ });
|
|
|
|
373
|
+ Utils.compareDateTime(night.end, time,
|
|
|
|
374
|
+ (needChange) {
|
|
|
|
375
|
+ if (needChange) {
|
|
|
|
376
|
+ night.end = time;
|
|
|
|
377
|
+ }
|
|
|
|
378
|
+ });
|
|
|
|
379
|
+ });
|
|
|
|
380
|
+ } else if (tag == 2) {
|
|
|
|
381
|
+ //晚市
|
|
|
|
382
|
+ night.start = time;
|
|
|
|
383
|
+ setState(() {
|
|
|
|
384
|
+ Utils.compareDateTime(night.end, time,
|
|
|
|
385
|
+ (needChange) {
|
|
|
|
386
|
+ if (needChange) {
|
|
|
|
387
|
+ night.end = time;
|
|
|
|
388
|
+ }
|
|
|
|
389
|
+ });
|
|
|
|
390
|
+ });
|
|
|
|
391
|
+ }
|
|
|
|
392
|
+ });
|
|
|
|
393
|
+ print(value);
|
|
|
|
394
|
+ }
|
|
|
|
395
|
+ });
|
|
|
|
396
|
+ }
|
|
|
|
397
|
+ },
|
|
|
|
398
|
+ child: Container(
|
|
|
|
399
|
+ height: w(34),
|
|
|
|
400
|
+ alignment: Alignment.center,
|
|
|
|
401
|
+ decoration: BoxDecoration(
|
|
|
|
402
|
+ borderRadius: BorderRadius.circular(r(5)),
|
|
|
|
403
|
+ border: Border.all(
|
|
|
|
404
|
+ width: w(1), color: MyColours.color_438E93)),
|
|
|
|
405
|
+ child: start == '' || start == null || start == 'null'
|
|
|
|
406
|
+ ? RichText(
|
|
|
|
407
|
+ text: TextSpan(
|
|
|
|
408
|
+ style: TextStyle(
|
|
|
|
409
|
+ fontSize: font(12),
|
|
|
|
410
|
+ ),
|
|
|
|
411
|
+ children: [
|
|
|
|
412
|
+ // const TextSpan(text: '('),
|
|
|
|
413
|
+ TextSpan(
|
|
|
|
414
|
+ text: '选择开始时间',
|
|
|
|
415
|
+ style: TextStyle(
|
|
|
|
416
|
+ color: MyColours.color_438E93)),
|
|
|
|
417
|
+ TextSpan(
|
|
|
|
418
|
+ text: '*',
|
|
|
|
419
|
+ style: TextStyle(
|
|
|
|
420
|
+ color: MyColours.color_E34D59)),
|
|
|
|
421
|
+ ]))
|
|
|
|
422
|
+ : Text(
|
|
|
|
423
|
+ start,
|
|
|
|
424
|
+ style: TextStyle(
|
|
|
|
425
|
+ color: MyColours.color_438E93,
|
|
|
|
426
|
+ fontSize: font(12),
|
|
|
|
427
|
+ ),
|
|
|
|
428
|
+ )))),
|
|
|
|
429
|
+ HEmptyView(52),
|
|
|
|
430
|
+ Text('至',
|
|
|
|
431
|
+ style:
|
|
|
|
432
|
+ TextStyle(fontSize: font(12), color: MyColours.color_515151)),
|
|
|
|
433
|
+ HEmptyView(52),
|
|
|
|
434
|
+ Expanded(
|
|
|
|
435
|
+ child: InkWell(
|
|
|
|
436
|
+ onTap: () {
|
|
|
|
437
|
+ if (swichState[tag]) {
|
|
|
|
438
|
+ List data = SetTimeWidget.dateData;
|
|
|
|
439
|
+ if (tag == 0) {
|
|
|
|
440
|
+ //早市
|
|
|
|
441
|
+ data = Utils.getPickerData(
|
|
|
|
442
|
+ morning.start, SetTimeWidget.dateData);
|
|
|
|
443
|
+ } else if (tag == 1) {
|
|
|
|
444
|
+ //午市
|
|
|
|
445
|
+ data =
|
|
|
|
446
|
+ Utils.getPickerData(noon.start, SetTimeWidget.dateData);
|
|
|
|
447
|
+ } else if (tag == 2) {
|
|
|
|
448
|
+ //晚市
|
|
|
|
449
|
+ data = Utils.getPickerData(
|
|
|
|
450
|
+ night.start, SetTimeWidget.dateData);
|
|
|
|
451
|
+ }
|
|
|
|
452
|
+ SetTimeWidget().showTimeSelector(context, data, end, (value) {
|
|
|
|
453
|
+ if (value != null) {
|
|
|
|
454
|
+ String tempMinute =
|
|
|
|
455
|
+ _getMinuteStrFromPickerBookTime(data, value);
|
|
|
|
456
|
+ String time = Utils.getTimeString(
|
|
|
|
457
|
+ Utils.getHourFromTitle(data[value[0]].keys.first),
|
|
|
|
458
|
+ tempMinute);
|
|
|
|
459
|
+ setState(() {
|
|
|
|
460
|
+ if (tag == 0) {
|
|
|
|
461
|
+ //早市
|
|
|
|
462
|
+ morning.end = time;
|
|
|
|
463
|
+
|
|
|
|
464
|
+ setState(() {
|
|
|
|
465
|
+ Utils.compareDateTime(time, morning.start,
|
|
|
|
466
|
+ (needChange) {
|
|
|
|
467
|
+ if (needChange) {
|
|
|
|
468
|
+ morning.start = time;
|
|
|
|
469
|
+ }
|
|
|
|
470
|
+ });
|
|
|
|
471
|
+ Utils.compareDateTime(noon.start, time,
|
|
|
|
472
|
+ (needChange) {
|
|
|
|
473
|
+ if (needChange) {
|
|
|
|
474
|
+ noon.start = time;
|
|
|
|
475
|
+ }
|
|
|
|
476
|
+ });
|
|
|
|
477
|
+
|
|
|
|
478
|
+ Utils.compareDateTime(noon.end, time, (needChange) {
|
|
|
|
479
|
+ if (needChange) {
|
|
|
|
480
|
+ noon.end = time;
|
|
|
|
481
|
+ }
|
|
|
|
482
|
+ });
|
|
|
|
483
|
+ Utils.compareDateTime(night.start, time,
|
|
|
|
484
|
+ (needChange) {
|
|
|
|
485
|
+ if (needChange) {
|
|
|
|
486
|
+ night.start = time;
|
|
|
|
487
|
+ }
|
|
|
|
488
|
+ });
|
|
|
|
489
|
+
|
|
|
|
490
|
+ Utils.compareDateTime(night.end, time,
|
|
|
|
491
|
+ (needChange) {
|
|
|
|
492
|
+ if (needChange) {
|
|
|
|
493
|
+ night.end = time;
|
|
|
|
494
|
+ }
|
|
|
|
495
|
+ });
|
|
|
|
496
|
+ });
|
|
|
|
497
|
+ } else if (tag == 1) {
|
|
|
|
498
|
+ //午市
|
|
|
|
499
|
+ noon.end = time;
|
|
|
|
500
|
+ setState(() {
|
|
|
|
501
|
+ Utils.compareDateTime(noon.end, noon.start,
|
|
|
|
502
|
+ (needChange) {
|
|
|
|
503
|
+ if (needChange) {
|
|
|
|
504
|
+ noon.start = noon.end;
|
|
|
|
505
|
+ }
|
|
|
|
506
|
+ });
|
|
|
|
507
|
+ Utils.compareDateTime(night.start, time,
|
|
|
|
508
|
+ (needChange) {
|
|
|
|
509
|
+ if (needChange) {
|
|
|
|
510
|
+ night.start = time;
|
|
|
|
511
|
+ }
|
|
|
|
512
|
+ });
|
|
|
|
513
|
+ Utils.compareDateTime(night.end, time,
|
|
|
|
514
|
+ (needChange) {
|
|
|
|
515
|
+ if (needChange) {
|
|
|
|
516
|
+ night.end = time;
|
|
|
|
517
|
+ }
|
|
|
|
518
|
+ });
|
|
|
|
519
|
+ });
|
|
|
|
520
|
+ } else if (tag == 2) {
|
|
|
|
521
|
+ //晚市
|
|
|
|
522
|
+ night.end = time;
|
|
|
|
523
|
+ setState(() {
|
|
|
|
524
|
+ Utils.compareDateTime(night.end, night.start,
|
|
|
|
525
|
+ (needChange) {
|
|
|
|
526
|
+ if (needChange) {
|
|
|
|
527
|
+ night.start = night.end;
|
|
|
|
528
|
+ }
|
|
|
|
529
|
+ });
|
|
|
|
530
|
+ });
|
|
|
|
531
|
+ }
|
|
|
|
532
|
+ });
|
|
|
|
533
|
+ print(value);
|
|
|
|
534
|
+ }
|
|
|
|
535
|
+ });
|
|
|
|
536
|
+ }
|
|
|
|
537
|
+ },
|
|
|
|
538
|
+ child: Container(
|
|
|
|
539
|
+ height: w(34),
|
|
|
|
540
|
+ alignment: Alignment.center,
|
|
|
|
541
|
+ decoration: BoxDecoration(
|
|
|
|
542
|
+ borderRadius: BorderRadius.circular(r(5)),
|
|
|
|
543
|
+ border: Border.all(
|
|
|
|
544
|
+ width: w(1), color: MyColours.color_438E93)),
|
|
|
|
545
|
+ child: end == '' || end == null || end == 'null'
|
|
|
|
546
|
+ ? RichText(
|
|
|
|
547
|
+ text: TextSpan(
|
|
|
|
548
|
+ style: TextStyle(fontSize: font(12)),
|
|
|
|
549
|
+ children: [
|
|
|
|
550
|
+ // const TextSpan(text: '('),
|
|
|
|
551
|
+ TextSpan(
|
|
|
|
552
|
+ text: '选择结束时间',
|
|
|
|
553
|
+ style:
|
|
|
|
554
|
+ TextStyle(color: MyColours.color_438E93)),
|
|
|
|
555
|
+ TextSpan(
|
|
|
|
556
|
+ text: '*',
|
|
|
|
557
|
+ style:
|
|
|
|
558
|
+ TextStyle(color: MyColours.color_E34D59)),
|
|
|
|
559
|
+ ]))
|
|
|
|
560
|
+ : Text(
|
|
|
|
561
|
+ end,
|
|
|
|
562
|
+ style: TextStyle(
|
|
|
|
563
|
+ color: MyColours.color_438E93,
|
|
|
|
564
|
+ fontSize: font(12)),
|
|
|
|
565
|
+ ))),
|
|
|
|
566
|
+ ),
|
|
|
|
567
|
+ ],
|
|
|
|
568
|
+ );
|
|
|
|
569
|
+ }
|
|
|
|
570
|
+
|
|
508
|
@override
|
571
|
@override
|
|
509
|
Widget build(BuildContext context) {
|
572
|
Widget build(BuildContext context) {
|
|
510
|
return Scaffold(
|
573
|
return Scaffold(
|
|
@@ -559,15 +622,9 @@ class _BookTimeSettingEditPageState extends State<BookTimeSettingEditPage> { |
|
@@ -559,15 +622,9 @@ class _BookTimeSettingEditPageState extends State<BookTimeSettingEditPage> { |
|
559
|
HEmptyView(30),
|
622
|
HEmptyView(30),
|
|
560
|
],
|
623
|
],
|
|
561
|
),
|
624
|
),
|
|
562
|
- VEmptyView(30),
|
625
|
+ VEmptyView(16),
|
|
563
|
_select1(weekShow, () async {
|
626
|
_select1(weekShow, () async {
|
|
564
|
if (isWeek) {
|
627
|
if (isWeek) {
|
|
565
|
- FocusScope.of(context)
|
|
|
|
566
|
- .requestFocus(FocusNode()); //点击空白处隐藏键盘
|
|
|
|
567
|
- //弹出时间选择器
|
|
|
|
568
|
- // showPickerDateTime(context);
|
|
|
|
569
|
- // showDateSelWidget = false;
|
|
|
|
570
|
-
|
|
|
|
571
|
List<FilterBtnModel> data =
|
628
|
List<FilterBtnModel> data =
|
|
572
|
await DialogUtil.openWeekSelectModalBottomSheet(
|
629
|
await DialogUtil.openWeekSelectModalBottomSheet(
|
|
573
|
context, weekData);
|
630
|
context, weekData);
|
|
@@ -593,29 +650,19 @@ class _BookTimeSettingEditPageState extends State<BookTimeSettingEditPage> { |
|
@@ -593,29 +650,19 @@ class _BookTimeSettingEditPageState extends State<BookTimeSettingEditPage> { |
|
593
|
setState(() {});
|
650
|
setState(() {});
|
|
594
|
}
|
651
|
}
|
|
595
|
} else {
|
652
|
} else {
|
|
596
|
- showCalendarDialogMultiple(context);
|
|
|
|
597
|
- // _buildMultiDatePickerWithValue();
|
|
|
|
598
|
- // DateTime dateTime = DateTime.now();
|
|
|
|
599
|
- // DialogUtil.showCalendarDialogMultiple(context, dateTime)
|
|
|
|
600
|
- // .then((day) async {
|
|
|
|
601
|
- // if (day != null) {
|
|
|
|
602
|
- // // createDateText1(context, day);
|
|
|
|
603
|
- // // bool success =
|
|
|
|
604
|
- // // await tableManagerModel.getTableListOrReserve(
|
|
|
|
605
|
- // // context,
|
|
|
|
606
|
- // // currTimeIndex,
|
|
|
|
607
|
- // // dateTime,
|
|
|
|
608
|
- // // selectNumber,
|
|
|
|
609
|
- // // showLoading: true,
|
|
|
|
610
|
- // // );
|
|
|
|
611
|
- // }
|
|
|
|
612
|
- // });
|
653
|
+ DialogUtil.showCalendarDialogMultiple(
|
|
|
|
654
|
+ context, _selectPickerValues, (value) {
|
|
|
|
655
|
+ _selectPickerValues = value;
|
|
|
|
656
|
+ weekShow = _getValueText(
|
|
|
|
657
|
+ value,
|
|
|
|
658
|
+ );
|
|
|
|
659
|
+ setState(() {});
|
|
|
|
660
|
+ });
|
|
613
|
}
|
661
|
}
|
|
614
|
}),
|
662
|
}),
|
|
615
|
],
|
663
|
],
|
|
616
|
),
|
664
|
),
|
|
617
|
),
|
665
|
),
|
|
618
|
- VEmptyView(24),
|
|
|
|
619
|
Padding(
|
666
|
Padding(
|
|
620
|
padding: EdgeInsets.only(left: w(16)),
|
667
|
padding: EdgeInsets.only(left: w(16)),
|
|
621
|
child: MyDivider(
|
668
|
child: MyDivider(
|
|
@@ -623,7 +670,53 @@ class _BookTimeSettingEditPageState extends State<BookTimeSettingEditPage> { |
|
@@ -623,7 +670,53 @@ class _BookTimeSettingEditPageState extends State<BookTimeSettingEditPage> { |
|
623
|
w(1),
|
670
|
w(1),
|
|
624
|
color: MyColours.color_DBDBDB,
|
671
|
color: MyColours.color_DBDBDB,
|
|
625
|
),
|
672
|
),
|
|
626
|
- )
|
673
|
+ ),
|
|
|
|
674
|
+ VEmptyView(26),
|
|
|
|
675
|
+ Padding(
|
|
|
|
676
|
+ padding: EdgeInsets.only(left: w(12)),
|
|
|
|
677
|
+ child: Text('可预订时段',
|
|
|
|
678
|
+ style: TextStyle(
|
|
|
|
679
|
+ fontSize: font(16),
|
|
|
|
680
|
+ color: MyColours.color_515151))),
|
|
|
|
681
|
+ VEmptyView(36),
|
|
|
|
682
|
+ Padding(
|
|
|
|
683
|
+ padding: EdgeInsets.symmetric(
|
|
|
|
684
|
+ horizontal: w(24),
|
|
|
|
685
|
+ ),
|
|
|
|
686
|
+ child: Column(
|
|
|
|
687
|
+ children: [
|
|
|
|
688
|
+ _itemMorningNoonAngNight(0, _booktime1),
|
|
|
|
689
|
+ VEmptyView(34),
|
|
|
|
690
|
+ swichState[0]
|
|
|
|
691
|
+ ? _itemBookTime(morning.start, morning.end, 0)
|
|
|
|
692
|
+ : SizedBox(),
|
|
|
|
693
|
+ VEmptyView(32),
|
|
|
|
694
|
+ _itemMorningNoonAngNight(1, _booktime2),
|
|
|
|
695
|
+ VEmptyView(34),
|
|
|
|
696
|
+ swichState[1]
|
|
|
|
697
|
+ ? _itemBookTime(noon.start, noon.end, 1)
|
|
|
|
698
|
+ : SizedBox(),
|
|
|
|
699
|
+ VEmptyView(32),
|
|
|
|
700
|
+ _itemMorningNoonAngNight(2, _booktime3),
|
|
|
|
701
|
+ VEmptyView(34),
|
|
|
|
702
|
+ swichState[2]
|
|
|
|
703
|
+ ? _itemBookTime(night.start, night.end, 2)
|
|
|
|
704
|
+ : SizedBox(),
|
|
|
|
705
|
+ VEmptyView(32),
|
|
|
|
706
|
+ _itemMorningNoonAngNight(3, _booktime4),
|
|
|
|
707
|
+ VEmptyView(34),
|
|
|
|
708
|
+ swichState[3]
|
|
|
|
709
|
+ ? _itemBookTime(night.start, night.end, 3)
|
|
|
|
710
|
+ : SizedBox(),
|
|
|
|
711
|
+ VEmptyView(32),
|
|
|
|
712
|
+ _itemMorningNoonAngNight(4, _booktime5),
|
|
|
|
713
|
+ VEmptyView(34),
|
|
|
|
714
|
+ swichState[4]
|
|
|
|
715
|
+ ? _itemBookTime(night.start, night.end, 4)
|
|
|
|
716
|
+ : SizedBox(),
|
|
|
|
717
|
+ ],
|
|
|
|
718
|
+ )),
|
|
|
|
719
|
+ VEmptyView(34),
|
|
627
|
],
|
720
|
],
|
|
628
|
),
|
721
|
),
|
|
629
|
)),
|
722
|
)),
|