|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:one_key/models/seller_table_class_entity.dart';
|
|
|
|
import 'package:one_key/provider/store_detail_model.dart';
|
|
|
|
import 'package:one_key/provider/user_model.dart';
|
|
|
|
import 'package:one_key/res/colors.dart';
|
|
|
|
import 'package:one_key/utils/utils.dart';
|
|
|
|
import 'package:one_key/widgets/h_empty_view.dart';
|
|
|
|
import 'package:one_key/widgets/v_empty_view.dart';
|
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
import 'package:table_calendar/table_calendar.dart';
|
|
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
|
|
|
|
|
|
import '../../app.dart';
|
|
|
|
|
|
|
|
class StoreTypeFillManagePage extends StatefulWidget {
|
|
|
|
int timeMills; //日期
|
|
|
|
int ddate_solt; //时段
|
|
|
|
|
|
|
|
StoreTypeFillManagePage({Key key, this.timeMills, this.ddate_solt})
|
|
|
|
: super(key: key);
|
|
|
|
|
|
|
|
@override
|
|
|
|
State<StatefulWidget> createState() {
|
|
|
|
// TODO: implement createState
|
|
|
|
return StoreTypeFillManagePageState();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
class StoreTypeFillManagePageState extends State<StoreTypeFillManagePage> {
|
|
|
|
CalendarController _calendarController;
|
|
|
|
|
|
|
|
Map<DateTime, List> _events;
|
|
|
|
|
|
|
|
DateTime _selectDateTime = DateTime.now();
|
|
|
|
|
|
|
|
UserModel userModel;
|
|
|
|
DateTime dateTimeNow; //当前日期
|
|
|
|
String morning; //早市时间段
|
|
|
|
String noon; //午市时间段
|
|
|
|
String night; //晚市时间段
|
|
|
|
|
|
|
|
int timeIndex = 0; //当前时段
|
|
|
|
int enableIndex = 0; //最早可用时段
|
|
|
|
|
|
|
|
//早市,午市,晚市时间段
|
|
|
|
Map<String, String> daily = {"morning": "", "noon": "", "night": ""};
|
|
|
|
|
|
|
|
//包间
|
|
|
|
List<SellerTableClassEntity> tables = [];
|
|
|
|
|
|
|
|
//已选包间数量
|
|
|
|
Map<int, int> roomNum = {0: 0, 1: 0, 2: 0, 3: 0};
|
|
|
|
|
|
|
|
//已选包间下标
|
|
|
|
List<int> rooms = [];
|
|
|
|
|
|
|
|
//获取店铺详情
|
|
|
|
_getStoreDetail() {
|
|
|
|
_initTime();
|
|
|
|
_currTimeIndex();
|
|
|
|
_getSellerTableClass();
|
|
|
|
}
|
|
|
|
|
|
|
|
//当前选中时间段
|
|
|
|
_currTimeIndex() {
|
|
|
|
DateTime now = DateTime.now();
|
|
|
|
String ymd =
|
|
|
|
"${_selectDateTime.year}-${Utils.addZeroNumber(_selectDateTime.month)}-${Utils.addZeroNumber(_selectDateTime.day)} ";
|
|
|
|
DateTime morningStart =
|
|
|
|
DateTime.parse("$ymd${daily['morning'].split('-')[0]}:00");
|
|
|
|
DateTime morningEnd =
|
|
|
|
DateTime.parse("$ymd${daily['morning'].split('-')[1]}:00");
|
|
|
|
DateTime noonStart =
|
|
|
|
DateTime.parse("$ymd${daily['noon'].split('-')[0]}:00");
|
|
|
|
DateTime noonEnd = DateTime.parse("$ymd${daily['noon'].split('-')[1]}:00");
|
|
|
|
DateTime nightStart =
|
|
|
|
DateTime.parse("$ymd${daily['night'].split('-')[0]}:00");
|
|
|
|
DateTime nightEnd =
|
|
|
|
DateTime.parse("$ymd${daily['night'].split('-')[1]}:00");
|
|
|
|
if (daily["morning"] != "00:00-00:00" && now.isBefore(morningEnd)) {
|
|
|
|
timeIndex = 0;
|
|
|
|
enableIndex = 0;
|
|
|
|
} else if (daily["noon"] != "00:00-00:00" && now.isBefore(noonEnd)) {
|
|
|
|
timeIndex = 1;
|
|
|
|
enableIndex = 1;
|
|
|
|
} else if (daily["night"] != "00:00-00:00" && now.isBefore(nightEnd)) {
|
|
|
|
timeIndex = 2;
|
|
|
|
enableIndex = 2;
|
|
|
|
} else {
|
|
|
|
timeIndex = -1;
|
|
|
|
enableIndex = 3;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (widget.timeMills != 0 && widget.ddate_solt != 0) {
|
|
|
|
_selectDateTime = DateTime.fromMillisecondsSinceEpoch(widget.timeMills);
|
|
|
|
timeIndex = widget.ddate_solt;
|
|
|
|
if (!Utils.isOneDay(_selectDateTime, DateTime.now())) {
|
|
|
|
//不是今天
|
|
|
|
enableIndex = 0;
|
|
|
|
}
|
|
|
|
widget.timeMills = 0;
|
|
|
|
widget.ddate_solt = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
setState(() {});
|
|
|
|
}
|
|
|
|
|
|
|
|
//获取商家包间类型
|
|
|
|
_getSellerTableClass() async {
|
|
|
|
Map<String, String> params = {
|
|
|
|
"sellerid": Provider.of<UserModel>(context, listen: false).user.sellerid,
|
|
|
|
"day": (DateTime.parse(
|
|
|
|
"${_selectDateTime.year}-${Utils.addZeroNumber(_selectDateTime.month)}-${Utils.addZeroNumber(_selectDateTime.day)} 00:00:00")
|
|
|
|
.millisecondsSinceEpoch /
|
|
|
|
1000)
|
|
|
|
.floor()
|
|
|
|
.toString(),
|
|
|
|
"interval": (timeIndex + 1).toString()
|
|
|
|
};
|
|
|
|
StoreDetailModel detailModel =
|
|
|
|
Provider.of<StoreDetailModel>(context, listen: false);
|
|
|
|
tables = await detailModel.getSellerTableClass(context, params);
|
|
|
|
for (int i = 0; i < tables.length; i++) {
|
|
|
|
roomNum[i] = 0;
|
|
|
|
}
|
|
|
|
rooms.clear();
|
|
|
|
setState(() {});
|
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
|
|
|
void initState() {
|
|
|
|
// TODO: implement initState
|
|
|
|
super.initState();
|
|
|
|
tables = [];
|
|
|
|
_calendarController = CalendarController();
|
|
|
|
_events = {};
|
|
|
|
_getStoreDetail();
|
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
|
|
|
void dispose() {
|
|
|
|
// TODO: implement dispose
|
|
|
|
_calendarController.dispose();
|
|
|
|
super.dispose();
|
|
|
|
}
|
|
|
|
|
|
|
|
//初始化时间
|
|
|
|
_initTime() {
|
|
|
|
dateTimeNow = DateTime.now();
|
|
|
|
|
|
|
|
morning =
|
|
|
|
userModel.user.morning.isEmpty ? "00:00-00:00" : userModel.user.morning;
|
|
|
|
noon = userModel.user.noon.isEmpty ? "00:00-00:00" : userModel.user.noon;
|
|
|
|
night = userModel.user.night.isEmpty ? "00:00-00:00" : userModel.user.night;
|
|
|
|
|
|
|
|
daily = {"morning": morning, "noon": noon, "night": night};
|
|
|
|
}
|
|
|
|
|
|
|
|
//构建已选包间
|
|
|
|
_buildSelectRooms() {
|
|
|
|
List<Widget> selectRooms = [];
|
|
|
|
for (int i in rooms) {
|
|
|
|
selectRooms.add(Container(
|
|
|
|
margin: EdgeInsets.only(right: ScreenUtil().setWidth(10)),
|
|
|
|
child: Stack(
|
|
|
|
children: <Widget>[
|
|
|
|
Container(
|
|
|
|
width: ScreenUtil().setWidth(150),
|
|
|
|
height: ScreenUtil().setWidth(70),
|
|
|
|
margin: EdgeInsets.only(
|
|
|
|
right: ScreenUtil().setWidth(12),
|
|
|
|
top: ScreenUtil().setWidth(12)),
|
|
|
|
alignment: Alignment.center,
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
color: MyColours.color_199095,
|
|
|
|
border: Border.all(
|
|
|
|
color: MyColours.color_199095,
|
|
|
|
width: ScreenUtil().setWidth(2)),
|
|
|
|
borderRadius:
|
|
|
|
BorderRadius.circular(ScreenUtil().setWidth(10))),
|
|
|
|
child: Text(
|
|
|
|
"${tables[i].name}",
|
|
|
|
maxLines: 1,
|
|
|
|
overflow: TextOverflow.ellipsis,
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: ScreenUtil().setSp(30),
|
|
|
|
color: MyColours.color_199095,
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Positioned(
|
|
|
|
top: 0,
|
|
|
|
right: 0,
|
|
|
|
child: GestureDetector(
|
|
|
|
onTap: () {
|
|
|
|
rooms.remove(i);
|
|
|
|
roomNum[i]--;
|
|
|
|
setState(() {});
|
|
|
|
},
|
|
|
|
child: Image.asset(
|
|
|
|
"assets/icon_clear.png",
|
|
|
|
width: ScreenUtil().setWidth(36),
|
|
|
|
height: ScreenUtil().setWidth(36),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
)
|
|
|
|
],
|
|
|
|
),
|
|
|
|
));
|
|
|
|
}
|
|
|
|
return selectRooms;
|
|
|
|
}
|
|
|
|
|
|
|
|
//构建时段
|
|
|
|
Widget _buildShiduan() {
|
|
|
|
return Container(
|
|
|
|
padding: EdgeInsets.only(
|
|
|
|
left: ScreenUtil().setWidth(30),
|
|
|
|
top: ScreenUtil().setWidth(80),
|
|
|
|
right: ScreenUtil().setWidth(30)),
|
|
|
|
child: Column(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: <Widget>[
|
|
|
|
Text(
|
|
|
|
"预订时段",
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: ScreenUtil().setSp(36),
|
|
|
|
color: MyColours.color_333333,
|
|
|
|
fontWeight: FontWeight.bold),
|
|
|
|
),
|
|
|
|
VEmptyView(30),
|
|
|
|
Stack(
|
|
|
|
children: <Widget>[
|
|
|
|
Container(
|
|
|
|
height: ScreenUtil().setWidth(90),
|
|
|
|
width: ScreenUtil().setWidth(690),
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
color: MyColours.color_ffffff,
|
|
|
|
border: Border.all(
|
|
|
|
color: MyColours.color_cccccc,
|
|
|
|
width: ScreenUtil().setWidth(2)),
|
|
|
|
borderRadius:
|
|
|
|
BorderRadius.circular(ScreenUtil().setWidth(10))),
|
|
|
|
),
|
|
|
|
Container(
|
|
|
|
height: ScreenUtil().setWidth(90),
|
|
|
|
width: ScreenUtil().setWidth(690),
|
|
|
|
child: Flex(
|
|
|
|
direction: Axis.horizontal,
|
|
|
|
children: <Widget>[
|
|
|
|
Expanded(
|
|
|
|
flex: daily["morning"] == "00:00-00:00" ? 0 : 1,
|
|
|
|
child: daily["morning"] == "00:00-00:00"
|
|
|
|
? Container()
|
|
|
|
: GestureDetector(
|
|
|
|
onTap: () {
|
|
|
|
if (enableIndex > 0) return;
|
|
|
|
if (timeIndex == 0) return;
|
|
|
|
setState(() {
|
|
|
|
timeIndex = 0;
|
|
|
|
_getSellerTableClass();
|
|
|
|
});
|
|
|
|
},
|
|
|
|
child: Container(
|
|
|
|
height: ScreenUtil().setWidth(90),
|
|
|
|
decoration: timeIndex == 0
|
|
|
|
? BoxDecoration(
|
|
|
|
color: MyColours.color_F4FAFF,
|
|
|
|
border: Border.all(
|
|
|
|
color: MyColours.color_199095,
|
|
|
|
width: ScreenUtil().setWidth(2)),
|
|
|
|
borderRadius: BorderRadius.all(
|
|
|
|
Radius.circular(
|
|
|
|
ScreenUtil().setWidth(10))))
|
|
|
|
: BoxDecoration(),
|
|
|
|
alignment: Alignment.center,
|
|
|
|
child: Column(
|
|
|
|
mainAxisSize: MainAxisSize.min,
|
|
|
|
children: <Widget>[
|
|
|
|
Text(
|
|
|
|
"早餐",
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: ScreenUtil().setSp(30),
|
|
|
|
color: enableIndex > 0
|
|
|
|
? MyColours.color_999999
|
|
|
|
: timeIndex == 0
|
|
|
|
? MyColours.color_199095
|
|
|
|
: MyColours.color_333333,
|
|
|
|
fontWeight: timeIndex == 0
|
|
|
|
? FontWeight.bold
|
|
|
|
: FontWeight.normal),
|
|
|
|
),
|
|
|
|
Text(
|
|
|
|
"${daily["morning"]}",
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: ScreenUtil().setSp(24),
|
|
|
|
color: enableIndex > 0
|
|
|
|
? MyColours.color_999999
|
|
|
|
: timeIndex == 0
|
|
|
|
? MyColours.color_199095
|
|
|
|
: MyColours.color_333333,
|
|
|
|
fontWeight: timeIndex == 0
|
|
|
|
? FontWeight.bold
|
|
|
|
: FontWeight.normal),
|
|
|
|
)
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
)),
|
|
|
|
Expanded(
|
|
|
|
flex: daily["noon"] == "00:00-00:00" ? 0 : 1,
|
|
|
|
child: daily["noon"] == "00:00-00:00"
|
|
|
|
? Container()
|
|
|
|
: GestureDetector(
|
|
|
|
onTap: () {
|
|
|
|
if (enableIndex > 1) return;
|
|
|
|
if (timeIndex == 1) return;
|
|
|
|
setState(() {
|
|
|
|
timeIndex = 1;
|
|
|
|
_getSellerTableClass();
|
|
|
|
});
|
|
|
|
},
|
|
|
|
child: Container(
|
|
|
|
height: ScreenUtil().setWidth(90),
|
|
|
|
decoration: timeIndex == 1
|
|
|
|
? BoxDecoration(
|
|
|
|
color: MyColours.color_F4FAFF,
|
|
|
|
border: Border.all(
|
|
|
|
color: MyColours.color_199095,
|
|
|
|
width: ScreenUtil().setWidth(2)),
|
|
|
|
borderRadius: BorderRadius.all(
|
|
|
|
Radius.circular(
|
|
|
|
ScreenUtil().setWidth(10))))
|
|
|
|
: BoxDecoration(),
|
|
|
|
alignment: Alignment.center,
|
|
|
|
child: Column(
|
|
|
|
mainAxisSize: MainAxisSize.min,
|
|
|
|
children: <Widget>[
|
|
|
|
Text(
|
|
|
|
"午餐",
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: ScreenUtil().setSp(30),
|
|
|
|
color: enableIndex > 1
|
|
|
|
? MyColours.color_999999
|
|
|
|
: timeIndex == 1
|
|
|
|
? MyColours.color_199095
|
|
|
|
: MyColours.color_333333,
|
|
|
|
fontWeight: timeIndex == 1
|
|
|
|
? FontWeight.bold
|
|
|
|
: FontWeight.normal),
|
|
|
|
),
|
|
|
|
Text(
|
|
|
|
"${daily["noon"]}",
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: ScreenUtil().setSp(24),
|
|
|
|
color: enableIndex > 1
|
|
|
|
? MyColours.color_999999
|
|
|
|
: timeIndex == 1
|
|
|
|
? MyColours.color_199095
|
|
|
|
: MyColours.color_333333,
|
|
|
|
fontWeight: timeIndex == 1
|
|
|
|
? FontWeight.bold
|
|
|
|
: FontWeight.normal),
|
|
|
|
)
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
)),
|
|
|
|
Expanded(
|
|
|
|
flex: daily["night"] == "00:00-00:00" ? 0 : 1,
|
|
|
|
child: daily["night"] == "00:00-00:00"
|
|
|
|
? Container()
|
|
|
|
: GestureDetector(
|
|
|
|
onTap: () {
|
|
|
|
if (enableIndex > 2) return;
|
|
|
|
if (timeIndex == 2) return;
|
|
|
|
setState(() {
|
|
|
|
timeIndex = 2;
|
|
|
|
_getSellerTableClass();
|
|
|
|
});
|
|
|
|
},
|
|
|
|
child: Container(
|
|
|
|
height: ScreenUtil().setWidth(90),
|
|
|
|
decoration: timeIndex == 2
|
|
|
|
? BoxDecoration(
|
|
|
|
color: MyColours.color_F4FAFF,
|
|
|
|
border: Border.all(
|
|
|
|
color: MyColours.color_199095,
|
|
|
|
width: ScreenUtil().setWidth(2)),
|
|
|
|
borderRadius: BorderRadius.all(
|
|
|
|
Radius.circular(
|
|
|
|
ScreenUtil().setWidth(10))))
|
|
|
|
: BoxDecoration(),
|
|
|
|
alignment: Alignment.center,
|
|
|
|
child: Column(
|
|
|
|
mainAxisSize: MainAxisSize.min,
|
|
|
|
children: <Widget>[
|
|
|
|
Text(
|
|
|
|
"晚餐",
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: ScreenUtil().setSp(30),
|
|
|
|
color: enableIndex > 2
|
|
|
|
? MyColours.color_999999
|
|
|
|
: timeIndex == 2
|
|
|
|
? MyColours.color_199095
|
|
|
|
: MyColours.color_333333,
|
|
|
|
fontWeight: timeIndex == 2
|
|
|
|
? FontWeight.bold
|
|
|
|
: FontWeight.normal),
|
|
|
|
),
|
|
|
|
Text(
|
|
|
|
"${daily["night"]}",
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: ScreenUtil().setSp(24),
|
|
|
|
color: enableIndex > 2
|
|
|
|
? MyColours.color_999999
|
|
|
|
: timeIndex == 2
|
|
|
|
? MyColours.color_199095
|
|
|
|
: MyColours.color_333333,
|
|
|
|
fontWeight: timeIndex == 2
|
|
|
|
? FontWeight.bold
|
|
|
|
: FontWeight.normal),
|
|
|
|
)
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
)),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
)
|
|
|
|
],
|
|
|
|
)
|
|
|
|
],
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
//解析返回显示的日期
|
|
|
|
_parseDateDay(DateTime dateTime) {
|
|
|
|
DateTime now = DateTime.now();
|
|
|
|
if (Utils.isOneDay(dateTime, now)) {
|
|
|
|
return "今";
|
|
|
|
} else if (Utils.isOneDay(dateTime, now.add(Duration(days: 1)))) {
|
|
|
|
return "明";
|
|
|
|
} else if (Utils.isOneDay(dateTime, now.add(Duration(days: 2)))) {
|
|
|
|
return "后";
|
|
|
|
} else {
|
|
|
|
return dateTime.day.toString();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
userModel = Provider.of<UserModel>(context, listen: false);
|
|
|
|
return Scaffold(
|
|
|
|
body: Consumer<StoreDetailModel>(
|
|
|
|
builder: (context, model, child) {
|
|
|
|
Widget widget = Container();
|
|
|
|
Container(
|
|
|
|
width: double.infinity,
|
|
|
|
height: double.infinity,
|
|
|
|
color: MyColours.color_ffffff,
|
|
|
|
child: Column(
|
|
|
|
children: <Widget>[
|
|
|
|
Expanded(
|
|
|
|
child: SingleChildScrollView(
|
|
|
|
child: Column(
|
|
|
|
children: <Widget>[
|
|
|
|
Container(
|
|
|
|
color: MyColours.color_F9F9F9,
|
|
|
|
child: TableCalendar(
|
|
|
|
calendarController: _calendarController,
|
|
|
|
initialSelectedDay: _selectDateTime,
|
|
|
|
startDay: DateTime.now(),
|
|
|
|
onDaySelected: (day, _, holidays) {
|
|
|
|
if (!Utils.isOneDay(day, _selectDateTime)) {
|
|
|
|
//不是一天
|
|
|
|
_selectDateTime = day;
|
|
|
|
_currTimeIndex();
|
|
|
|
_getSellerTableClass();
|
|
|
|
}
|
|
|
|
},
|
|
|
|
availableGestures: AvailableGestures.none,
|
|
|
|
events: _events,
|
|
|
|
locale: "zh_CN",
|
|
|
|
initialCalendarFormat:
|
|
|
|
CalendarFormat.twoWeeks,
|
|
|
|
headerStyle: HeaderStyle(
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
color: MyColours.color_F9F9F9),
|
|
|
|
headerPadding: EdgeInsets.zero,
|
|
|
|
formatButtonVisible: false,
|
|
|
|
centerHeaderTitle: true,
|
|
|
|
titleTextBuilder: (dateTime, _) {
|
|
|
|
return dateTime.year.toString() +
|
|
|
|
"年-" +
|
|
|
|
Utils.addZeroNumber(dateTime.month) +
|
|
|
|
"月";
|
|
|
|
},
|
|
|
|
titleTextStyle: TextStyle(
|
|
|
|
color: MyColours.color_333333,
|
|
|
|
fontSize: ScreenUtil().setSp(32)),
|
|
|
|
// leftChevronIcon: Image(
|
|
|
|
// image: AssetImage(
|
|
|
|
// Utils.getImgPath('left_arrow')),
|
|
|
|
// alignment: Alignment.center,
|
|
|
|
// ),
|
|
|
|
// rightChevronIcon: const Icon(
|
|
|
|
// Icons.keyboard_arrow_right,
|
|
|
|
// color: MyColours.font_color_333333),
|
|
|
|
),
|
|
|
|
calendarStyle: CalendarStyle(
|
|
|
|
contentPadding:
|
|
|
|
const EdgeInsets.only(bottom: 4.0),
|
|
|
|
weekdayStyle: TextStyle(
|
|
|
|
color: MyColours.color_333333,
|
|
|
|
fontSize: ScreenUtil().setSp(32)),
|
|
|
|
weekendStyle: TextStyle(
|
|
|
|
color: MyColours.color_199095,
|
|
|
|
fontSize: ScreenUtil().setSp(32)),
|
|
|
|
selectedColor: MyColours.color_199095,
|
|
|
|
),
|
|
|
|
builders: CalendarBuilders(
|
|
|
|
dayBuilder: (context, dateTime, events) {
|
|
|
|
return Container(
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
shape: BoxShape.circle,
|
|
|
|
),
|
|
|
|
alignment: Alignment.center,
|
|
|
|
margin: const EdgeInsets.all(6.0),
|
|
|
|
padding: const EdgeInsets.only(
|
|
|
|
bottom: 4.0,
|
|
|
|
left: 8.0,
|
|
|
|
right: 8.0,
|
|
|
|
top: 4.0),
|
|
|
|
child: Text(
|
|
|
|
"${_parseDateDay(dateTime)}",
|
|
|
|
style: TextStyle().copyWith(
|
|
|
|
fontSize: ScreenUtil().setSp(32),
|
|
|
|
color: MyColours.color_333333,
|
|
|
|
fontWeight: FontWeight.bold),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
},
|
|
|
|
unavailableDayBuilder:
|
|
|
|
(context, dateTime, events) {
|
|
|
|
return Container(
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
shape: BoxShape.circle,
|
|
|
|
),
|
|
|
|
alignment: Alignment.center,
|
|
|
|
margin: const EdgeInsets.all(6.0),
|
|
|
|
padding: const EdgeInsets.only(
|
|
|
|
bottom: 4.0,
|
|
|
|
left: 8.0,
|
|
|
|
right: 8.0,
|
|
|
|
top: 4.0),
|
|
|
|
child: Text(
|
|
|
|
"${_parseDateDay(dateTime)}",
|
|
|
|
style: TextStyle().copyWith(
|
|
|
|
fontSize: ScreenUtil().setSp(32),
|
|
|
|
color: MyColours.color_999999),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
},
|
|
|
|
dowWeekdayBuilder: (context, weekday) {
|
|
|
|
return Container(
|
|
|
|
color: MyColours.color_F9F9F9,
|
|
|
|
alignment: Alignment.center,
|
|
|
|
padding: EdgeInsets.symmetric(
|
|
|
|
vertical:
|
|
|
|
ScreenUtil().setHeight(25)),
|
|
|
|
child: Text(
|
|
|
|
weekday,
|
|
|
|
style: TextStyle(
|
|
|
|
color: (MyColours.color_999999),
|
|
|
|
fontSize: ScreenUtil().setSp(32)),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
},
|
|
|
|
selectedDayBuilder: (context, date, _) {
|
|
|
|
return Container(
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
shape: BoxShape.circle,
|
|
|
|
gradient: LinearGradient(
|
|
|
|
colors: [
|
|
|
|
MyColours.color_24A4A8,
|
|
|
|
MyColours.color_199095
|
|
|
|
],
|
|
|
|
begin: Alignment.topCenter,
|
|
|
|
end: Alignment.bottomCenter),
|
|
|
|
// border: Border.all(color: MyColours.color_FFB116)
|
|
|
|
),
|
|
|
|
alignment: Alignment.center,
|
|
|
|
margin: const EdgeInsets.all(6.0),
|
|
|
|
padding: const EdgeInsets.only(
|
|
|
|
bottom: 4.0,
|
|
|
|
left: 8.0,
|
|
|
|
right: 8.0,
|
|
|
|
top: 4.0),
|
|
|
|
child: Text(
|
|
|
|
"${_parseDateDay(date)}",
|
|
|
|
style: TextStyle().copyWith(
|
|
|
|
fontSize: ScreenUtil().setSp(32),
|
|
|
|
color: MyColours.color_ffffff,
|
|
|
|
fontWeight: FontWeight.bold),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
},
|
|
|
|
todayDayBuilder: (context, date, _) {
|
|
|
|
return Container(
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
shape: BoxShape.circle,
|
|
|
|
border: Border.all(
|
|
|
|
color: MyColours.color_199095,
|
|
|
|
width: 1)),
|
|
|
|
alignment: Alignment.center,
|
|
|
|
margin: const EdgeInsets.all(6.0),
|
|
|
|
padding: const EdgeInsets.only(
|
|
|
|
bottom: 4.0,
|
|
|
|
left: 8.0,
|
|
|
|
right: 8.0,
|
|
|
|
top: 4.0),
|
|
|
|
child: Text(
|
|
|
|
'今',
|
|
|
|
style: TextStyle().copyWith(
|
|
|
|
fontSize: ScreenUtil().setSp(32),
|
|
|
|
color: MyColours.color_199095,
|
|
|
|
fontWeight: FontWeight.bold),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
},
|
|
|
|
singleMarkerBuilder:
|
|
|
|
(context, dateTime, event) {
|
|
|
|
return Container(
|
|
|
|
width: ScreenUtil().setWidth(6),
|
|
|
|
height: ScreenUtil().setWidth(6),
|
|
|
|
margin: const EdgeInsets.symmetric(
|
|
|
|
horizontal: 0.3),
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
shape: BoxShape.circle,
|
|
|
|
color: MyColours.color_ff0000,
|
|
|
|
),
|
|
|
|
);
|
|
|
|
},
|
|
|
|
))),
|
|
|
|
_buildShiduan(),
|
|
|
|
Offstage(
|
|
|
|
offstage: enableIndex > 2,
|
|
|
|
child: Container(
|
|
|
|
width: double.infinity,
|
|
|
|
padding: EdgeInsets.only(
|
|
|
|
left: ScreenUtil().setWidth(30),
|
|
|
|
top: ScreenUtil().setWidth(48),
|
|
|
|
right: ScreenUtil().setWidth(30)),
|
|
|
|
child: Column(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: <Widget>[
|
|
|
|
Container(
|
|
|
|
height: ScreenUtil().setWidth(82),
|
|
|
|
child: Row(
|
|
|
|
crossAxisAlignment:
|
|
|
|
CrossAxisAlignment.end,
|
|
|
|
children: <Widget>[
|
|
|
|
Text(
|
|
|
|
"选择包间",
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: ScreenUtil().setSp(36),
|
|
|
|
color: MyColours.color_333333,
|
|
|
|
fontWeight: FontWeight.bold),
|
|
|
|
),
|
|
|
|
HEmptyView(24),
|
|
|
|
Wrap(
|
|
|
|
children: _buildSelectRooms(),
|
|
|
|
)
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
VEmptyView(30),
|
|
|
|
Selector<StoreDetailModel,
|
|
|
|
List<SellerTableClassEntity>>(
|
|
|
|
shouldRebuild: (pre, next) => true,
|
|
|
|
selector: (context, model) => model.tables,
|
|
|
|
builder: (context, tables, child) {
|
|
|
|
return GridView.builder(
|
|
|
|
gridDelegate:
|
|
|
|
SliverGridDelegateWithFixedCrossAxisCount(
|
|
|
|
crossAxisCount: 2,
|
|
|
|
mainAxisSpacing:
|
|
|
|
ScreenUtil().setWidth(20),
|
|
|
|
crossAxisSpacing:
|
|
|
|
ScreenUtil().setWidth(30),
|
|
|
|
childAspectRatio: 2.4),
|
|
|
|
itemBuilder: (context, index) {
|
|
|
|
return GestureDetector(
|
|
|
|
onTap: () {
|
|
|
|
if (tables[index]
|
|
|
|
.status
|
|
|
|
.toString() ==
|
|
|
|
"0") return;
|
|
|
|
if ((tables[index]
|
|
|
|
.status
|
|
|
|
.toString() ==
|
|
|
|
"1" &&
|
|
|
|
((tables[index].isFull !=
|
|
|
|
null &&
|
|
|
|
tables[index]
|
|
|
|
.isFull
|
|
|
|
.toString() ==
|
|
|
|
"1") ||
|
|
|
|
(tables[index]
|
|
|
|
.isorderFull !=
|
|
|
|
null &&
|
|
|
|
tables[index]
|
|
|
|
.isorderFull
|
|
|
|
.toString() ==
|
|
|
|
"1")))) return;
|
|
|
|
int selectNum = 0;
|
|
|
|
roomNum.forEach((index, value) {
|
|
|
|
selectNum += value;
|
|
|
|
});
|
|
|
|
if (selectNum >= 3) {
|
|
|
|
Utils.showToast("最多可选3个包间");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
setState(() {
|
|
|
|
roomNum[index]++;
|
|
|
|
rooms.add(index);
|
|
|
|
});
|
|
|
|
},
|
|
|
|
child: Stack(
|
|
|
|
children: <Widget>[
|
|
|
|
Container(
|
|
|
|
height: ScreenUtil()
|
|
|
|
.setWidth(140),
|
|
|
|
padding: EdgeInsets.only(
|
|
|
|
left: ScreenUtil()
|
|
|
|
.setWidth(30)),
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
color: tables[index]
|
|
|
|
.status
|
|
|
|
.toString() ==
|
|
|
|
"1"
|
|
|
|
? MyColours.color_ffffff
|
|
|
|
: MyColours
|
|
|
|
.color_f5f5f5,
|
|
|
|
borderRadius:
|
|
|
|
BorderRadius.circular(
|
|
|
|
ScreenUtil()
|
|
|
|
.setWidth(10)),
|
|
|
|
border: Border.all(
|
|
|
|
color: roomNum[index] >
|
|
|
|
0
|
|
|
|
? MyColours
|
|
|
|
.color_199095
|
|
|
|
: MyColours
|
|
|
|
.color_cccccc,
|
|
|
|
width: ScreenUtil()
|
|
|
|
.setWidth(2)),
|
|
|
|
),
|
|
|
|
alignment:
|
|
|
|
Alignment.centerLeft,
|
|
|
|
child: Column(
|
|
|
|
mainAxisSize:
|
|
|
|
MainAxisSize.min,
|
|
|
|
mainAxisAlignment:
|
|
|
|
MainAxisAlignment
|
|
|
|
.center,
|
|
|
|
crossAxisAlignment:
|
|
|
|
CrossAxisAlignment
|
|
|
|
.start,
|
|
|
|
children: <Widget>[
|
|
|
|
Text("${tables[index].name}",
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize:
|
|
|
|
ScreenUtil()
|
|
|
|
.setSp(
|
|
|
|
30),
|
|
|
|
color: MyColours
|
|
|
|
.color_333333,
|
|
|
|
fontWeight:
|
|
|
|
FontWeight
|
|
|
|
.normal)),
|
|
|
|
int.parse(tables[index]
|
|
|
|
.max ??
|
|
|
|
"0") >
|
|
|
|
0
|
|
|
|
? Text(
|
|
|
|
"最多可坐${tables[index].max}人",
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize:
|
|
|
|
ScreenUtil()
|
|
|
|
.setSp(
|
|
|
|
24),
|
|
|
|
color: MyColours
|
|
|
|
.color_333333,
|
|
|
|
fontWeight:
|
|
|
|
FontWeight
|
|
|
|
.normal),
|
|
|
|
)
|
|
|
|
: Container(),
|
|
|
|
int.parse(tables[index]
|
|
|
|
.low ??
|
|
|
|
"0") >
|
|
|
|
0
|
|
|
|
? Text(
|
|
|
|
"最低消费${tables[index].low}元",
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize:
|
|
|
|
ScreenUtil()
|
|
|
|
.setSp(
|
|
|
|
20),
|
|
|
|
color: MyColours
|
|
|
|
.color_999999,
|
|
|
|
fontWeight:
|
|
|
|
FontWeight
|
|
|
|
.normal),
|
|
|
|
)
|
|
|
|
: Container()
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Positioned(
|
|
|
|
right: 0,
|
|
|
|
top: 0,
|
|
|
|
child: roomNum[index] > 0
|
|
|
|
? Container(
|
|
|
|
width: ScreenUtil()
|
|
|
|
.setWidth(92),
|
|
|
|
height: ScreenUtil()
|
|
|
|
.setWidth(40),
|
|
|
|
alignment:
|
|
|
|
Alignment.center,
|
|
|
|
decoration:
|
|
|
|
BoxDecoration(
|
|
|
|
color: MyColours
|
|
|
|
.color_F4FAFF,
|
|
|
|
border: Border.all(
|
|
|
|
color: MyColours
|
|
|
|
.color_199095,
|
|
|
|
width:
|
|
|
|
ScreenUtil()
|
|
|
|
.setWidth(
|
|
|
|
2)),
|
|
|
|
borderRadius: BorderRadius.only(
|
|
|
|
topRight: Radius.circular(
|
|
|
|
ScreenUtil()
|
|
|
|
.setWidth(
|
|
|
|
10)),
|
|
|
|
bottomLeft: Radius.circular(
|
|
|
|
ScreenUtil()
|
|
|
|
.setWidth(
|
|
|
|
10))),
|
|
|
|
),
|
|
|
|
child: Text(
|
|
|
|
"已选${roomNum[index]}",
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize:
|
|
|
|
ScreenUtil()
|
|
|
|
.setSp(
|
|
|
|
24),
|
|
|
|
color: MyColours
|
|
|
|
.color_199095),
|
|
|
|
),
|
|
|
|
)
|
|
|
|
: Container(),
|
|
|
|
),
|
|
|
|
(tables[index]
|
|
|
|
.status
|
|
|
|
.toString() ==
|
|
|
|
"1" &&
|
|
|
|
((tables[index].isFull !=
|
|
|
|
null &&
|
|
|
|
tables[index]
|
|
|
|
.isFull
|
|
|
|
.toString() ==
|
|
|
|
"1") ||
|
|
|
|
(tables[index]
|
|
|
|
.isorderFull !=
|
|
|
|
null &&
|
|
|
|
tables[index]
|
|
|
|
.isorderFull
|
|
|
|
.toString() ==
|
|
|
|
"1")))
|
|
|
|
? Positioned(
|
|
|
|
right: 0,
|
|
|
|
bottom: 0,
|
|
|
|
child: Container(
|
|
|
|
width: ScreenUtil()
|
|
|
|
.setWidth(90),
|
|
|
|
height: ScreenUtil()
|
|
|
|
.setWidth(76),
|
|
|
|
child: Container(
|
|
|
|
child: Text(
|
|
|
|
"订满",
|
|
|
|
style: TextStyle(
|
|
|
|
color: MyColours
|
|
|
|
.color_999999,
|
|
|
|
fontSize:
|
|
|
|
ScreenUtil()
|
|
|
|
.setSp(
|
|
|
|
24)),
|
|
|
|
),
|
|
|
|
margin: EdgeInsets.only(
|
|
|
|
left: ScreenUtil()
|
|
|
|
.setWidth(
|
|
|
|
28),
|
|
|
|
top: ScreenUtil()
|
|
|
|
.setWidth(
|
|
|
|
28)),
|
|
|
|
),
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
image: DecorationImage(
|
|
|
|
image: AssetImage(
|
|
|
|
"assets/icon_man.png"),
|
|
|
|
fit: BoxFit
|
|
|
|
.cover)),
|
|
|
|
),
|
|
|
|
)
|
|
|
|
: Container()
|
|
|
|
],
|
|
|
|
),
|
|
|
|
);
|
|
|
|
},
|
|
|
|
itemCount: tables.length,
|
|
|
|
shrinkWrap: true,
|
|
|
|
physics:
|
|
|
|
new NeverScrollableScrollPhysics(),
|
|
|
|
);
|
|
|
|
},
|
|
|
|
)
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
)
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Offstage(
|
|
|
|
offstage: enableIndex > 2,
|
|
|
|
child: Container(
|
|
|
|
height: ScreenUtil().setWidth(116),
|
|
|
|
alignment: Alignment.center,
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
color: MyColours.color_ffffff,
|
|
|
|
boxShadow: [
|
|
|
|
BoxShadow(
|
|
|
|
color: MyColours.color_EEF0F2,
|
|
|
|
blurRadius: ScreenUtil().setWidth(8))
|
|
|
|
]),
|
|
|
|
child: GestureDetector(
|
|
|
|
onTap: () {
|
|
|
|
if (rooms.length <= 0) {
|
|
|
|
Utils.showToast("请选择包间");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
},
|
|
|
|
child: Container(
|
|
|
|
width: ScreenUtil().setWidth(670),
|
|
|
|
height: ScreenUtil().setWidth(84),
|
|
|
|
decoration: rooms.length > 0
|
|
|
|
? BoxDecoration(
|
|
|
|
gradient: LinearGradient(colors: [
|
|
|
|
MyColours.color_2bb5b7,
|
|
|
|
MyColours.color_199095
|
|
|
|
]),
|
|
|
|
borderRadius: BorderRadius.circular(
|
|
|
|
ScreenUtil().setWidth(44)),
|
|
|
|
)
|
|
|
|
: BoxDecoration(
|
|
|
|
color: MyColours.color_cccccc,
|
|
|
|
borderRadius: BorderRadius.circular(
|
|
|
|
ScreenUtil().setWidth(44)),
|
|
|
|
),
|
|
|
|
alignment: Alignment.center,
|
|
|
|
child: Text(
|
|
|
|
"选好了",
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: ScreenUtil().setSp(36),
|
|
|
|
color: MyColours.color_ffffff,
|
|
|
|
fontWeight: FontWeight.bold),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
)
|
|
|
|
],
|
|
|
|
));
|
|
|
|
return widget;
|
|
|
|
},
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
} |
...
|
...
|
|