|
|
|
import 'package:common_utils/common_utils.dart';
|
|
|
|
import 'package:flutter/cupertino.dart';
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:flutter_screenutil/screenutil.dart';
|
|
|
|
import 'package:one_key/models/seller_info.dart';
|
|
|
|
import 'package:one_key/models/set_seller_info_model.dart';
|
|
|
|
import 'package:one_key/models/settime.dart';
|
|
|
|
import 'package:one_key/provider/book_set_time_model.dart';
|
|
|
|
import 'package:one_key/res/colors.dart';
|
|
|
|
import 'package:one_key/utils/dialog_util.dart';
|
|
|
|
import 'package:one_key/utils/utils.dart';
|
|
|
|
import 'package:one_key/widgets/MyDivider.dart';
|
|
|
|
import 'package:one_key/widgets/app_bar.dart';
|
|
|
|
import 'package:one_key/widgets/common_button.dart';
|
|
|
|
import 'package:one_key/widgets/h_empty_view.dart';
|
|
|
|
import 'package:one_key/widgets/system_app_bar.dart';
|
|
|
|
import 'package:one_key/widgets/v_empty_view.dart';
|
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
|
|
|
|
typedef BookTimeSetCallback = void Function(bool needChange);
|
|
|
|
|
|
...
|
...
|
@@ -26,6 +32,7 @@ class _BookTimeSetPageState extends State<BookTimeSetPage> { |
|
|
|
SetTime morning = SetTime();
|
|
|
|
SetTime noon = SetTime();
|
|
|
|
SetTime night = SetTime();
|
|
|
|
BookSetTimeModel bookSetTimeModel;
|
|
|
|
|
|
|
|
@override
|
|
|
|
void initState() {
|
|
...
|
...
|
@@ -36,18 +43,7 @@ class _BookTimeSetPageState extends State<BookTimeSetPage> { |
|
|
|
noon.end = '14:30';
|
|
|
|
night.start = '16:00';
|
|
|
|
night.end = '21:00';
|
|
|
|
swichState = [
|
|
|
|
{
|
|
|
|
'on': false,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
'on': true,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
'on': true,
|
|
|
|
}
|
|
|
|
];
|
|
|
|
|
|
|
|
swichState = [false, true, true];
|
|
|
|
dateData = [
|
|
|
|
{
|
|
|
|
'深夜00时': [00, 30]
|
|
...
|
...
|
@@ -122,6 +118,139 @@ class _BookTimeSetPageState extends State<BookTimeSetPage> { |
|
|
|
'晚上23时': [00, 30]
|
|
|
|
}
|
|
|
|
];
|
|
|
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
|
|
|
_getDailyTime();
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
_getDailyTime() async {
|
|
|
|
SunSellerInfoModel model = await bookSetTimeModel.getManagersInfo(context);
|
|
|
|
setState(() {
|
|
|
|
if (model.daily.morning.isNotEmpty) {
|
|
|
|
List temp = model.daily.morning.split('-');
|
|
|
|
morning.start = temp.length > 0 ? temp[0] : '07:00';
|
|
|
|
morning.end = temp.length > 1 ? temp[1] : '10:00';
|
|
|
|
swichState[0] = true;
|
|
|
|
} else {
|
|
|
|
swichState[0] = false;
|
|
|
|
}
|
|
|
|
if (model.daily.noon.isNotEmpty) {
|
|
|
|
List temp = model.daily.noon.split('-');
|
|
|
|
noon.start = temp.length > 0 ? temp[0] : '11:00';
|
|
|
|
noon.end = temp.length > 1 ? temp[1] : '14:30';
|
|
|
|
swichState[1] = true;
|
|
|
|
} else {
|
|
|
|
swichState[1] = false;
|
|
|
|
noon.start = '11:00';
|
|
|
|
noon.end = '14:30';
|
|
|
|
}
|
|
|
|
if (model.daily.night.isNotEmpty) {
|
|
|
|
List temp = model.daily.night.split('-');
|
|
|
|
night.start = temp.length > 0 ? temp[0] : '16:00';
|
|
|
|
night.end = temp.length > 1 ? temp[1] : '21:00';
|
|
|
|
swichState[2] = true;
|
|
|
|
} else {
|
|
|
|
swichState[2] = false;
|
|
|
|
night.start = '16:00';
|
|
|
|
night.end = '21:00';
|
|
|
|
}
|
|
|
|
if (swichState[0] == false) {
|
|
|
|
if (model.daily.noon.isNotEmpty) {
|
|
|
|
_compareDateTime(noon.start, morning.end, (needChange) {
|
|
|
|
if (needChange) {
|
|
|
|
morning.end = noon.start;
|
|
|
|
} else {
|
|
|
|
morning.end = '10:00';
|
|
|
|
}
|
|
|
|
});
|
|
|
|
_compareDateTime(noon.start, morning.start, (needChange) {
|
|
|
|
if (needChange) {
|
|
|
|
morning.start = noon.start;
|
|
|
|
} else {
|
|
|
|
morning.start = '07:00';
|
|
|
|
}
|
|
|
|
});
|
|
|
|
} else if (model.daily.night.isNotEmpty) {
|
|
|
|
_compareDateTime(night.start, morning.end, (needChange) {
|
|
|
|
if (needChange) {
|
|
|
|
morning.end = night.start;
|
|
|
|
} else {
|
|
|
|
morning.end = '10:00';
|
|
|
|
}
|
|
|
|
});
|
|
|
|
_compareDateTime(night.start, morning.start, (needChange) {
|
|
|
|
if (needChange) {
|
|
|
|
morning.start = night.start;
|
|
|
|
} else {
|
|
|
|
morning.start = '07:00';
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (swichState[1] == false) {
|
|
|
|
if (model.daily.morning.isNotEmpty) {
|
|
|
|
_compareDateTime(noon.start, morning.end, (needChange) {
|
|
|
|
if (needChange) {
|
|
|
|
noon.start = morning.end;
|
|
|
|
} else {
|
|
|
|
noon.start = '11:00';
|
|
|
|
}
|
|
|
|
});
|
|
|
|
_compareDateTime(noon.end, morning.end, (needChange) {
|
|
|
|
if (needChange) {
|
|
|
|
noon.end = morning.end;
|
|
|
|
} else {
|
|
|
|
_compareDateTime(noon.end, night.start, (needChange) {
|
|
|
|
if (needChange) {
|
|
|
|
noon.end = '14:30';
|
|
|
|
} else {
|
|
|
|
noon.end = night.start;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
if (model.daily.night.isNotEmpty) {
|
|
|
|
_compareDateTime(noon.start, night.start, (needChange) {
|
|
|
|
if (!needChange) {
|
|
|
|
noon.start = night.start;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
_compareDateTime(noon.end, morning.start, (needChange) {
|
|
|
|
if (!needChange) {
|
|
|
|
noon.end = night.start;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (swichState[2] == false) {
|
|
|
|
if (model.daily.noon.isNotEmpty) {
|
|
|
|
_compareDateTime(night.start, noon.end, (needChange) {
|
|
|
|
if (needChange) {
|
|
|
|
night.start = noon.end;
|
|
|
|
night.end = noon.end;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
_compareDateTime(night.end, noon.start, (needChange) {
|
|
|
|
if (needChange) {
|
|
|
|
night.end = noon.start;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
} else if (model.daily.morning.isNotEmpty) {
|
|
|
|
_compareDateTime(night.start, morning.end, (needChange) {
|
|
|
|
if (needChange) {
|
|
|
|
night.start = morning.end;
|
|
|
|
night.end = morning.end;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
_compareDateTime(night.start, morning.start, (needChange) {
|
|
|
|
if (needChange) {
|
|
|
|
night.start = morning.start;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
///item
|
|
...
|
...
|
@@ -147,11 +276,11 @@ class _BookTimeSetPageState extends State<BookTimeSetPage> { |
|
|
|
InkWell(
|
|
|
|
onTap: () {
|
|
|
|
setState(() {
|
|
|
|
swichState[tag]["on"] = !swichState[tag]["on"];
|
|
|
|
swichState[tag] = !swichState[tag];
|
|
|
|
});
|
|
|
|
},
|
|
|
|
child: Image.asset(
|
|
|
|
swichState[tag]["on"]
|
|
|
|
swichState[tag]
|
|
|
|
? Utils.getImgPath('swich_on')
|
|
|
|
: Utils.getImgPath('swich_off'),
|
|
|
|
width: ScreenUtil().setWidth(122),
|
|
...
|
...
|
@@ -166,9 +295,8 @@ class _BookTimeSetPageState extends State<BookTimeSetPage> { |
|
|
|
ScreenUtil().setWidth(2),
|
|
|
|
color: MyColours.color_f3f3f3,
|
|
|
|
),
|
|
|
|
_timeWidget('开始时间', startTime, highted: swichState[tag]["on"],
|
|
|
|
onTap: () {
|
|
|
|
if (swichState[tag]["on"]) {
|
|
|
|
timeWidget('开始时间', startTime, highted: swichState[tag], onTap: () {
|
|
|
|
if (swichState[tag]) {
|
|
|
|
List data = dateData;
|
|
|
|
if (tag == 0) {
|
|
|
|
//早市
|
|
...
|
...
|
@@ -184,11 +312,16 @@ class _BookTimeSetPageState extends State<BookTimeSetPage> { |
|
|
|
DialogUtil.showSelectCusmanDialog(context, data, (value) {
|
|
|
|
if (value != null) {
|
|
|
|
String temp;
|
|
|
|
if (value[1] == 0) {
|
|
|
|
temp = '00';
|
|
|
|
} else {
|
|
|
|
if (data.length == 1) {
|
|
|
|
temp = '30';
|
|
|
|
} else {
|
|
|
|
if (value[1] == 0) {
|
|
|
|
temp = '00';
|
|
|
|
} else {
|
|
|
|
temp = '30';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
print(data[value[0]].keys.first);
|
|
|
|
String time = _getTimeString(
|
|
|
|
_getHourFromTitle(data[value[0]].keys.first), temp);
|
|
...
|
...
|
@@ -196,16 +329,66 @@ class _BookTimeSetPageState extends State<BookTimeSetPage> { |
|
|
|
if (tag == 0) {
|
|
|
|
//早市
|
|
|
|
morning.start = time;
|
|
|
|
setState(() {
|
|
|
|
_compareDateTime(morning.end, time, (needChange) {
|
|
|
|
if (needChange) {
|
|
|
|
morning.end = time;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
_compareDateTime(noon.start, time, (needChange) {
|
|
|
|
if (needChange) {
|
|
|
|
noon.start = time;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
_compareDateTime(noon.end, time, (needChange) {
|
|
|
|
if (needChange) {
|
|
|
|
noon.end = time;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
_compareDateTime(night.start, time, (needChange) {
|
|
|
|
if (needChange) {
|
|
|
|
night.start = time;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
_compareDateTime(night.end, time, (needChange) {
|
|
|
|
if (needChange) {
|
|
|
|
night.end = time;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
} else if (tag == 1) {
|
|
|
|
//午市
|
|
|
|
noon.start = time;
|
|
|
|
setState(() {
|
|
|
|
_compareDateTime(noon.end, time, (needChange) {
|
|
|
|
if (needChange) {
|
|
|
|
noon.end = time;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
_compareDateTime(night.start, time, (needChange) {
|
|
|
|
if (needChange) {
|
|
|
|
night.start = time;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
_compareDateTime(night.end, time, (needChange) {
|
|
|
|
if (needChange) {
|
|
|
|
night.end = time;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
} else if (tag == 2) {
|
|
|
|
//晚市
|
|
|
|
night.start = time;
|
|
|
|
setState(() {
|
|
|
|
_compareDateTime(night.end, time, (needChange) {
|
|
|
|
if (needChange) {
|
|
|
|
night.end = time;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
});
|
|
|
|
print(value);
|
|
|
|
_compare(time);
|
|
|
|
}
|
|
|
|
}, selecteds: [
|
|
|
|
_getFirSelected(startTime, data),
|
|
...
|
...
|
@@ -223,9 +406,8 @@ class _BookTimeSetPageState extends State<BookTimeSetPage> { |
|
|
|
ScreenUtil().setWidth(2),
|
|
|
|
color: MyColours.color_f3f3f3,
|
|
|
|
)),
|
|
|
|
_timeWidget('结束时间', endTime, highted: swichState[tag]["on"],
|
|
|
|
onTap: () {
|
|
|
|
if (swichState[tag]["on"]) {
|
|
|
|
timeWidget('结束时间', endTime, highted: swichState[tag], onTap: () {
|
|
|
|
if (swichState[tag]) {
|
|
|
|
List data = dateData;
|
|
|
|
if (tag == 0) {
|
|
|
|
//早市
|
|
...
|
...
|
@@ -240,10 +422,14 @@ class _BookTimeSetPageState extends State<BookTimeSetPage> { |
|
|
|
DialogUtil.showSelectCusmanDialog(context, data, (value) {
|
|
|
|
if (value != null) {
|
|
|
|
String temp;
|
|
|
|
if (value[1] == 0) {
|
|
|
|
temp = '00';
|
|
|
|
} else {
|
|
|
|
if (data.length == 1) {
|
|
|
|
temp = '30';
|
|
|
|
} else {
|
|
|
|
if (value[1] == 0) {
|
|
|
|
temp = '00';
|
|
|
|
} else {
|
|
|
|
temp = '30';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
String time = _getTimeString(
|
|
|
|
_getHourFromTitle(data[value[0]].keys.first), temp);
|
|
...
|
...
|
@@ -251,16 +437,49 @@ class _BookTimeSetPageState extends State<BookTimeSetPage> { |
|
|
|
if (tag == 0) {
|
|
|
|
//早市
|
|
|
|
morning.end = time;
|
|
|
|
setState(() {
|
|
|
|
_compareDateTime(noon.start, time, (needChange) {
|
|
|
|
if (needChange) {
|
|
|
|
noon.start = time;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
_compareDateTime(noon.end, time, (needChange) {
|
|
|
|
if (needChange) {
|
|
|
|
noon.end = time;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
_compareDateTime(night.start, time, (needChange) {
|
|
|
|
if (needChange) {
|
|
|
|
night.start = time;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
_compareDateTime(night.end, time, (needChange) {
|
|
|
|
if (needChange) {
|
|
|
|
night.end = time;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
} else if (tag == 1) {
|
|
|
|
//午市
|
|
|
|
noon.end = time;
|
|
|
|
setState(() {
|
|
|
|
_compareDateTime(night.start, time, (needChange) {
|
|
|
|
if (needChange) {
|
|
|
|
night.start = time;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
_compareDateTime(night.end, time, (needChange) {
|
|
|
|
if (needChange) {
|
|
|
|
night.end = time;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
} else if (tag == 2) {
|
|
|
|
//晚市
|
|
|
|
night.end = time;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
print(value);
|
|
|
|
_compare(time);
|
|
|
|
}
|
|
|
|
}, selecteds: [
|
|
|
|
_getFirSelected(endTime, data),
|
|
...
|
...
|
@@ -274,52 +493,17 @@ class _BookTimeSetPageState extends State<BookTimeSetPage> { |
|
|
|
));
|
|
|
|
}
|
|
|
|
|
|
|
|
/// 开始时间和结束时间widget
|
|
|
|
_timeWidget(String title, String time,
|
|
|
|
{bool highted = true, GestureTapCallback onTap}) {
|
|
|
|
return InkWell(
|
|
|
|
onTap: onTap,
|
|
|
|
child: Padding(
|
|
|
|
padding:
|
|
|
|
EdgeInsets.symmetric(horizontal: ScreenUtil().setWidth(40)),
|
|
|
|
child: Container(
|
|
|
|
height: ScreenUtil().setWidth(124),
|
|
|
|
child: Row(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
children: [
|
|
|
|
Text(title,
|
|
|
|
style: TextStyle(
|
|
|
|
color: highted
|
|
|
|
? MyColours.color_353535
|
|
|
|
: MyColours.color_999999,
|
|
|
|
fontSize: ScreenUtil().setSp(30),
|
|
|
|
)),
|
|
|
|
Spacer(),
|
|
|
|
Text(time,
|
|
|
|
style: TextStyle(
|
|
|
|
color: highted
|
|
|
|
? MyColours.color_353535
|
|
|
|
: MyColours.color_999999,
|
|
|
|
fontSize: ScreenUtil().setSp(30),
|
|
|
|
)),
|
|
|
|
HEmptyView(20),
|
|
|
|
Image.asset(
|
|
|
|
Utils.getImgPath('arrow_right_new'),
|
|
|
|
width: ScreenUtil().setWidth(16),
|
|
|
|
height: ScreenUtil().setWidth(28),
|
|
|
|
)
|
|
|
|
],
|
|
|
|
),
|
|
|
|
)));
|
|
|
|
}
|
|
|
|
|
|
|
|
///工具
|
|
|
|
/// 组装成07:00
|
|
|
|
_getTimeString(dynamic hour, String minute) {
|
|
|
|
return '${hour}:${minute}';
|
|
|
|
}
|
|
|
|
|
|
|
|
/// 组装成 07:00-10:00
|
|
|
|
_getTimelLongString(String start, String end) {
|
|
|
|
return '${start}-${end}';
|
|
|
|
}
|
|
|
|
|
|
|
|
/// 从07:00中获取07
|
|
|
|
_getHourFromhourAndMinute(String hourAndMinute) {
|
|
|
|
return hourAndMinute.substring(0, 2);
|
|
...
|
...
|
@@ -368,79 +552,177 @@ class _BookTimeSetPageState extends State<BookTimeSetPage> { |
|
|
|
List tempList = List();
|
|
|
|
tempList.addAll(dateData);
|
|
|
|
tempList.removeRange(0, int.parse(hour));
|
|
|
|
if (tempList.length == 0) {
|
|
|
|
tempList = [
|
|
|
|
{
|
|
|
|
'晚上23时': [30]
|
|
|
|
}
|
|
|
|
];
|
|
|
|
}
|
|
|
|
return tempList;
|
|
|
|
}
|
|
|
|
|
|
|
|
///判断时间大小
|
|
|
|
/// a > b
|
|
|
|
/// a < b 则 a = b
|
|
|
|
_compareDateTime(String a, String b, BookTimeSetCallback callback) {
|
|
|
|
String tempa = '${DateUtil.getNowDateStr().substring(0, 10)} ${a}:00';
|
|
|
|
String tempb = '${DateUtil.getNowDateStr().substring(0, 10)} ${b}:00';
|
|
|
|
int aMs = DateUtil.getDateMsByTimeStr(tempa);
|
|
|
|
int bMs = DateUtil.getDateMsByTimeStr(tempb);
|
|
|
|
if (aMs < bMs) {
|
|
|
|
a = b;
|
|
|
|
callback(true);
|
|
|
|
} else {
|
|
|
|
callback(false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
_compare(String time) {
|
|
|
|
setState(() {
|
|
|
|
_compareDateTime(morning.start, time, (needChange) {
|
|
|
|
if (needChange) {
|
|
|
|
morning.start = time;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
_compareDateTime(morning.end, time, (needChange) {
|
|
|
|
if (needChange) {
|
|
|
|
morning.end = time;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
_compareDateTime(noon.start, time, (needChange) {
|
|
|
|
if (needChange) {
|
|
|
|
noon.start = time;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
_compareDateTime(noon.end, time, (needChange) {
|
|
|
|
if (needChange) {
|
|
|
|
noon.end = time;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
_compareDateTime(night.start, time, (needChange) {
|
|
|
|
if (needChange) {
|
|
|
|
night.start = time;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
_compareDateTime(night.end, time, (needChange) {
|
|
|
|
if (needChange) {
|
|
|
|
night.end = time;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
///底部widget
|
|
|
|
///
|
|
|
|
_bottomWidget() {
|
|
|
|
return Container(
|
|
|
|
padding: EdgeInsets.fromLTRB(
|
|
|
|
ScreenUtil().setWidth(40),
|
|
|
|
ScreenUtil().setWidth(60),
|
|
|
|
ScreenUtil().setWidth(40),
|
|
|
|
ScreenUtil().setWidth(60),
|
|
|
|
),
|
|
|
|
child: Column(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
textWidget('温馨提示:'),
|
|
|
|
VEmptyView(10),
|
|
|
|
textWidget('1.时段停用,表示餐厅将不支持该时段的预订;'),
|
|
|
|
VEmptyView(10),
|
|
|
|
textWidget('2.修改起始时间后,为确保正常生效,建议重启话机。'),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
bookSetTimeModel = Provider.of<BookSetTimeModel>(context, listen: true);
|
|
|
|
return Scaffold(
|
|
|
|
key: _scaffoldKey,
|
|
|
|
backgroundColor: MyColours.color_f5f5f5,
|
|
|
|
appBar: SystemAppBar('可订时段'),
|
|
|
|
body: SafeArea(
|
|
|
|
child: SingleChildScrollView(
|
|
|
|
child: Column(
|
|
|
|
children: [
|
|
|
|
MyAppBar(
|
|
|
|
"可订时段",
|
|
|
|
showBack: true,
|
|
|
|
child: Column(
|
|
|
|
children: [
|
|
|
|
Expanded(
|
|
|
|
child: SingleChildScrollView(
|
|
|
|
child: Column(
|
|
|
|
children: [
|
|
|
|
_itemWidget('早市', morning.start, morning.end, 0),
|
|
|
|
VEmptyView(20),
|
|
|
|
_itemWidget('午市', noon.start, noon.end, 1),
|
|
|
|
VEmptyView(20),
|
|
|
|
_itemWidget('晚市', night.start, night.end, 2),
|
|
|
|
_bottomWidget()
|
|
|
|
],
|
|
|
|
),
|
|
|
|
_itemWidget('早市', morning.start, morning.end, 0),
|
|
|
|
VEmptyView(20),
|
|
|
|
_itemWidget('午市', noon.start, noon.end, 1),
|
|
|
|
VEmptyView(20),
|
|
|
|
_itemWidget('晚市', night.start, night.end, 2),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
)),
|
|
|
|
Padding(
|
|
|
|
padding: EdgeInsets.fromLTRB(
|
|
|
|
ScreenUtil().setWidth(40),
|
|
|
|
ScreenUtil().setWidth(0),
|
|
|
|
ScreenUtil().setWidth(40),
|
|
|
|
ScreenUtil().setWidth(60)),
|
|
|
|
child: CommonButton(
|
|
|
|
width: double.infinity,
|
|
|
|
height: 84,
|
|
|
|
fontSize: 34,
|
|
|
|
content: '保存',
|
|
|
|
state: 2,
|
|
|
|
onPress: () async {
|
|
|
|
String morningStr = '';
|
|
|
|
String noonStr = '';
|
|
|
|
String nightStr = '';
|
|
|
|
if (swichState[0]) {
|
|
|
|
morningStr =
|
|
|
|
_getTimelLongString(morning.start, morning.end);
|
|
|
|
}
|
|
|
|
if (swichState[1]) {
|
|
|
|
noonStr = _getTimelLongString(noon.start, noon.end);
|
|
|
|
}
|
|
|
|
if (swichState[2]) {
|
|
|
|
nightStr = _getTimelLongString(night.start, night.end);
|
|
|
|
}
|
|
|
|
|
|
|
|
DialogUtil.confirmTimeAlertDialog(
|
|
|
|
context, morningStr, noonStr, nightStr, () async {
|
|
|
|
///接口
|
|
|
|
///
|
|
|
|
SetSellerInfoSunModel sunModel = await bookSetTimeModel
|
|
|
|
.setSellerInfoById(context, {
|
|
|
|
'morning': morningStr,
|
|
|
|
'noon': noonStr,
|
|
|
|
'night': nightStr
|
|
|
|
});
|
|
|
|
if (sunModel != null) {
|
|
|
|
//修改成功
|
|
|
|
Utils.showToast('保存成功');
|
|
|
|
Navigator.pop(context);
|
|
|
|
} else {
|
|
|
|
// Utils.showToast('保存失败');
|
|
|
|
}
|
|
|
|
});
|
|
|
|
},
|
|
|
|
))
|
|
|
|
],
|
|
|
|
)),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/// 开始时间和结束时间widget
|
|
|
|
timeWidget(String title, String time,
|
|
|
|
{bool highted = true, GestureTapCallback onTap}) {
|
|
|
|
return InkWell(
|
|
|
|
onTap: onTap,
|
|
|
|
child: Padding(
|
|
|
|
padding: EdgeInsets.symmetric(horizontal: ScreenUtil().setWidth(40)),
|
|
|
|
child: Container(
|
|
|
|
height: ScreenUtil().setWidth(124),
|
|
|
|
child: Row(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
children: [
|
|
|
|
Text(title,
|
|
|
|
style: TextStyle(
|
|
|
|
color: highted
|
|
|
|
? MyColours.color_353535
|
|
|
|
: MyColours.color_999999,
|
|
|
|
fontSize: ScreenUtil().setSp(30),
|
|
|
|
)),
|
|
|
|
Spacer(),
|
|
|
|
Text(time,
|
|
|
|
style: TextStyle(
|
|
|
|
color: highted
|
|
|
|
? MyColours.color_353535
|
|
|
|
: MyColours.color_999999,
|
|
|
|
fontSize: ScreenUtil().setSp(30),
|
|
|
|
)),
|
|
|
|
HEmptyView(20),
|
|
|
|
Image.asset(
|
|
|
|
Utils.getImgPath('arrow_right_new'),
|
|
|
|
width: ScreenUtil().setWidth(16),
|
|
|
|
height: ScreenUtil().setWidth(28),
|
|
|
|
)
|
|
|
|
],
|
|
|
|
),
|
|
|
|
)));
|
|
|
|
}
|
|
|
|
|
|
|
|
///文本widget
|
|
|
|
///
|
|
|
|
textWidget(String title) {
|
|
|
|
return Container(
|
|
|
|
height: ScreenUtil().setWidth(40),
|
|
|
|
child: Text(
|
|
|
|
title,
|
|
|
|
style: TextStyle(
|
|
|
|
color: MyColours.color_353535, fontSize: ScreenUtil().setSp(28)),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
} |
...
|
...
|
|