|
...
|
...
|
@@ -21,6 +21,7 @@ import 'package:one_key/widgets/app_bar.dart'; |
|
|
|
import 'package:one_key/widgets/area_item.dart';
|
|
|
|
import 'package:one_key/widgets/common_button.dart';
|
|
|
|
import 'package:one_key/widgets/common_button_flat.dart';
|
|
|
|
import 'package:one_key/widgets/f_table_item.dart';
|
|
|
|
import 'package:one_key/widgets/h_empty_view.dart';
|
|
|
|
import 'package:one_key/widgets/page_exception.dart';
|
|
|
|
import 'package:one_key/widgets/system_app_bar.dart';
|
|
...
|
...
|
@@ -51,6 +52,9 @@ class TableManagerPageState extends State<TableManagerPage> { |
|
|
|
int _selectIndex = 0;
|
|
|
|
ScrollController _areaController = ScrollController();
|
|
|
|
List<String> personNumList = [];
|
|
|
|
bool isSelected = true; //全部按钮
|
|
|
|
|
|
|
|
int _selectNumber;
|
|
|
|
|
|
|
|
final ItemPositionsListener itemPositionsListener =
|
|
|
|
ItemPositionsListener.create();
|
|
...
|
...
|
@@ -59,13 +63,14 @@ class TableManagerPageState extends State<TableManagerPage> { |
|
|
|
void initState() {
|
|
|
|
// TODO: implement initState
|
|
|
|
super.initState();
|
|
|
|
|
|
|
|
LogUtil.v("table_manager_page initState");
|
|
|
|
for (int i = 1; i < 31; i++) {
|
|
|
|
personNumList.add(i.toString());
|
|
|
|
}
|
|
|
|
|
|
|
|
// personNumList.add('30以上');
|
|
|
|
tableManagerModel = Provider.of<TableManagerModel>(context, listen: false);
|
|
|
|
|
|
|
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
|
|
|
tableManagerModel.initTime(context);
|
|
|
|
EventBus().on("refresh_tablemanager", (arg) {
|
|
...
|
...
|
@@ -121,225 +126,210 @@ class TableManagerPageState extends State<TableManagerPage> { |
|
|
|
|
|
|
|
/// Generate item number [i].
|
|
|
|
Widget item(int i) {
|
|
|
|
return SingleChildScrollView(
|
|
|
|
child: Column(
|
|
|
|
children: [
|
|
|
|
VEmptyView(40),
|
|
|
|
Container(
|
|
|
|
alignment: Alignment.center,
|
|
|
|
height: ScreenUtil().setWidth(21 * 2),
|
|
|
|
child: Text(tableManagerModel.areas[i].name,
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: ScreenUtil().setWidth(30),
|
|
|
|
color: MyColours.color_199095)),
|
|
|
|
),
|
|
|
|
VEmptyView(30),
|
|
|
|
GridView.builder(
|
|
|
|
// controller: _areaController,
|
|
|
|
physics: NeverScrollableScrollPhysics(),
|
|
|
|
padding: EdgeInsets.only(top: 0),
|
|
|
|
shrinkWrap: true,
|
|
|
|
itemCount: tableManagerModel
|
|
|
|
.areaTableMap[tableManagerModel.areas[i].name].length +
|
|
|
|
return GridView.builder(
|
|
|
|
// controller: _areaController,
|
|
|
|
// physics: NeverScrollableScrollPhysics(),
|
|
|
|
padding: EdgeInsets.symmetric(
|
|
|
|
vertical: ScreenUtil().setWidth(20),
|
|
|
|
horizontal: ScreenUtil().setWidth(10)),
|
|
|
|
shrinkWrap: true,
|
|
|
|
itemCount: tableManagerModel.currentArea == '全部'
|
|
|
|
? tableManagerModel.tablesShow.length
|
|
|
|
: tableManagerModel
|
|
|
|
.areaTableMapShow[tableManagerModel.areas[i].name].length +
|
|
|
|
1,
|
|
|
|
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
|
|
|
|
crossAxisCount: 4,
|
|
|
|
childAspectRatio: 8 / 9,
|
|
|
|
),
|
|
|
|
// mainAxisSpacing: ScreenUtil().setWidth(15 * 2),
|
|
|
|
// crossAxisSpacing: ScreenUtil().setWidth(38 * 2)),
|
|
|
|
itemBuilder: (BuildContext context, int index) {
|
|
|
|
if (index ==
|
|
|
|
tableManagerModel
|
|
|
|
.areaTableMap[tableManagerModel.areas[i].name].length ||
|
|
|
|
tableManagerModel
|
|
|
|
.areaTableMap[tableManagerModel.areas[i].name].length ==
|
|
|
|
0) {
|
|
|
|
return InkWell(
|
|
|
|
onTap: () async {
|
|
|
|
List<String> areas = [];
|
|
|
|
for (int i = 0; i < tableManagerModel.areas.length; i++) {
|
|
|
|
areas.add(tableManagerModel.areas[i].name);
|
|
|
|
}
|
|
|
|
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
|
|
|
|
crossAxisCount: 4,
|
|
|
|
childAspectRatio: 1,
|
|
|
|
mainAxisSpacing: ScreenUtil().setWidth(30),
|
|
|
|
crossAxisSpacing: ScreenUtil().setWidth(12),
|
|
|
|
),
|
|
|
|
|
|
|
|
//添加桌位弹框
|
|
|
|
await DialogUtil.openCreateTableDialog(
|
|
|
|
context, areas, i, personNumList,
|
|
|
|
onTap: (Map<String, String> value) async {
|
|
|
|
print(value);
|
|
|
|
// 'areaname':
|
|
|
|
// areas[currentAreaIndex],
|
|
|
|
// 'name': controller.text,
|
|
|
|
// 'pnumMin': pnumMin,
|
|
|
|
// 'pnumMax': pnumMax
|
|
|
|
//添加桌位 接口参数带整合???
|
|
|
|
// 以下是旧的不去,明天添加桌位接口
|
|
|
|
String rid;
|
|
|
|
for (Area item in tableManagerModel.areas) {
|
|
|
|
if (item.name == value['areaname']) {
|
|
|
|
rid = item.rid;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Map<String, String> params = {
|
|
|
|
'rid': rid,
|
|
|
|
'name': value['name'],
|
|
|
|
};
|
|
|
|
if (value['pnumMin'] != '') {
|
|
|
|
params['pnum'] = value['pnumMin'];
|
|
|
|
}
|
|
|
|
if (value['pnumMax'] != '') {
|
|
|
|
params['most_pnum'] = value['pnumMax'];
|
|
|
|
}
|
|
|
|
bool success =
|
|
|
|
await tableManagerModel.addTable(context, params);
|
|
|
|
print(success);
|
|
|
|
if (success) {
|
|
|
|
Utils.showToast('添加成功!');
|
|
|
|
// TableOuter tableOuter = TableOuter();
|
|
|
|
// tableOuter.name = value;
|
|
|
|
// tableOuter.list = [];
|
|
|
|
// tableManagerModel.tableOuterList.add(tableOuter);
|
|
|
|
// tableManagerModel.initData();
|
|
|
|
// Timer(
|
|
|
|
// Duration(milliseconds: 500),
|
|
|
|
// () => _areaController.jumpTo(
|
|
|
|
// _areaController.position.maxScrollExtent));
|
|
|
|
itemBuilder: (BuildContext context, int index) {
|
|
|
|
List<t.Table> data = tableManagerModel.currentArea == '全部'
|
|
|
|
? tableManagerModel.tablesShow
|
|
|
|
: tableManagerModel
|
|
|
|
.areaTableMapShow[tableManagerModel.areas[i].name];
|
|
|
|
if (index == data.length || data.length == 0) {
|
|
|
|
return InkWell(
|
|
|
|
onTap: () async {
|
|
|
|
List<String> areas = [];
|
|
|
|
for (int i = 0; i < tableManagerModel.areas.length; i++) {
|
|
|
|
areas.add(tableManagerModel.areas[i].name);
|
|
|
|
}
|
|
|
|
|
|
|
|
// await tableManagerModel
|
|
|
|
// .getTableList(context);
|
|
|
|
// await tableManagerModel
|
|
|
|
// .initData();
|
|
|
|
tableManagerModel.refreshTable(context);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
},
|
|
|
|
child: Container(
|
|
|
|
margin: EdgeInsets.all(ScreenUtil().setWidth(9)),
|
|
|
|
child: 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(90 * 2),
|
|
|
|
width: ScreenUtil().setWidth(80 * 2),
|
|
|
|
child: Column(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
children: [
|
|
|
|
Image.asset(Utils.getImgPath('add_area'),
|
|
|
|
width: ScreenUtil().setWidth(32)),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
)));
|
|
|
|
} else {
|
|
|
|
return Selector<TableManagerModel, t.Table>(
|
|
|
|
shouldRebuild: (pre, next) => true,
|
|
|
|
selector: (context, model) => tableManagerModel
|
|
|
|
.areaTableMap[tableManagerModel.areas[i].name][index],
|
|
|
|
builder: (context, table, _) {
|
|
|
|
return TableItem(table, onSelected: (table) {
|
|
|
|
if ((table as t.Table).selected) {
|
|
|
|
tableManagerModel.selectTables.add(table);
|
|
|
|
} else {
|
|
|
|
tableManagerModel.selectTables
|
|
|
|
.removeWhere((t) => t.id == table.id);
|
|
|
|
//添加桌位弹框
|
|
|
|
await DialogUtil.openCreateTableDialog(
|
|
|
|
context, areas, i, personNumList,
|
|
|
|
onTap: (Map<String, String> value) async {
|
|
|
|
print(value);
|
|
|
|
// 'areaname':
|
|
|
|
// areas[currentAreaIndex],
|
|
|
|
// 'name': controller.text,
|
|
|
|
// 'pnumMin': pnumMin,
|
|
|
|
// 'pnumMax': pnumMax
|
|
|
|
//添加桌位 接口参数带整合???
|
|
|
|
// 以下是旧的不去,明天添加桌位接口
|
|
|
|
String rid;
|
|
|
|
for (Area item in tableManagerModel.areas) {
|
|
|
|
if (item.name == value['areaname']) {
|
|
|
|
rid = item.rid;
|
|
|
|
}
|
|
|
|
DialogUtil.showTableManagerDialog(context, table)
|
|
|
|
.then((value) {
|
|
|
|
if (value != null) {
|
|
|
|
switch (value) {
|
|
|
|
case 1: //查看详情
|
|
|
|
NavigatorUtil.goNotebookDetailPage(
|
|
|
|
context,
|
|
|
|
tableManagerModel.tableMap[table.id].id,
|
|
|
|
tableManagerModel.tableMap[table.id].uid);
|
|
|
|
break;
|
|
|
|
case 2: //订座
|
|
|
|
NavigatorUtil.goNoteBookChangePage(
|
|
|
|
context,
|
|
|
|
NotebookDetail.fromTableManager(
|
|
|
|
tableManagerModel.getCurrDdateStr(),
|
|
|
|
tableManagerModel.currTimeIndex.toString(),
|
|
|
|
table),
|
|
|
|
"");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
Map<String, String> params = {
|
|
|
|
'rid': rid,
|
|
|
|
'name': value['name'],
|
|
|
|
};
|
|
|
|
if (value['pnumMin'] != '') {
|
|
|
|
params['pnum'] = value['pnumMin'];
|
|
|
|
}
|
|
|
|
if (value['pnumMax'] != '') {
|
|
|
|
params['most_pnum'] = value['pnumMax'];
|
|
|
|
}
|
|
|
|
bool success =
|
|
|
|
await tableManagerModel.addTable(context, params);
|
|
|
|
print(success);
|
|
|
|
if (success) {
|
|
|
|
Utils.showToast('添加成功!');
|
|
|
|
// TableOuter tableOuter = TableOuter();
|
|
|
|
// tableOuter.name = value;
|
|
|
|
// tableOuter.list = [];
|
|
|
|
// tableManagerModel.tableOuterList.add(tableOuter);
|
|
|
|
// tableManagerModel.initData();
|
|
|
|
// Timer(
|
|
|
|
// Duration(milliseconds: 500),
|
|
|
|
// () => _areaController.jumpTo(
|
|
|
|
// _areaController.position.maxScrollExtent));
|
|
|
|
|
|
|
|
case 3: //停用,启用桌位
|
|
|
|
Map<String, String> params = {
|
|
|
|
"id": (table as t.Table).id,
|
|
|
|
"status":
|
|
|
|
(table as t.Table).enable == "1" ? "0" : "1"
|
|
|
|
};
|
|
|
|
tableManagerModel
|
|
|
|
.setSwitchStatus(context, params)
|
|
|
|
.then((value) {
|
|
|
|
if (value != null) {
|
|
|
|
(table as t.Table).enable =
|
|
|
|
((int.parse((table as t.Table).enable) +
|
|
|
|
1) %
|
|
|
|
2)
|
|
|
|
.toString();
|
|
|
|
if ((table as t.Table).enable == "1") {
|
|
|
|
for (Area area in tableManagerModel.areas) {
|
|
|
|
if (area.name ==
|
|
|
|
tableManagerModel.currentArea) {
|
|
|
|
if (table.sign != '5' &&
|
|
|
|
table.sign != '1') {
|
|
|
|
//已预订
|
|
|
|
area.count++;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
// await tableManagerModel
|
|
|
|
// .getTableList(context);
|
|
|
|
// await tableManagerModel
|
|
|
|
// .initData();
|
|
|
|
tableManagerModel.refreshTable(context);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
},
|
|
|
|
child: Container(
|
|
|
|
child: DottedBorder(
|
|
|
|
dashPattern: [5, 5, 5, 5],
|
|
|
|
borderType: BorderType.RRect,
|
|
|
|
radius: Radius.circular(ScreenUtil().setWidth(20)),
|
|
|
|
// padding: EdgeInsets.all(ScreenUtil().setWidth(70)),
|
|
|
|
color: MyColours.color_E0E0E0,
|
|
|
|
strokeWidth: ScreenUtil().setWidth(2),
|
|
|
|
child: ClipRRect(
|
|
|
|
borderRadius: BorderRadius.all(
|
|
|
|
Radius.circular(ScreenUtil().setWidth(20))),
|
|
|
|
child: Container(
|
|
|
|
height: ScreenUtil.screenWidthDp -
|
|
|
|
ScreenUtil().setWidth(12 * 3 - 10 * 2),
|
|
|
|
width: ScreenUtil.screenWidthDp -
|
|
|
|
ScreenUtil().setWidth(12 * 3 - 10 * 2),
|
|
|
|
child: Column(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
children: [
|
|
|
|
Image.asset(Utils.getImgPath('add_store'),
|
|
|
|
width: ScreenUtil().setWidth(32)),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
)));
|
|
|
|
} else {
|
|
|
|
return Selector<TableManagerModel, t.Table>(
|
|
|
|
shouldRebuild: (pre, next) => true,
|
|
|
|
selector: (context, model) => data[index],
|
|
|
|
builder: (context, table, _) {
|
|
|
|
return FTableItem(table, onSelected: (table) {
|
|
|
|
if ((table as t.Table).selected) {
|
|
|
|
tableManagerModel.selectTables.add(table);
|
|
|
|
} else {
|
|
|
|
tableManagerModel.selectTables
|
|
|
|
.removeWhere((t) => t.id == table.id);
|
|
|
|
}
|
|
|
|
DialogUtil.showTableManagerDialog(context, table).then((value) {
|
|
|
|
if (value != null) {
|
|
|
|
switch (value) {
|
|
|
|
case 1: //查看详情
|
|
|
|
NavigatorUtil.goNotebookDetailPage(
|
|
|
|
context,
|
|
|
|
tableManagerModel.tableMap[table.id].id,
|
|
|
|
tableManagerModel.tableMap[table.id].uid);
|
|
|
|
break;
|
|
|
|
case 2: //订座
|
|
|
|
NavigatorUtil.goNoteBookChangePage(
|
|
|
|
context,
|
|
|
|
NotebookDetail.fromTableManager(
|
|
|
|
tableManagerModel.getCurrDdateStr(),
|
|
|
|
tableManagerModel.currTimeIndex.toString(),
|
|
|
|
table),
|
|
|
|
"");
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 3: //停用,启用桌位
|
|
|
|
Map<String, String> params = {
|
|
|
|
"id": (table as t.Table).id,
|
|
|
|
"status": (table as t.Table).enable == "1" ? "0" : "1"
|
|
|
|
};
|
|
|
|
tableManagerModel
|
|
|
|
.setSwitchStatus(context, params)
|
|
|
|
.then((value) {
|
|
|
|
if (value != null) {
|
|
|
|
(table as t.Table).enable =
|
|
|
|
((int.parse((table as t.Table).enable) + 1) % 2)
|
|
|
|
.toString();
|
|
|
|
if ((table as t.Table).enable == "1") {
|
|
|
|
for (Area area in tableManagerModel.areas) {
|
|
|
|
if (area.name ==
|
|
|
|
tableManagerModel.currentArea) {
|
|
|
|
if (table.sign != '5' && table.sign != '1') {
|
|
|
|
//已预订
|
|
|
|
area.count++;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
for (Area area in tableManagerModel.areas) {
|
|
|
|
if (area.name ==
|
|
|
|
tableManagerModel.currentArea) {
|
|
|
|
if (table.sign != '5' &&
|
|
|
|
table.sign != '1') {
|
|
|
|
//已预订
|
|
|
|
area.count--;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
for (Area area in tableManagerModel.areas) {
|
|
|
|
if (area.name ==
|
|
|
|
tableManagerModel.currentArea) {
|
|
|
|
if (table.sign != '5' && table.sign != '1') {
|
|
|
|
//已预订
|
|
|
|
area.count--;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
tableManagerModel.notifyListeners();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
break;
|
|
|
|
case 4: //照片管理
|
|
|
|
NavigatorUtil.goTablePhotoManagerPage(context,
|
|
|
|
tid: (table as t.Table).id,
|
|
|
|
tname: (table as t.Table).name);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
},
|
|
|
|
canSelected: false,
|
|
|
|
fromPage: 'table_manage',
|
|
|
|
tableMap: tableManagerModel.tableMap,
|
|
|
|
rid: "");
|
|
|
|
},
|
|
|
|
);
|
|
|
|
}
|
|
|
|
},
|
|
|
|
),
|
|
|
|
],
|
|
|
|
));
|
|
|
|
}
|
|
|
|
tableManagerModel.notifyListeners();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
break;
|
|
|
|
case 4: //照片管理
|
|
|
|
NavigatorUtil.goTablePhotoManagerPage(context,
|
|
|
|
tid: (table as t.Table).id,
|
|
|
|
tname: (table as t.Table).name);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
},
|
|
|
|
canSelected: false,
|
|
|
|
fromPage: 'table_manage',
|
|
|
|
tableMap: tableManagerModel.tableMap,
|
|
|
|
rid: "");
|
|
|
|
},
|
|
|
|
);
|
|
|
|
}
|
|
|
|
},
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
tableManagerModel = Provider.of<TableManagerModel>(context, listen: true);
|
|
|
|
return Scaffold(
|
|
|
|
backgroundColor: MyColours.color_ffffff,
|
|
|
|
appBar: SystemAppBar("桌位", showLeading: false),
|
|
|
|
body: Consumer<TableManagerModel>(
|
|
|
|
builder: (context, model, child) {
|
|
...
|
...
|
@@ -520,12 +510,11 @@ class TableManagerPageState extends State<TableManagerPage> { |
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
VEmptyView(40),
|
|
|
|
Consumer<TableManagerModel>(
|
|
|
|
builder: (context, model, child) {
|
|
|
|
if (model.pageState != PageState.Success) {
|
|
|
|
return Expanded(
|
|
|
|
child: ExceptionPage(
|
|
|
|
VEmptyView(30),
|
|
|
|
|
|
|
|
model.pageState != PageState.Success
|
|
|
|
? Expanded(
|
|
|
|
child: ExceptionPage(
|
|
|
|
pageState: model.pageState,
|
|
|
|
callback: () {
|
|
|
|
if (tableManagerModel.tableOuterList.isEmpty) {
|
|
...
|
...
|
@@ -537,129 +526,293 @@ class TableManagerPageState extends State<TableManagerPage> { |
|
|
|
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)),
|
|
|
|
],
|
|
|
|
))
|
|
|
|
: Expanded(
|
|
|
|
child: Column(
|
|
|
|
// crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
children: [
|
|
|
|
Container(
|
|
|
|
color: MyColours.color_ffffff,
|
|
|
|
height: ScreenUtil().setWidth(90),
|
|
|
|
margin: EdgeInsets.only(
|
|
|
|
bottom: ScreenUtil().setWidth(30)),
|
|
|
|
child: Row(
|
|
|
|
children: [
|
|
|
|
HEmptyView(20),
|
|
|
|
Expanded(
|
|
|
|
child: ListView.builder(
|
|
|
|
itemCount: tableManagerModel.areas.length ==
|
|
|
|
0
|
|
|
|
? 1
|
|
|
|
: tableManagerModel.areas.length + 2,
|
|
|
|
shrinkWrap: true,
|
|
|
|
scrollDirection: Axis.horizontal,
|
|
|
|
itemBuilder:
|
|
|
|
(BuildContext contxt, int index) {
|
|
|
|
if (index ==
|
|
|
|
tableManagerModel.areas.length +
|
|
|
|
1 ||
|
|
|
|
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('添加成功!');
|
|
|
|
|
|
|
|
await tableManagerModel
|
|
|
|
.getTableList(context,
|
|
|
|
needLoading: false);
|
|
|
|
tableManagerModel.initData();
|
|
|
|
|
|
|
|
// setState(() {
|
|
|
|
// updateMenu();
|
|
|
|
// });
|
|
|
|
// _scrollToIndex(widget
|
|
|
|
// .tableManagerModel
|
|
|
|
// .areas
|
|
|
|
// .length);
|
|
|
|
|
|
|
|
}
|
|
|
|
});
|
|
|
|
},
|
|
|
|
child: 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 {
|
|
|
|
if (index == 0) {
|
|
|
|
return InkWell(
|
|
|
|
onTap: () {
|
|
|
|
setState(() {
|
|
|
|
isSelected = true;
|
|
|
|
tableManagerModel.currentArea =
|
|
|
|
'全部';
|
|
|
|
tableManagerModel
|
|
|
|
.currentTables =
|
|
|
|
tableManagerModel
|
|
|
|
.areaTableMapShow[
|
|
|
|
tableManagerModel
|
|
|
|
.currentArea];
|
|
|
|
});
|
|
|
|
},
|
|
|
|
child: Container(
|
|
|
|
// width: ScreenUtil().setWidth(104 * 2),
|
|
|
|
height: ScreenUtil().setWidth(80),
|
|
|
|
margin: EdgeInsets.only(
|
|
|
|
right:
|
|
|
|
ScreenUtil().setWidth(20),
|
|
|
|
top: ScreenUtil().setWidth(20),
|
|
|
|
),
|
|
|
|
padding: EdgeInsets.symmetric(
|
|
|
|
horizontal:
|
|
|
|
ScreenUtil().setWidth(20),
|
|
|
|
vertical: ScreenUtil()
|
|
|
|
.setWidth(10)),
|
|
|
|
alignment: Alignment.center,
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
// borderRadius: BorderRadius.circular(ScreenUtil().setWidth(10)),
|
|
|
|
color: isSelected
|
|
|
|
? MyColours.color_199095
|
|
|
|
: MyColours.color_ffffff,
|
|
|
|
border: Border.all(
|
|
|
|
color: MyColours
|
|
|
|
.color_E0E0E0,
|
|
|
|
width: ScreenUtil()
|
|
|
|
.setWidth(2))),
|
|
|
|
child: Text(
|
|
|
|
'全部',
|
|
|
|
overflow: TextOverflow.ellipsis,
|
|
|
|
style: TextStyle(
|
|
|
|
color: isSelected
|
|
|
|
? MyColours.color_ffffff
|
|
|
|
: MyColours
|
|
|
|
.color_333333,
|
|
|
|
fontSize:
|
|
|
|
ScreenUtil().setSp(28),
|
|
|
|
decoration:
|
|
|
|
TextDecoration.none,
|
|
|
|
fontWeight:
|
|
|
|
FontWeight.normal),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
)
|
|
|
|
],
|
|
|
|
);
|
|
|
|
} else {
|
|
|
|
return AreaItemTable(
|
|
|
|
model.areas[index],
|
|
|
|
tableManagerModel.currentArea,
|
|
|
|
(area) {});
|
|
|
|
}
|
|
|
|
},
|
|
|
|
)),
|
|
|
|
HEmptyView(40),
|
|
|
|
MyDivider(ScreenUtil().setWidth(2),
|
|
|
|
ScreenUtil().setWidth(40),
|
|
|
|
color: MyColours.color_F1F0F4),
|
|
|
|
],
|
|
|
|
);
|
|
|
|
} else {
|
|
|
|
return AreaItemTable(
|
|
|
|
model.areas[index - 1],
|
|
|
|
tableManagerModel.currentArea,
|
|
|
|
(area) {
|
|
|
|
setState(() {
|
|
|
|
isSelected = false;
|
|
|
|
_selectNumber = index - 1;
|
|
|
|
tableManagerModel.currentArea =
|
|
|
|
tableManagerModel
|
|
|
|
.areas[index - 1].name;
|
|
|
|
tableManagerModel.currentTables =
|
|
|
|
tableManagerModel
|
|
|
|
.areaTableMapShow[
|
|
|
|
tableManagerModel
|
|
|
|
.currentArea];
|
|
|
|
// _anmationMenu();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
)),
|
|
|
|
InkWell(
|
|
|
|
onTap: () {
|
|
|
|
setState(() {
|
|
|
|
model.swichState = !model.swichState;
|
|
|
|
if (model.swichState) {
|
|
|
|
model.areaTableMapShow =
|
|
|
|
tableManagerModel
|
|
|
|
.areaTableMapCanNote;
|
|
|
|
model.tablesShow =
|
|
|
|
tableManagerModel.tablesCanNote;
|
|
|
|
} else {
|
|
|
|
model.areaTableMapShow =
|
|
|
|
model.areaTableMap;
|
|
|
|
model.tablesShow = model.tablesAll;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
},
|
|
|
|
child: Container(
|
|
|
|
margin: EdgeInsets.only(
|
|
|
|
top: ScreenUtil().setWidth(20),
|
|
|
|
),
|
|
|
|
child: Row(
|
|
|
|
children: [
|
|
|
|
MyDivider(ScreenUtil().setWidth(15),
|
|
|
|
ScreenUtil().setWidth(80),
|
|
|
|
color: MyColours.color_F1F0F4),
|
|
|
|
MyDivider(ScreenUtil().setWidth(2),
|
|
|
|
ScreenUtil().setWidth(80),
|
|
|
|
color: MyColours.color_9C9C9C),
|
|
|
|
HEmptyView(30),
|
|
|
|
Image.asset(
|
|
|
|
model.swichState
|
|
|
|
? Utils.getImgPath(
|
|
|
|
'f_swich_on')
|
|
|
|
: Utils.getImgPath(
|
|
|
|
'f_swich_off'),
|
|
|
|
width: ScreenUtil().setWidth(90),
|
|
|
|
// height: ScreenUtil().setWidth(82),
|
|
|
|
),
|
|
|
|
HEmptyView(20),
|
|
|
|
Text(
|
|
|
|
'仅看\n空座',
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize:
|
|
|
|
ScreenUtil().setSp(30),
|
|
|
|
color: MyColours.color_333333,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
HEmptyView(40)
|
|
|
|
],
|
|
|
|
)),
|
|
|
|
)
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
)
|
|
|
|
],
|
|
|
|
);
|
|
|
|
// 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);
|
|
|
|
// },
|
|
|
|
// );
|
|
|
|
}
|
|
|
|
},
|
|
|
|
),
|
|
|
|
Expanded(
|
|
|
|
child: Container(
|
|
|
|
color: Color.fromRGBO(249, 249, 249, 1),
|
|
|
|
child: item(_selectNumber))),
|
|
|
|
]))
|
|
|
|
// 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);
|
|
|
|
// },
|
|
|
|
// );
|
|
|
|
],
|
|
|
|
);
|
|
|
|
},
|
...
|
...
|
|