Commit 7397c3eabe5c93d32c9e350b151ac1f2c9a6e91d

Authored by wdn127929
1 parent 1d07d5c6

区域

... ... @@ -49,11 +49,11 @@ class AreaItemTableState extends State<AreaItemTable> {
vertical: ScreenUtil().setWidth(10)),
alignment: Alignment.center,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(ScreenUtil().setWidth(10)),
// borderRadius: BorderRadius.circular(ScreenUtil().setWidth(10)),
color:
isSelected ? MyColours.color_199095 : MyColours.color_ffffff,
border: Border.all(
color: MyColours.color_199095,
color: MyColours.color_E0E0E0,
width: ScreenUtil().setWidth(2))),
child: Text(
area.name,
... ... @@ -61,7 +61,7 @@ class AreaItemTableState extends State<AreaItemTable> {
style: TextStyle(
color: isSelected
? MyColours.color_ffffff
: MyColours.color_199095,
: MyColours.color_333333,
fontSize: ScreenUtil().setSp(28),
decoration: TextDecoration.none,
fontWeight: FontWeight.normal),
... ... @@ -70,22 +70,26 @@ class AreaItemTableState extends State<AreaItemTable> {
area.count == -1
? Container()
: Positioned(
left: 0,
top: 0,
right: ScreenUtil().setWidth(12),
top: ScreenUtil().setWidth(6),
child: Container(
width: ScreenUtil().setWidth(78),
height: ScreenUtil().setWidth(30),
padding: EdgeInsets.symmetric(
vertical: ScreenUtil().setWidth(6),
horizontal: ScreenUtil().setWidth(4)),
// width: ScreenUtil().setWidth(78),
// height: ScreenUtil().setWidth(30),
alignment: Alignment.center,
decoration: BoxDecoration(
color: area.count <= 0
? MyColours.color_999999
: MyColours.color_63a6d1,
borderRadius: BorderRadius.only(
topLeft: Radius.circular(ScreenUtil().setWidth(10)),
topRight: Radius.circular(ScreenUtil().setWidth(15)),
bottomRight:
Radius.circular(ScreenUtil().setWidth(15)))),
child: Text(area.count == 0 ? "满座" : "余${area.count}",
color: area.count <= 0
? MyColours.color_999999
: MyColours.color_199095,
// borderRadius: BorderRadius.only(
// topLeft: Radius.circular(ScreenUtil().setWidth(10)),
// topRight: Radius.circular(ScreenUtil().setWidth(15)),
// bottomRight:
// Radius.circular(ScreenUtil().setWidth(15)))
),
child: Text(area.count == 0 ? "满座" : "${area.count}",
style: TextStyle(
color: MyColours.color_ffffff,
fontSize: ScreenUtil().setSp(26),
... ...
... ... @@ -339,318 +339,331 @@ class TableManagerPageState extends State<TableManagerPage> {
@override
Widget build(BuildContext context) {
return Consumer<TableManagerModel>(
builder: (context, model, child) {
int sum = 3;
int hide = 0;
int btnNum = 0;
if (tableManagerModel.morning == "00:00-00:00") {
hide++;
}
if (tableManagerModel.noon == "00:00-00:00") {
hide++;
}
if (tableManagerModel.night == "00:00-00:00") {
hide++;
}
btnNum = sum - hide;
return Column(
children: <Widget>[
SystemAppBar("桌位", showLeading: false),
Container(
color: MyColours.color_ffffff,
padding:
EdgeInsets.symmetric(horizontal: ScreenUtil().setWidth(15)),
child: Row(
children: <Widget>[
Expanded(
child: GestureDetector(
onTap: () {
DialogUtil.showCalendarDialog(
context, tableManagerModel.dateTime)
.then((day) {
if (day != null) {
tableManagerModel.createDateText(context, day);
}
});
},
child: Container(
// height: ScreenUtil().setWidth(80),
padding: EdgeInsets.symmetric(
horizontal: ScreenUtil().setWidth(15),
vertical: ScreenUtil().setWidth(20)),
return Scaffold(
appBar: SystemAppBar("桌位", showLeading: false),
body: Consumer<TableManagerModel>(
builder: (context, model, child) {
int sum = 3;
int hide = 0;
int btnNum = 0;
if (tableManagerModel.morning == "00:00-00:00") {
hide++;
}
if (tableManagerModel.noon == "00:00-00:00") {
hide++;
}
if (tableManagerModel.night == "00:00-00:00") {
hide++;
}
btnNum = sum - hide;
return Column(
children: <Widget>[
Container(
color: MyColours.color_ffffff,
padding: EdgeInsets.symmetric(
horizontal: ScreenUtil().setWidth(15)),
child: Row(
children: <Widget>[
Expanded(
child: GestureDetector(
onTap: () {
DialogUtil.showCalendarDialog(
context, tableManagerModel.dateTime)
.then((day) {
if (day != null) {
tableManagerModel.createDateText(context, day);
}
});
},
child: Container(
// height: ScreenUtil().setWidth(80),
padding: EdgeInsets.symmetric(
horizontal: ScreenUtil().setWidth(15),
vertical: ScreenUtil().setWidth(20)),
decoration: BoxDecoration(
color: MyColours.color_199095,
borderRadius: BorderRadius.circular(
ScreenUtil().setWidth(20))),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Expanded(
child: Text(
tableManagerModel.dateText,
textAlign: TextAlign.center,
style: TextStyle(
color: MyColours.color_ffffff,
fontSize: ScreenUtil().setSp(28)),
)),
HEmptyView(10),
Image.asset(
Utils.getImgPath('f_arrow_right'),
width: ScreenUtil().setWidth(25),
// height: ScreenUtil().setWidth(10),
)
],
)),
)),
// MyDivider(
// ScreenUtil().setWidth(2),
// ScreenUtil().setHeight(68),
// color: MyColours.color_E0E0E0,
// ),
HEmptyView(20),
Container(
width: ScreenUtil().setWidth(206),
height: ScreenUtil().setWidth(74),
decoration: BoxDecoration(
color: MyColours.color_199095,
color: Color.fromRGBO(232, 232, 232, 1),
borderRadius: BorderRadius.circular(
ScreenUtil().setWidth(20))),
child: Row(
children: [
Expanded(
child: Text(
tableManagerModel.dateText,
style: TextStyle(
color: MyColours.color_ffffff,
fontSize: ScreenUtil().setSp(28)),
ScreenUtil().setWidth(20),
)),
HEmptyView(10),
Image.asset(
Utils.getImgPath('f_arrow_right'),
width: ScreenUtil().setWidth(25),
// height: ScreenUtil().setWidth(10),
)
],
)),
)),
// MyDivider(
// ScreenUtil().setWidth(2),
// ScreenUtil().setHeight(68),
// color: MyColours.color_E0E0E0,
// ),
HEmptyView(20),
Container(
width: ScreenUtil().setWidth(206),
height: ScreenUtil().setWidth(74),
decoration: BoxDecoration(
color: Color.fromRGBO(232, 232, 232, 1),
borderRadius: BorderRadius.circular(
ScreenUtil().setWidth(20),
)),
child: Row(
// mainAxisAlignment: MainAxisAlignment.spaceEvenly,
// crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Offstage(
offstage: tableManagerModel.morning == "00:00-00:00"
? true
: false,
child: CommonButtonFlat(
content: "早市",
state:
tableManagerModel.currTimeIndex == 1 ? 1 : 0,
fontSize: 28,
right: tableManagerModel.noon == "00:00-00:00" &&
child: Row(
// mainAxisAlignment: MainAxisAlignment.spaceEvenly,
// crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Offstage(
offstage:
tableManagerModel.morning == "00:00-00:00"
? true
: false,
child: CommonButtonFlat(
content: "早餐",
state: tableManagerModel.currTimeIndex == 1
? 1
: 0,
fontSize: 28,
right:
tableManagerModel.noon == "00:00-00:00" &&
tableManagerModel.night ==
"00:00-00:00"
? true
: false,
width: ScreenUtil().setWidth(200) / btnNum,
onPress: () {
if (tableManagerModel.currTimeIndex == 1)
return;
tableManagerModel.currTimeIndex = 1;
tableManagerModel.getReserveList(context);
},
)),
btnNum == 3 && tableManagerModel.currTimeIndex == 3
? MyDivider(
ScreenUtil().setWidth(4),
ScreenUtil().setWidth(46),
color: MyColours.color_dfdfdf,
)
: SizedBox(),
Offstage(
offstage:
tableManagerModel.noon == "00:00-00:00"
? true
: false,
child: CommonButtonFlat(
content: "午餐",
state: tableManagerModel.currTimeIndex == 2
? 1
: 0,
fontSize: 28,
width: ScreenUtil().setWidth(200) / btnNum,
left:
tableManagerModel.morning == "00:00-00:00"
? true
: false,
right:
tableManagerModel.night == "00:00-00:00"
? true
: false,
onPress: () {
if (tableManagerModel.currTimeIndex == 2)
return;
tableManagerModel.currTimeIndex = 2;
tableManagerModel.getReserveList(context);
},
)),
btnNum == 3 && tableManagerModel.currTimeIndex == 1
? MyDivider(
ScreenUtil().setWidth(4),
ScreenUtil().setWidth(46),
color: MyColours.color_dfdfdf,
)
: SizedBox(),
Offstage(
offstage: tableManagerModel.night == "00:00-00:00"
? true
: false,
width: ScreenUtil().setWidth(200) / btnNum,
onPress: () {
if (tableManagerModel.currTimeIndex == 1)
return;
tableManagerModel.currTimeIndex = 1;
tableManagerModel.getReserveList(context);
},
)),
btnNum == 3 && tableManagerModel.currTimeIndex == 3
? MyDivider(
ScreenUtil().setWidth(4),
ScreenUtil().setWidth(46),
color: MyColours.color_dfdfdf,
)
: SizedBox(),
Offstage(
offstage: tableManagerModel.noon == "00:00-00:00"
? true
: false,
child: CommonButtonFlat(
content: "午市",
state:
tableManagerModel.currTimeIndex == 2 ? 1 : 0,
fontSize: 28,
width: ScreenUtil().setWidth(200) / btnNum,
left: tableManagerModel.morning == "00:00-00:00"
? true
: false,
right: tableManagerModel.night == "00:00-00:00"
? true
: false,
onPress: () {
if (tableManagerModel.currTimeIndex == 2)
return;
tableManagerModel.currTimeIndex = 2;
tableManagerModel.getReserveList(context);
},
)),
btnNum == 3 && tableManagerModel.currTimeIndex == 1
? MyDivider(
ScreenUtil().setWidth(4),
ScreenUtil().setWidth(46),
color: MyColours.color_dfdfdf,
)
: SizedBox(),
Offstage(
offstage: tableManagerModel.night == "00:00-00:00"
? true
: false,
child: Container(
child: CommonButtonFlat(
content: "晚市",
left: tableManagerModel.morning == "00:00-00:00" &&
tableManagerModel.noon == "00:00-00:00"
? true
: false,
state: tableManagerModel.currTimeIndex == 3 ? 1 : 0,
fontSize: 28,
width: ScreenUtil().setWidth(200) / btnNum,
onPress: () {
if (tableManagerModel.currTimeIndex == 3) return;
tableManagerModel.currTimeIndex = 3;
tableManagerModel.getReserveList(context);
},
)),
child: Container(
child: CommonButtonFlat(
content: "晚餐",
left: tableManagerModel.morning ==
"00:00-00:00" &&
tableManagerModel.noon == "00:00-00:00"
? true
: false,
state: tableManagerModel.currTimeIndex == 3
? 1
: 0,
fontSize: 28,
width: ScreenUtil().setWidth(200) / btnNum,
onPress: () {
if (tableManagerModel.currTimeIndex == 3)
return;
tableManagerModel.currTimeIndex = 3;
tableManagerModel.getReserveList(context);
},
)),
),
],
),
],
),
),
],
),
],
),
),
Expanded(
child: Consumer<TableManagerModel>(
builder: (context, model, child) {
if (model.pageState != PageState.Success) {
return ExceptionPage(
pageState: model.pageState,
callback: () {
if (tableManagerModel.tableOuterList.isEmpty) {
tableManagerModel.getTableList(context);
} else {
tableManagerModel.getReserveList(context);
}
},
emptyMsg: "暂时没有桌位哦",
emptyImg: "empty_search",
showMsg: "加载中,请稍后...",
);
} else {
return CCMenuPage.builder(
tableManagerModel: tableManagerModel,
itemCount: tableManagerModel.areas.length,
onTap: (index) async {
// //添加区域弹框
// await DialogUtil.openCreateAreaDialog(context,
// onTap: (value) async {
// print(value);
// //添加区域
// bool success = await tableManagerModel.addTableAreas(
// context, value);
// print(success);
// if (success) {
// Utils.showToast('添加成功!');
// await tableManagerModel.getTableList(context,
// needLoading: false);
// tableManagerModel.initData();
// setState(() {});
// Timer(
// Duration(milliseconds: 500),
// () => _areaController.jumpTo(
// _areaController.position.maxScrollExtent));
// }
// });
},
tabBuilder: (BuildContext context, int index) {
if (index == tableManagerModel.areas.length ||
tableManagerModel.areas.length == 0) {
// return InkWell(
// onTap: () async {
// //添加区域弹框
// await DialogUtil.openCreateAreaDialog(context,
// onTap: (value) async {
// print(value);
// //添加区域
// bool success = await tableManagerModel
// .addTableAreas(context, value);
// print(success);
// if (success) {
// Utils.showToast('添加成功!');
// // TableOuter tableOuter =
// // TableOuter();
// // tableOuter.name = value;
// // tableOuter.list = [];
// // tableManagerModel.tableOuterList
// // .add(tableOuter);
// await tableManagerModel.getTableList(
// context,
// needLoading: false);
// tableManagerModel.initData();
// Timer(
// Duration(milliseconds: 500),
// () => _areaController.jumpTo(
// _areaController
// .position.maxScrollExtent));
// // await tableManagerModel
// // .getTableList(context);
// // await tableManagerModel
// // .initData();
// }
// });
// },
return Column(
children: [
VEmptyView(20),
DottedBorder(
dashPattern: [5, 5, 5, 5],
borderType: BorderType.RRect,
radius:
Radius.circular(ScreenUtil().setWidth(10)),
// padding: EdgeInsets.all(ScreenUtil().setWidth(70)),
color: MyColours.color_199095,
strokeWidth: ScreenUtil().setWidth(2),
child: ClipRRect(
borderRadius: BorderRadius.all(
Radius.circular(
ScreenUtil().setWidth(10))),
child: Container(
height: ScreenUtil().setWidth(25 * 2),
width: ScreenUtil().setWidth(104 * 2),
child: Column(
mainAxisAlignment:
MainAxisAlignment.center,
children: [
Image.asset(
Utils.getImgPath('add_area'),
width: ScreenUtil().setWidth(24)),
],
),
),
),
)
],
);
} else {
return AreaItemTable(
model.areas[index], tableManagerModel.currentArea,
(area) {
// isTap = true;
// _selectIndex = index;
// // scrollTo(index);
// tableManagerModel.currentArea =
// tableManagerModel.areas[index].name;
// tableManagerModel.currentTables =
// tableManagerModel.areaTableMap[
// tableManagerModel.currentArea];
});
}
},
itemBuilder: (BuildContext context, int index) {
return item(index);
},
);
}
},
),
),
],
);
},
);
),
VEmptyView(40),
Consumer<TableManagerModel>(
builder: (context, model, child) {
if (model.pageState != PageState.Success) {
return Expanded(
child: ExceptionPage(
pageState: model.pageState,
callback: () {
if (tableManagerModel.tableOuterList.isEmpty) {
tableManagerModel.getTableList(context);
} else {
tableManagerModel.getReserveList(context);
}
},
emptyMsg: "暂时没有桌位哦",
emptyImg: "empty_search",
showMsg: "加载中,请稍后...",
));
} else {
return Column(
children: [
Container(
height: ScreenUtil().setWidth(100),
child: Row(
children: [
Expanded(
child: ListView.builder(
itemCount: tableManagerModel.areas.length + 1,
shrinkWrap: true,
scrollDirection: Axis.horizontal,
itemBuilder:
(BuildContext contxt, int index) {
if (index ==
tableManagerModel.areas.length ||
tableManagerModel.areas.length == 0) {
return Column(
children: [
VEmptyView(20),
DottedBorder(
dashPattern: [5, 5, 5, 5],
borderType: BorderType.RRect,
radius: Radius.circular(
ScreenUtil().setWidth(10)),
// padding: EdgeInsets.all(ScreenUtil().setWidth(70)),
color: MyColours.color_199095,
strokeWidth:
ScreenUtil().setWidth(2),
child: ClipRRect(
borderRadius: BorderRadius.all(
Radius.circular(ScreenUtil()
.setWidth(10))),
child: Container(
height: ScreenUtil()
.setWidth(25 * 2),
width: ScreenUtil()
.setWidth(104 * 2),
child: Column(
mainAxisAlignment:
MainAxisAlignment.center,
children: [
Image.asset(
Utils.getImgPath(
'add_area'),
width: ScreenUtil()
.setWidth(24)),
],
),
),
),
)
],
);
} else {
return AreaItemTable(
model.areas[index],
tableManagerModel.currentArea,
(area) {});
}
},
)),
HEmptyView(40),
MyDivider(ScreenUtil().setWidth(2),
ScreenUtil().setWidth(40),
color: MyColours.color_F1F0F4),
],
),
)
],
);
// return CCMenuPage.builder(
// tableManagerModel: tableManagerModel,
// itemCount: tableManagerModel.areas.length,
// onTap: (index) async {},
// tabBuilder: (BuildContext context, int index) {
// if (index == tableManagerModel.areas.length ||
// tableManagerModel.areas.length == 0) {
// return Column(
// children: [
// VEmptyView(20),
// DottedBorder(
// dashPattern: [5, 5, 5, 5],
// borderType: BorderType.RRect,
// radius:
// Radius.circular(ScreenUtil().setWidth(10)),
// // padding: EdgeInsets.all(ScreenUtil().setWidth(70)),
// color: MyColours.color_199095,
// strokeWidth: ScreenUtil().setWidth(2),
// child: ClipRRect(
// borderRadius: BorderRadius.all(
// Radius.circular(
// ScreenUtil().setWidth(10))),
// child: Container(
// height: ScreenUtil().setWidth(25 * 2),
// width: ScreenUtil().setWidth(104 * 2),
// child: Column(
// mainAxisAlignment:
// MainAxisAlignment.center,
// children: [
// Image.asset(
// Utils.getImgPath('add_area'),
// width: ScreenUtil().setWidth(24)),
// ],
// ),
// ),
// ),
// )
// ],
// );
// } else {
// return AreaItemTable(model.areas[index],
// tableManagerModel.currentArea, (area) {});
// }
// },
// itemBuilder: (BuildContext context, int index) {
// return item(index);
// },
// );
}
},
),
],
);
},
));
}
@override
... ...