Commit 47f54a42bb94a1654c3a523d08dbcc1c5b94f451

Authored by wdn127929
1 parent e18fde02

添加桌位布局和其他UI

@@ -31,17 +31,22 @@ class AreaItemTableState extends State<AreaItemTable> { @@ -31,17 +31,22 @@ class AreaItemTableState extends State<AreaItemTable> {
31 } 31 }
32 }, 32 },
33 child: Stack( 33 child: Stack(
  34 + overflow: Overflow.visible,
  35 + alignment: Alignment.topLeft,
34 children: <Widget>[ 36 children: <Widget>[
35 Container( 37 Container(
36 - // width: ScreenUtil().setWidth(189),  
37 - height: ScreenUtil().setWidth(50),  
38 - margin: EdgeInsets.only(right: ScreenUtil().setWidth(40)),  
39 - padding:  
40 - EdgeInsets.symmetric(horizontal: ScreenUtil().setWidth(40)), 38 + width: ScreenUtil().setWidth(104 * 2),
  39 + height: ScreenUtil().setWidth(80),
  40 + margin: EdgeInsets.only(
  41 + right: ScreenUtil().setWidth(20),
  42 + top: ScreenUtil().setWidth(20),
  43 + ),
  44 + padding: EdgeInsets.symmetric(
  45 + horizontal: ScreenUtil().setWidth(20),
  46 + vertical: ScreenUtil().setWidth(10)),
41 alignment: Alignment.center, 47 alignment: Alignment.center,
42 -  
43 decoration: BoxDecoration( 48 decoration: BoxDecoration(
44 - borderRadius: BorderRadius.circular(ScreenUtil().setWidth(30)), 49 + borderRadius: BorderRadius.circular(ScreenUtil().setWidth(10)),
45 color: isSelected 50 color: isSelected
46 ? MyColours.color_199095 51 ? MyColours.color_199095
47 : MyColours.color_ffffff, 52 : MyColours.color_ffffff,
@@ -54,38 +59,38 @@ class AreaItemTableState extends State<AreaItemTable> { @@ -54,38 +59,38 @@ class AreaItemTableState extends State<AreaItemTable> {
54 color: isSelected 59 color: isSelected
55 ? MyColours.color_ffffff 60 ? MyColours.color_ffffff
56 : MyColours.color_199095, 61 : MyColours.color_199095,
57 - fontSize: ScreenUtil().setSp(32), 62 + fontSize: ScreenUtil().setSp(28),
58 decoration: TextDecoration.none, 63 decoration: TextDecoration.none,
59 fontWeight: FontWeight.normal), 64 fontWeight: FontWeight.normal),
60 ), 65 ),
61 ), 66 ),
62 - Positioned(  
63 - left: 0,  
64 - top: 0,  
65 - child: Container(  
66 - width: ScreenUtil().setWidth(73),  
67 - height: ScreenUtil().setHeight(37),  
68 - alignment: Alignment.center,  
69 - decoration: BoxDecoration(  
70 - color: area.count <= 0  
71 - ? MyColours.color_999999  
72 - : MyColours.color_63a6d1,  
73 - borderRadius: BorderRadius.only(  
74 - topRight: Radius.circular(ScreenUtil().setWidth(8)),  
75 - bottomRight: Radius.circular(ScreenUtil().setWidth(8)))),  
76 - child: Text(  
77 - area.count == 0  
78 - ? "满座"  
79 - : area.count == -1  
80 - ? '无'  
81 - : "余${area.count}",  
82 - style: TextStyle(  
83 - color: MyColours.color_ffffff,  
84 - fontSize: ScreenUtil().setSp(26),  
85 - decoration: TextDecoration.none,  
86 - fontWeight: FontWeight.normal)),  
87 - ),  
88 - ), 67 + area.count == -1
  68 + ? Container()
  69 + : Positioned(
  70 + left: 0,
  71 + top: 0,
  72 + child: Container(
  73 + width: ScreenUtil().setWidth(78),
  74 + height: ScreenUtil().setWidth(30),
  75 + alignment: Alignment.center,
  76 + decoration: BoxDecoration(
  77 + color: area.count <= 0
  78 + ? MyColours.color_999999
  79 + : MyColours.color_63a6d1,
  80 + borderRadius: BorderRadius.only(
  81 + topLeft: Radius.circular(ScreenUtil().setWidth(10)),
  82 + topRight:
  83 + Radius.circular(ScreenUtil().setWidth(15)),
  84 + bottomRight:
  85 + Radius.circular(ScreenUtil().setWidth(15)))),
  86 + child: Text(area.count == 0 ? "满座" : "余${area.count}",
  87 + style: TextStyle(
  88 + color: MyColours.color_ffffff,
  89 + fontSize: ScreenUtil().setSp(26),
  90 + decoration: TextDecoration.none,
  91 + fontWeight: FontWeight.normal)),
  92 + ),
  93 + ),
89 ], 94 ],
90 ), 95 ),
91 ); 96 );
@@ -75,143 +75,206 @@ class TableManagerPageState extends State<TableManagerPage> { @@ -75,143 +75,206 @@ class TableManagerPageState extends State<TableManagerPage> {
75 scrollDirection: Axis.vertical, 75 scrollDirection: Axis.vertical,
76 ); 76 );
77 77
78 - void scrollTo(int index) => itemScrollController.scrollTo(  
79 - index: index,  
80 - duration: scrollDuration,  
81 - curve: Curves.easeInOutCubic,  
82 - alignment: 0); 78 + void scrollTo(int index) => itemScrollController
  79 + .scrollTo(
  80 + index: index,
  81 + duration: scrollDuration,
  82 + curve: Curves.easeInOutCubic,
  83 + alignment: 0)
  84 + .then((value) {
  85 + // print(_selectIndex);
  86 + // this.setState(() {});
  87 + });
83 88
84 void jumpTo(int index) => 89 void jumpTo(int index) =>
85 itemScrollController.jumpTo(index: index, alignment: 0); 90 itemScrollController.jumpTo(index: index, alignment: 0);
86 91
87 /// Generate item number [i]. 92 /// Generate item number [i].
88 Widget item(int i) { 93 Widget item(int i) {
89 - int heightSum;  
90 - int length =  
91 - tableManagerModel.areaTableMap[tableManagerModel.areas[i].name].length;  
92 - if (length % 4 == 0) {  
93 - heightSum = (length / 4).floor();  
94 - } else {  
95 - heightSum = (length / 4).floor() + 1;  
96 - }  
97 - return Container(  
98 - height: ScreenUtil().setWidth(185) * heightSum +  
99 - heightSum * 10 +  
100 - ScreenUtil().setWidth(60 * 2), 94 + return SingleChildScrollView(
101 child: Column( 95 child: Column(
102 - children: [  
103 - Container(  
104 - alignment: Alignment.center,  
105 - height: ScreenUtil().setWidth(30 * 2),  
106 - child: Text(tableManagerModel.areas[i].name,  
107 - style: TextStyle(  
108 - fontSize: ScreenUtil().setWidth(30),  
109 - color: MyColours.color_666666)),  
110 - ),  
111 - Container(  
112 - constraints: BoxConstraints(  
113 - minHeight: ScreenUtil().setWidth(185) * heightSum),  
114 - height: ScreenUtil().setWidth(200) * heightSum + heightSum * 10,  
115 - child: GridView.builder(  
116 - physics: NeverScrollableScrollPhysics(),  
117 - gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(  
118 - crossAxisCount: 4,  
119 - childAspectRatio: 8 / 9,  
120 - ),  
121 - itemBuilder: (context, index) {  
122 - return Selector<TableManagerModel, t.Table>(  
123 - shouldRebuild: (pre, next) => true,  
124 - selector: (context, model) => model.currentTables[index],  
125 - builder: (context, table, _) {  
126 - return TableItem(table, onSelected: (table) {  
127 - if ((table as t.Table).selected) {  
128 - tableManagerModel.selectTables.add(table);  
129 - } else {  
130 - tableManagerModel.selectTables  
131 - .removeWhere((t) => t.id == table.id);  
132 - }  
133 - DialogUtil.showTableManagerDialog(context, table)  
134 - .then((value) {  
135 - if (value != null) {  
136 - switch (value) {  
137 - case 1: //查看详情  
138 - NavigatorUtil.goNotebookDetailPage(context,  
139 - tableManagerModel.tableMap[table.id].id);  
140 - break;  
141 - case 2: //订座  
142 - NavigatorUtil.goNoteBookChangePage(  
143 - context,  
144 - NotebookDetail.fromTableManager(  
145 - tableManagerModel.getCurrDdateStr(),  
146 - tableManagerModel.currTimeIndex  
147 - .toString(),  
148 - table),  
149 - "");  
150 - break;  
151 - case 3: //停用,启用桌位  
152 - Map<String, String> params = {  
153 - "id": (table as t.Table).id,  
154 - "status": (table as t.Table).enable == "1"  
155 - ? "0"  
156 - : "1"  
157 - };  
158 - tableManagerModel  
159 - .setSwitchStatus(context, params)  
160 - .then((value) {  
161 - if (value != null) {  
162 - (table as t.Table).enable = ((int.parse(  
163 - (table as t.Table)  
164 - .enable) +  
165 - 1) %  
166 - 2)  
167 - .toString();  
168 - if ((table as t.Table).enable == "1") {  
169 - for (Area area  
170 - in tableManagerModel.areas) {  
171 - if (area.name ==  
172 - tableManagerModel.currentArea) {  
173 - if (table.sign != '5' &&  
174 - table.sign != '1') {  
175 - //已预订  
176 - area.count++;  
177 - }  
178 - break;  
179 - }  
180 - }  
181 - } else {  
182 - for (Area area  
183 - in tableManagerModel.areas) {  
184 - if (area.name ==  
185 - tableManagerModel.currentArea) {  
186 - if (table.sign != '5' &&  
187 - table.sign != '1') {  
188 - //已预订  
189 - area.count--;  
190 - }  
191 - break;  
192 - }  
193 - } 96 + children: [
  97 + VEmptyView(40),
  98 + Container(
  99 + alignment: Alignment.center,
  100 + height: ScreenUtil().setWidth(21 * 2),
  101 + child: Text(tableManagerModel.areas[i].name,
  102 + style: TextStyle(
  103 + fontSize: ScreenUtil().setWidth(30),
  104 + color: MyColours.color_199095)),
  105 + ),
  106 + VEmptyView(30),
  107 + GridView.builder(
  108 + // controller: _areaController,
  109 + physics: NeverScrollableScrollPhysics(),
  110 + padding: EdgeInsets.only(top: 0),
  111 + shrinkWrap: true,
  112 + itemCount: tableManagerModel
  113 + .areaTableMap[tableManagerModel.areas[i].name].length +
  114 + 1,
  115 + gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
  116 + crossAxisCount: 4,
  117 + childAspectRatio: 8 / 9,
  118 + ),
  119 + // mainAxisSpacing: ScreenUtil().setWidth(15 * 2),
  120 + // crossAxisSpacing: ScreenUtil().setWidth(38 * 2)),
  121 + itemBuilder: (BuildContext context, int index) {
  122 + if (index ==
  123 + tableManagerModel
  124 + .areaTableMap[tableManagerModel.areas[i].name].length ||
  125 + tableManagerModel
  126 + .areaTableMap[tableManagerModel.areas[i].name].length ==
  127 + 0) {
  128 + return InkWell(
  129 + onTap: () async {
  130 + List<String> areas = [];
  131 + for (int i = 0; i < tableManagerModel.areas.length; i++) {
  132 + areas.add(tableManagerModel.areas[i].name);
  133 + }
  134 +
  135 + //添加桌位弹框
  136 + await DialogUtil.openCreateTableDialog(
  137 + context, areas, i, ['1', '2', '3'],
  138 + onTap: (value) async {
  139 + print(value);
  140 + //添加桌位 接口参数带整合???
  141 + // 以下是旧的不去,明天添加桌位接口
  142 + bool success =
  143 + await tableManagerModel.addTableAreas(context, value);
  144 + print(success);
  145 + if (success) {
  146 + Utils.showToast('添加成功!');
  147 + TableOuter tableOuter = TableOuter();
  148 + tableOuter.name = value;
  149 + tableOuter.list = [];
  150 + tableManagerModel.tableOuterList.add(tableOuter);
  151 + tableManagerModel.initData();
  152 + Timer(
  153 + Duration(milliseconds: 500),
  154 + () => _areaController.jumpTo(
  155 + _areaController.position.maxScrollExtent));
  156 +
  157 + // await tableManagerModel
  158 + // .getTableList(context);
  159 + // await tableManagerModel
  160 + // .initData();
  161 + }
  162 + });
  163 + },
  164 + child: Container(
  165 + margin: EdgeInsets.all(ScreenUtil().setWidth(9)),
  166 + child: DottedBorder(
  167 + dashPattern: [5, 5, 5, 5],
  168 + borderType: BorderType.RRect,
  169 + radius: Radius.circular(ScreenUtil().setWidth(10)),
  170 + // padding: EdgeInsets.all(ScreenUtil().setWidth(70)),
  171 + color: MyColours.color_199095,
  172 + strokeWidth: ScreenUtil().setWidth(2),
  173 + child: ClipRRect(
  174 + borderRadius: BorderRadius.all(
  175 + Radius.circular(ScreenUtil().setWidth(10))),
  176 + child: Container(
  177 + height: ScreenUtil().setWidth(90 * 2),
  178 + width: ScreenUtil().setWidth(80 * 2),
  179 + child: Column(
  180 + mainAxisAlignment: MainAxisAlignment.center,
  181 + children: [
  182 + Image.asset(Utils.getImgPath('add_area'),
  183 + width: ScreenUtil().setWidth(32)),
  184 + ],
  185 + ),
  186 + ),
  187 + ),
  188 + )));
  189 + } else {
  190 + return Selector<TableManagerModel, t.Table>(
  191 + shouldRebuild: (pre, next) => true,
  192 + selector: (context, model) => tableManagerModel
  193 + .areaTableMap[tableManagerModel.areas[i].name][index],
  194 + builder: (context, table, _) {
  195 + return TableItem(table, onSelected: (table) {
  196 + if ((table as t.Table).selected) {
  197 + tableManagerModel.selectTables.add(table);
  198 + } else {
  199 + tableManagerModel.selectTables
  200 + .removeWhere((t) => t.id == table.id);
  201 + }
  202 + DialogUtil.showTableManagerDialog(context, table)
  203 + .then((value) {
  204 + if (value != null) {
  205 + switch (value) {
  206 + case 1: //查看详情
  207 + NavigatorUtil.goNotebookDetailPage(context,
  208 + tableManagerModel.tableMap[table.id].id);
  209 + break;
  210 + case 2: //订座
  211 + NavigatorUtil.goNoteBookChangePage(
  212 + context,
  213 + NotebookDetail.fromTableManager(
  214 + tableManagerModel.getCurrDdateStr(),
  215 + tableManagerModel.currTimeIndex.toString(),
  216 + table),
  217 + "");
  218 + break;
  219 + case 3: //停用,启用桌位
  220 + Map<String, String> params = {
  221 + "id": (table as t.Table).id,
  222 + "status":
  223 + (table as t.Table).enable == "1" ? "0" : "1"
  224 + };
  225 + tableManagerModel
  226 + .setSwitchStatus(context, params)
  227 + .then((value) {
  228 + if (value != null) {
  229 + (table as t.Table).enable =
  230 + ((int.parse((table as t.Table).enable) +
  231 + 1) %
  232 + 2)
  233 + .toString();
  234 + if ((table as t.Table).enable == "1") {
  235 + for (Area area in tableManagerModel.areas) {
  236 + if (area.name ==
  237 + tableManagerModel.currentArea) {
  238 + if (table.sign != '5' &&
  239 + table.sign != '1') {
  240 + //已预订
  241 + area.count++;
  242 + }
  243 + break;
  244 + }
  245 + }
  246 + } else {
  247 + for (Area area in tableManagerModel.areas) {
  248 + if (area.name ==
  249 + tableManagerModel.currentArea) {
  250 + if (table.sign != '5' &&
  251 + table.sign != '1') {
  252 + //已预订
  253 + area.count--;
194 } 254 }
195 - tableManagerModel.notifyListeners(); 255 + break;
196 } 256 }
197 - });  
198 - break; 257 + }
  258 + }
  259 + tableManagerModel.notifyListeners();
199 } 260 }
200 - }  
201 - });  
202 - },  
203 - canSelected: false,  
204 - fromPage: 'table_manage',  
205 - tableMap: tableManagerModel.tableMap,  
206 - rid: "");  
207 - },  
208 - ); 261 + });
  262 + break;
  263 + }
  264 + }
  265 + });
209 }, 266 },
210 - itemCount: tableManagerModel  
211 - .areaTableMap[tableManagerModel.areas[i].name].length,  
212 - )),  
213 - ],  
214 - )); 267 + canSelected: false,
  268 + fromPage: 'table_manage',
  269 + tableMap: tableManagerModel.tableMap,
  270 + rid: "");
  271 + },
  272 + );
  273 + }
  274 + },
  275 + ),
  276 + ],
  277 + ));
215 } 278 }
216 279
217 @override 280 @override
@@ -360,7 +423,7 @@ class TableManagerPageState extends State<TableManagerPage> { @@ -360,7 +423,7 @@ class TableManagerPageState extends State<TableManagerPage> {
360 return Container( 423 return Container(
361 color: MyColours.color_ffffff, 424 color: MyColours.color_ffffff,
362 child: Column(children: <Widget>[ 425 child: Column(children: <Widget>[
363 - VEmptyView(20), 426 + // VEmptyView(20),
364 ValueListenableBuilder<Iterable<ItemPosition>>( 427 ValueListenableBuilder<Iterable<ItemPosition>>(
365 valueListenable: 428 valueListenable:
366 itemPositionsListener.itemPositions, 429 itemPositionsListener.itemPositions,
@@ -376,6 +439,7 @@ class TableManagerPageState extends State<TableManagerPage> { @@ -376,6 +439,7 @@ class TableManagerPageState extends State<TableManagerPage> {
376 // ? position 439 // ? position
377 // : max) 440 // : max)
378 // .index; 441 // .index;
  442 +
379 min = positions 443 min = positions
380 .where((ItemPosition position) => 444 .where((ItemPosition position) =>
381 position.itemTrailingEdge > 0) 445 position.itemTrailingEdge > 0)
@@ -399,13 +463,20 @@ class TableManagerPageState extends State<TableManagerPage> { @@ -399,13 +463,20 @@ class TableManagerPageState extends State<TableManagerPage> {
399 } 463 }
400 tableManagerModel.currentArea = 464 tableManagerModel.currentArea =
401 tableManagerModel.areas[_selectIndex].name; 465 tableManagerModel.areas[_selectIndex].name;
  466 + _areaController.animateTo(
  467 + _selectIndex *
  468 + ScreenUtil().setWidth(104 * 2),
  469 + duration: new Duration(milliseconds: 500),
  470 + curve: Curves.ease);
402 } 471 }
403 return Container( 472 return Container(
404 - height: ScreenUtil().setWidth(50), 473 + height: ScreenUtil().setWidth(80),
405 color: MyColours.color_ffffff, 474 color: MyColours.color_ffffff,
406 margin: EdgeInsets.only( 475 margin: EdgeInsets.only(
407 bottom: ScreenUtil().setWidth(20)), 476 bottom: ScreenUtil().setWidth(20)),
408 child: ListView.builder( 477 child: ListView.builder(
  478 + padding: EdgeInsets.symmetric(
  479 + horizontal: ScreenUtil().setWidth(40)),
409 controller: _areaController, 480 controller: _areaController,
410 scrollDirection: Axis.horizontal, 481 scrollDirection: Axis.horizontal,
411 itemBuilder: (context, index) { 482 itemBuilder: (context, index) {
@@ -448,37 +519,44 @@ class TableManagerPageState extends State<TableManagerPage> { @@ -448,37 +519,44 @@ class TableManagerPageState extends State<TableManagerPage> {
448 } 519 }
449 }); 520 });
450 }, 521 },
451 - child: DottedBorder(  
452 - dashPattern: [5, 5, 5, 5],  
453 - borderType: BorderType.RRect,  
454 - radius: Radius.circular(  
455 - ScreenUtil().setWidth(30)),  
456 - // padding: EdgeInsets.all(ScreenUtil().setWidth(70)),  
457 - color: MyColours.color_199095,  
458 - strokeWidth:  
459 - ScreenUtil().setWidth(2),  
460 - child: ClipRRect(  
461 - borderRadius: BorderRadius.all(  
462 - Radius.circular(ScreenUtil()  
463 - .setWidth(30))),  
464 - child: Container(  
465 - height: ScreenUtil()  
466 - .setWidth(50 * 2),  
467 - width: ScreenUtil()  
468 - .setWidth(60 * 2),  
469 - child: Column(  
470 - mainAxisAlignment:  
471 - MainAxisAlignment.center,  
472 - children: [  
473 - Image.asset(  
474 - Utils.getImgPath(  
475 - 'add_store'),  
476 - width: ScreenUtil()  
477 - .setWidth(22)),  
478 - ], 522 + child: Column(
  523 + children: [
  524 + VEmptyView(20),
  525 + DottedBorder(
  526 + dashPattern: [5, 5, 5, 5],
  527 + borderType: BorderType.RRect,
  528 + radius: Radius.circular(
  529 + ScreenUtil().setWidth(10)),
  530 + // padding: EdgeInsets.all(ScreenUtil().setWidth(70)),
  531 + color: MyColours.color_199095,
  532 + strokeWidth:
  533 + ScreenUtil().setWidth(2),
  534 + child: ClipRRect(
  535 + borderRadius: BorderRadius
  536 + .all(Radius.circular(
  537 + ScreenUtil()
  538 + .setWidth(10))),
  539 + child: Container(
  540 + height: ScreenUtil()
  541 + .setWidth(25 * 2),
  542 + width: ScreenUtil()
  543 + .setWidth(104 * 2),
  544 + child: Column(
  545 + mainAxisAlignment:
  546 + MainAxisAlignment
  547 + .center,
  548 + children: [
  549 + Image.asset(
  550 + Utils.getImgPath(
  551 + 'add_area'),
  552 + width: ScreenUtil()
  553 + .setWidth(24)),
  554 + ],
  555 + ),
  556 + ),
479 ), 557 ),
480 - ),  
481 - ), 558 + )
  559 + ],
482 )); 560 ));
483 } else { 561 } else {
484 return Selector<TableManagerModel, Area>( 562 return Selector<TableManagerModel, Area>(
@@ -489,6 +567,7 @@ class TableManagerPageState extends State<TableManagerPage> { @@ -489,6 +567,7 @@ class TableManagerPageState extends State<TableManagerPage> {
489 tableManagerModel.currentArea, 567 tableManagerModel.currentArea,
490 (area) { 568 (area) {
491 isTap = true; 569 isTap = true;
  570 + _selectIndex = index;
492 scrollTo(index); 571 scrollTo(index);
493 // setState(() { 572 // setState(() {
494 tableManagerModel.currentArea = 573 tableManagerModel.currentArea =
@@ -498,7 +577,16 @@ class TableManagerPageState extends State<TableManagerPage> { @@ -498,7 +577,16 @@ class TableManagerPageState extends State<TableManagerPage> {
498 tableManagerModel.areaTableMap[ 577 tableManagerModel.areaTableMap[
499 tableManagerModel 578 tableManagerModel
500 .currentArea]; 579 .currentArea];
501 - _selectIndex = index; 580 +
  581 + // if (position.value.first.itemLeadingEdge ==
  582 + // itemPositionsListener
  583 + // .itemPositions.value.first.itemLeadingEdge) {
  584 + // setState(() {
  585 + // _selectIndex = index;
  586 + // });
  587 + // }
  588 + // setState(() {});
  589 +
502 // }); 590 // });
503 // setState(() { 591 // setState(() {
504 // tableManagerModel.currentArea = 592 // tableManagerModel.currentArea =
@@ -513,162 +601,19 @@ class TableManagerPageState extends State<TableManagerPage> { @@ -513,162 +601,19 @@ class TableManagerPageState extends State<TableManagerPage> {
513 ); 601 );
514 } 602 }
515 }, 603 },
516 -  
517 - // itemExtent: ScreenUtil().setHeight(207), 604 + itemExtent: ScreenUtil().setWidth(104 * 2),
518 itemCount: tableManagerModel.areas.length + 1, 605 itemCount: tableManagerModel.areas.length + 1,
519 ), 606 ),
520 ); 607 );
521 }), 608 }),
522 Expanded( 609 Expanded(
523 child: Container( 610 child: Container(
524 - color: MyColours.color_ffffff, 611 + color: MyColours.color_f5f5f5,
525 padding: EdgeInsets.symmetric( 612 padding: EdgeInsets.symmetric(
526 - horizontal: ScreenUtil().setWidth(40)), 613 + horizontal: ScreenUtil().setWidth(24)),
527 width: double.infinity, 614 width: double.infinity,
528 child: list(tableManagerModel.areas)), 615 child: list(tableManagerModel.areas)),
529 ), 616 ),
530 - // Expanded(  
531 - // child: Container(  
532 - // color: MyColours.color_e5e5e5,  
533 - // padding: EdgeInsets.symmetric(  
534 - // vertical: ScreenUtil().setHeight(10),  
535 - // horizontal: ScreenUtil().setWidth(9)),  
536 - // child: Column(  
537 - // children: [  
538 - // Expanded(  
539 - // child: GridView.builder(  
540 - // gridDelegate:  
541 - // SliverGridDelegateWithFixedCrossAxisCount(  
542 - // crossAxisCount: 3,  
543 - // childAspectRatio: 8 / 9),  
544 - // itemBuilder: (context, index) {  
545 - // return Selector<TableManagerModel,  
546 - // t.Table>(  
547 - // shouldRebuild: (pre, next) => true,  
548 - // selector: (context, model) =>  
549 - // model.currentTables[index],  
550 - // builder: (context, table, _) {  
551 - // return TableItem(table,  
552 - // onSelected: (table) {  
553 - // if ((table as t.Table).selected) {  
554 - // tableManagerModel.selectTables  
555 - // .add(table);  
556 - // } else {  
557 - // tableManagerModel.selectTables  
558 - // .removeWhere((t) =>  
559 - // t.id == table.id);  
560 - // }  
561 - // DialogUtil.showTableManagerDialog(  
562 - // context, table)  
563 - // .then((value) {  
564 - // if (value != null) {  
565 - // switch (value) {  
566 - // case 1: //查看详情  
567 - // NavigatorUtil  
568 - // .goNotebookDetailPage(  
569 - // context,  
570 - // tableManagerModel  
571 - // .tableMap[  
572 - // table.id]  
573 - // .id);  
574 - // break;  
575 - // case 2: //订座  
576 - // NavigatorUtil.goNoteBookChangePage(  
577 - // context,  
578 - // NotebookDetail.fromTableManager(  
579 - // tableManagerModel  
580 - // .getCurrDdateStr(),  
581 - // tableManagerModel  
582 - // .currTimeIndex  
583 - // .toString(),  
584 - // table),  
585 - // "");  
586 - // break;  
587 - // case 3: //停用,启用桌位  
588 - // Map<String, String>  
589 - // params = {  
590 - // "id": (table as t.Table)  
591 - // .id,  
592 - // "status": (table as t  
593 - // .Table)  
594 - // .enable ==  
595 - // "1"  
596 - // ? "0"  
597 - // : "1"  
598 - // };  
599 - // tableManagerModel  
600 - // .setSwitchStatus(  
601 - // context, params)  
602 - // .then((value) {  
603 - // if (value != null) {  
604 - // (table as t.Table)  
605 - // .enable =  
606 - // ((int.parse((table as t.Table)  
607 - // .enable) +  
608 - // 1) %  
609 - // 2)  
610 - // .toString();  
611 - // if ((table as t.Table)  
612 - // .enable ==  
613 - // "1") {  
614 - // for (Area area  
615 - // in tableManagerModel  
616 - // .areas) {  
617 - // if (area.name ==  
618 - // tableManagerModel  
619 - // .currentArea) {  
620 - // if (table.sign !=  
621 - // '5' &&  
622 - // table.sign !=  
623 - // '1') {  
624 - // //已预订  
625 - // area.count++;  
626 - // }  
627 - // break;  
628 - // }  
629 - // }  
630 - // } else {  
631 - // for (Area area  
632 - // in tableManagerModel  
633 - // .areas) {  
634 - // if (area.name ==  
635 - // tableManagerModel  
636 - // .currentArea) {  
637 - // if (table.sign !=  
638 - // '5' &&  
639 - // table.sign !=  
640 - // '1') {  
641 - // //已预订  
642 - // area.count--;  
643 - // }  
644 - // break;  
645 - // }  
646 - // }  
647 - // }  
648 - // tableManagerModel  
649 - // .notifyListeners();  
650 - // }  
651 - // });  
652 - // break;  
653 - // }  
654 - // }  
655 - // });  
656 - // },  
657 - // canSelected: false,  
658 - // fromPage: 'table_manage',  
659 - // tableMap:  
660 - // tableManagerModel.tableMap,  
661 - // rid: "");  
662 - // },  
663 - // );  
664 - // },  
665 - // itemCount: tableManagerModel  
666 - // .currentTables.length,  
667 - // )),  
668 - // ],  
669 - // )),  
670 - // )  
671 - // ],  
672 ]), 617 ]),
673 ); 618 );
674 } 619 }
@@ -122,7 +122,8 @@ class TableManagerModel with ChangeNotifier { @@ -122,7 +122,8 @@ class TableManagerModel with ChangeNotifier {
122 if (temp.length > 0) { 122 if (temp.length > 0) {
123 getReserveList(context); 123 getReserveList(context);
124 } else { 124 } else {
125 - pageState = PageState.Empty; 125 + // pageState = PageState.Empty;
  126 + pageState = PageState.Success;
126 notifyListeners(); 127 notifyListeners();
127 } 128 }
128 } 129 }
@@ -261,7 +262,7 @@ class TableManagerModel with ChangeNotifier { @@ -261,7 +262,7 @@ class TableManagerModel with ChangeNotifier {
261 notifyListeners(); 262 notifyListeners();
262 } 263 }
263 if ((baseResp.data[0] as List).isEmpty) { 264 if ((baseResp.data[0] as List).isEmpty) {
264 - pageState = PageState.Empty; 265 + pageState = PageState.Success;
265 notifyListeners(); 266 notifyListeners();
266 return []; 267 return [];
267 } 268 }
@@ -420,7 +421,7 @@ class TableManagerModel with ChangeNotifier { @@ -420,7 +421,7 @@ class TableManagerModel with ChangeNotifier {
420 areaTableMap["${outer.name}"] = outer.list; 421 areaTableMap["${outer.name}"] = outer.list;
421 Area area = Area(); 422 Area area = Area();
422 area.name = outer.name; 423 area.name = outer.name;
423 - area.count = outer.list.length == 0 ? -1 : count; 424 + area.count = outer.list.length == 0 ? -1 : count;
424 areas.add(area); 425 areas.add(area);
425 } 426 }
426 if (areaTableMap.isNotEmpty) { 427 if (areaTableMap.isNotEmpty) {
@@ -428,7 +429,8 @@ class TableManagerModel with ChangeNotifier { @@ -428,7 +429,8 @@ class TableManagerModel with ChangeNotifier {
428 currentTables = areaTableMap[currentArea]; 429 currentTables = areaTableMap[currentArea];
429 pageState = PageState.Success; 430 pageState = PageState.Success;
430 } else { 431 } else {
431 - pageState = PageState.Empty; 432 + // pageState = PageState.Empty;
  433 + pageState = PageState.Success;
432 } 434 }
433 435
434 notifyListeners(); 436 notifyListeners();
1 import 'dart:convert'; 1 import 'dart:convert';
  2 +import 'dart:ui';
2 3
3 import 'package:common_utils/common_utils.dart'; 4 import 'package:common_utils/common_utils.dart';
4 import 'package:flutter/material.dart'; 5 import 'package:flutter/material.dart';
@@ -6,8 +7,10 @@ import 'package:flutter_picker/flutter_picker.dart'; @@ -6,8 +7,10 @@ import 'package:flutter_picker/flutter_picker.dart';
6 import 'package:flutter_screenutil/flutter_screenutil.dart'; 7 import 'package:flutter_screenutil/flutter_screenutil.dart';
7 import 'package:one_key/constant/constant.dart'; 8 import 'package:one_key/constant/constant.dart';
8 import 'package:one_key/models/remark.dart'; 9 import 'package:one_key/models/remark.dart';
  10 +import 'package:one_key/pages/home_enter_order/home_enter_order.dart';
9 import 'package:one_key/pages/message/message_dialog_item.dart'; 11 import 'package:one_key/pages/message/message_dialog_item.dart';
10 import 'package:one_key/provider/message_dialog_model.dart'; 12 import 'package:one_key/provider/message_dialog_model.dart';
  13 +import 'package:one_key/provider/table_manager_model.dart';
11 import 'package:one_key/res/colors.dart'; 14 import 'package:one_key/res/colors.dart';
12 import 'package:one_key/utils/misc.dart'; 15 import 'package:one_key/utils/misc.dart';
13 import 'package:one_key/route/navigator_util.dart'; 16 import 'package:one_key/route/navigator_util.dart';
@@ -36,112 +39,128 @@ class DialogUtil { @@ -36,112 +39,128 @@ class DialogUtil {
36 return Center( 39 return Center(
37 child: Container( 40 child: Container(
38 padding: 41 padding:
39 - EdgeInsets.symmetric(horizontal: ScreenUtil().setWidth(72)),  
40 - height: ScreenUtil().setWidth(380), 42 + EdgeInsets.symmetric(horizontal: ScreenUtil().setWidth(50)),
  43 + height: ScreenUtil().setWidth(207 * 2),
41 decoration: BoxDecoration( 44 decoration: BoxDecoration(
42 - borderRadius: BorderRadius.circular(ScreenUtil().setWidth(30))), 45 + borderRadius: BorderRadius.circular(ScreenUtil().setWidth(10))),
43 child: Card( 46 child: Card(
44 shape: RoundedRectangleBorder( 47 shape: RoundedRectangleBorder(
45 borderRadius: BorderRadius.all( 48 borderRadius: BorderRadius.all(
46 - Radius.circular(ScreenUtil().setWidth(30)))), //设置圆角  
47 - child: Column( 49 + Radius.circular(ScreenUtil().setWidth(10)))), //设置圆角
  50 + child: Stack(
48 children: [ 51 children: [
49 - VEmptyView(40),  
50 Container( 52 Container(
51 - // height: ScreenUtil().setWidth(48),  
52 - alignment: Alignment.center,  
53 - child: Text('新建区域',  
54 - style: TextStyle(  
55 - fontSize: ScreenUtil().setSp(36),  
56 - color: MyColours.color_199095)),  
57 - ),  
58 - Padding(  
59 - padding: EdgeInsets.symmetric(  
60 - horizontal: ScreenUtil().setWidth(40)),  
61 - child: Row(  
62 - crossAxisAlignment: CrossAxisAlignment.end, 53 + padding: EdgeInsets.all(ScreenUtil().setWidth(40)),
  54 + child: Column(
63 children: [ 55 children: [
64 - Text(  
65 - '区域名称',  
66 - style: TextStyle(  
67 - fontSize: ScreenUtil().setSp(30),  
68 - color: MyColours.color_199095), 56 + Container(
  57 + // height: ScreenUtil().setWidth(48),
  58 + alignment: Alignment.center,
  59 + child: Text('新建区域',
  60 + style: TextStyle(
  61 + fontWeight: FontWeight.bold,
  62 + fontSize: ScreenUtil().setSp(34),
  63 + color: MyColours.color_333333)),
69 ), 64 ),
70 - HEmptyView(10),  
71 - Expanded(  
72 - child: TextField(  
73 - controller: controller,  
74 - maxLines: 1,  
75 - // //光标颜色  
76 - // cursorColor:  
77 - // widget.isSelect ? Colors.white : MyColours.color_199095,  
78 - //输入文本的样式  
79 - style: TextStyle(  
80 - fontSize: ScreenUtil().setSp(26),  
81 - ),  
82 -  
83 - decoration: InputDecoration(  
84 - contentPadding: EdgeInsets.only(  
85 - top: 15, bottom: -15), //设置文字内容与边框距离  
86 - enabledBorder: UnderlineInputBorder(  
87 - borderSide:  
88 - BorderSide(color: MyColours.color_d8d8d8),  
89 - ),  
90 - focusedBorder: UnderlineInputBorder(  
91 - borderSide:  
92 - BorderSide(color: MyColours.color_d8d8d8), 65 + VEmptyView(60),
  66 + Container(
  67 + height: ScreenUtil().setWidth(28 * 2),
  68 + child: Row(
  69 + crossAxisAlignment: CrossAxisAlignment.start,
  70 + children: [
  71 + Text(
  72 + '*',
  73 + style: TextStyle(
  74 + fontSize: ScreenUtil().setSp(32),
  75 + color: MyColours.color_E95750),
93 ), 76 ),
94 - hintText: '点击输入区域名称',  
95 - hintStyle: TextStyle(  
96 - color: MyColours.color_999999,  
97 - fontSize: ScreenUtil().setSp(26), 77 + Text(
  78 + '区域名称',
  79 + style: TextStyle(
  80 + fontSize: ScreenUtil().setSp(32),
  81 + color: MyColours.color_333333),
98 ), 82 ),
99 - ),  
100 - onChanged: (value) {},  
101 - onEditingComplete: () {  
102 - FocusScope.of(context)  
103 - .requestFocus(FocusNode()); //点击空白处隐藏键盘  
104 - },  
105 - keyboardType: TextInputType.text, 83 + HEmptyView(40),
  84 + Expanded(
  85 + child: TextField(
  86 + controller: controller,
  87 + maxLines: 1,
  88 + // //光标颜色
  89 + // cursorColor:
  90 + // widget.isSelect ? Colors.white : MyColours.color_199095,
  91 + //输入文本的样式
  92 + style: TextStyle(
  93 + fontSize: ScreenUtil().setSp(30),
  94 + color: MyColours.color_333333),
  95 +
  96 + decoration: InputDecoration(
  97 + contentPadding: EdgeInsets.only(
  98 + bottom: ScreenUtil()
  99 + .setWidth(40)), //设置文字内容与边框距离
  100 + enabledBorder: UnderlineInputBorder(
  101 + borderSide: BorderSide(
  102 + color: MyColours.color_efefef),
  103 + ),
  104 + focusedBorder: UnderlineInputBorder(
  105 + borderSide: BorderSide(
  106 + color: MyColours.color_efefef,
  107 + width: ScreenUtil().setWidth(2)),
  108 + ),
  109 + hintText: '请输入区域名称',
  110 + hintStyle: TextStyle(
  111 + color: MyColours.color_999999,
  112 + fontSize: ScreenUtil().setSp(30),
  113 + ),
  114 + ),
  115 + onChanged: (value) {},
  116 + onEditingComplete: () {
  117 + FocusScope.of(context)
  118 + .requestFocus(FocusNode()); //点击空白处隐藏键盘
  119 + },
  120 + keyboardType: TextInputType.text,
  121 + ),
  122 + )
  123 + ],
106 ), 124 ),
107 - ) 125 + ),
  126 + VEmptyView(80),
  127 + RoundButton(
  128 + text: '保存',
  129 + width: ScreenUtil().setWidth(300),
  130 + height: ScreenUtil().setWidth(80),
  131 + radius: ScreenUtil().setWidth(10),
  132 + fontSize: 34,
  133 + onPressed: () {
  134 + if (controller.text.trim() == '') {
  135 + Utils.showToast('请输入区域名称!');
  136 + return;
  137 + }
  138 + onTap(controller.text);
  139 + Navigator.pop(context, controller.text);
  140 + })
108 ], 141 ],
109 ), 142 ),
110 ), 143 ),
111 - VEmptyView(60),  
112 - Row(  
113 - mainAxisAlignment: MainAxisAlignment.center,  
114 - children: [  
115 - RoundButton(  
116 - text: '取消',  
117 - width: ScreenUtil().setWidth(120),  
118 - height: ScreenUtil().setWidth(84),  
119 - gradientStart: MyColours.color_ffffff,  
120 - gradientEnd: MyColours.color_ffffff,  
121 - textColor: MyColours.color_199095,  
122 - borderColor: MyColours.color_199095,  
123 - isBold: false,  
124 - radius: ScreenUtil().setWidth(20),  
125 - onPressed: () { 144 + Positioned(
  145 + top: 0,
  146 + right: 0,
  147 + child: InkWell(
  148 + onTap: () {
126 Navigator.pop(context); 149 Navigator.pop(context);
127 }, 150 },
128 - ),  
129 - HEmptyView(40),  
130 - RoundButton(  
131 - text: '保存',  
132 - width: ScreenUtil().setWidth(120),  
133 - height: ScreenUtil().setWidth(84),  
134 - isBold: false,  
135 - radius: ScreenUtil().setWidth(20),  
136 - onPressed: () {  
137 - if (controller.text.trim() == '') {  
138 - Utils.showToast('请输入区域名称!');  
139 - return;  
140 - }  
141 - onTap(controller.text);  
142 - Navigator.pop(context, controller.text);  
143 - })  
144 - ], 151 + child: Container(
  152 + padding: EdgeInsets.only(
  153 + top: ScreenUtil().setWidth(30),
  154 + right: ScreenUtil().setWidth(40),
  155 + left: ScreenUtil().setWidth(40),
  156 + bottom: ScreenUtil().setWidth(40),
  157 + ),
  158 + child: Image.asset(
  159 + Utils.getImgPath('close'),
  160 + width: ScreenUtil().setWidth(28),
  161 + height: ScreenUtil().setWidth(28),
  162 + ),
  163 + )),
145 ) 164 )
146 ], 165 ],
147 ), 166 ),
@@ -152,6 +171,417 @@ class DialogUtil { @@ -152,6 +171,417 @@ class DialogUtil {
152 ); 171 );
153 } 172 }
154 173
  174 + static btnChoose(String title, double width, ClickCallback callback) {
  175 + return InkWell(
  176 + onTap: () {
  177 + callback(title);
  178 + },
  179 + child: Container(
  180 + padding: EdgeInsets.symmetric(
  181 + horizontal: ScreenUtil().setWidth(20),
  182 + vertical: ScreenUtil().setWidth(10)),
  183 + height: ScreenUtil().setWidth(60),
  184 + width: width,
  185 + decoration: BoxDecoration(
  186 + border: Border.all(
  187 + width: ScreenUtil().setWidth(2),
  188 + color: MyColours.color_199095),
  189 + borderRadius: BorderRadius.circular(ScreenUtil().setWidth(10))),
  190 + child: Row(
  191 + children: [
  192 + Expanded(
  193 + child: Text(
  194 + title,
  195 + style: TextStyle(
  196 + color: MyColours.color_199095,
  197 + fontSize: ScreenUtil().setWidth(28)),
  198 + )),
  199 + HEmptyView(10),
  200 + Image.asset(
  201 + Utils.getImgPath('enter_order_arrow'),
  202 + width: ScreenUtil().setWidth(20),
  203 + height: ScreenUtil().setWidth(10),
  204 + )
  205 + ],
  206 + )));
  207 + }
  208 +
  209 + static selectWidget(List<String> data, CustomCallBack onTap) {
  210 + return Container(
  211 + decoration: BoxDecoration(
  212 + color: MyColours.color_ffffff,
  213 + borderRadius: BorderRadius.circular(ScreenUtil().setWidth(10)),
  214 + border: Border.all(
  215 + color: MyColours.color_cccccc,
  216 + width: ScreenUtil().setWidth(2))),
  217 + width: ScreenUtil().setWidth(120 * 2),
  218 + constraints: BoxConstraints(
  219 + maxHeight: ScreenUtil().setWidth(140 * 2),
  220 + ),
  221 + child: ListView.builder(
  222 + padding:
  223 + EdgeInsets.symmetric(horizontal: ScreenUtil().setWidth(20)),
  224 + itemCount: data.length,
  225 + itemBuilder: (context, index) {
  226 + return InkWell(
  227 + onTap: () {
  228 + onTap(index);
  229 + },
  230 + child: Container(
  231 + padding: EdgeInsets.all(ScreenUtil().setWidth(20)),
  232 + decoration: BoxDecoration(
  233 + border: Border(
  234 + bottom: BorderSide(
  235 + color: MyColours.color_efefef,
  236 + width: ScreenUtil().setWidth(2)))),
  237 + child: Text(data[index],
  238 + style: TextStyle(
  239 + color: MyColours.color_199095,
  240 + fontSize: ScreenUtil().setSp(28))),
  241 + ),
  242 + );
  243 + }));
  244 + }
  245 +
  246 + static Future openCreateTableDialog(BuildContext context, List<String> areas,
  247 + int currentAreaIndex, List<String> pnum,
  248 + {CustomCallBack onTap}) async {
  249 + TextEditingController controller = TextEditingController();
  250 + FocusNode focusNode = FocusNode();
  251 + bool showArea = true;
  252 + bool showPnumMin = true;
  253 + bool showPnumMax = true;
  254 + String pnumMin = '';
  255 + String pnumMax = '';
  256 + StateSetter globalState;
  257 +// //输入框焦点
  258 +// focusNode.addListener(() {
  259 +// if (!focusNode.hasFocus) {
  260 +// // print('失去焦点');
  261 +
  262 +// } else {
  263 +// // print('得到焦点');
  264 +// globalState(() {
  265 +// showPnumMin = true;
  266 +// showPnumMax = true;
  267 +// showArea = true;
  268 +// });
  269 +// }
  270 +// });
  271 +
  272 + final action = await showDialog(
  273 + context: context,
  274 + barrierDismissible: false,
  275 + builder: (BuildContext context) {
  276 + return StatefulBuilder(builder: (context, state) {
  277 + globalState = state;
  278 + return Center(
  279 + child: Container(
  280 + padding:
  281 + EdgeInsets.symmetric(horizontal: ScreenUtil().setWidth(50)),
  282 + height: ScreenUtil().setWidth(326 * 2),
  283 + decoration: BoxDecoration(
  284 + borderRadius:
  285 + BorderRadius.circular(ScreenUtil().setWidth(10))),
  286 + child: Card(
  287 + shape: RoundedRectangleBorder(
  288 + borderRadius: BorderRadius.all(
  289 + Radius.circular(ScreenUtil().setWidth(10)))), //设置圆角
  290 + child: Stack(
  291 + overflow: Overflow.visible,
  292 + children: [
  293 + Container(
  294 + padding: EdgeInsets.all(ScreenUtil().setWidth(40)),
  295 + child: Column(
  296 + children: [
  297 + Container(
  298 + // height: ScreenUtil().setWidth(48),
  299 + alignment: Alignment.center,
  300 + child: Text('新建桌位',
  301 + style: TextStyle(
  302 + fontWeight: FontWeight.bold,
  303 + fontSize: ScreenUtil().setSp(34),
  304 + color: MyColours.color_333333)),
  305 + ),
  306 + VEmptyView(60),
  307 + Container(
  308 + height: ScreenUtil().setWidth(30 * 2),
  309 + child: Row(
  310 + crossAxisAlignment: CrossAxisAlignment.center,
  311 + children: [
  312 + Text(
  313 + '*',
  314 + style: TextStyle(
  315 + fontSize: ScreenUtil().setSp(32),
  316 + color: MyColours.color_E95750),
  317 + ),
  318 + Text(
  319 + '选择区域',
  320 + style: TextStyle(
  321 + fontSize: ScreenUtil().setSp(32),
  322 + color: MyColours.color_333333),
  323 + ),
  324 + HEmptyView(40),
  325 + // Stack(
  326 + // overflow: Overflow.visible,
  327 + // children: [
  328 + btnChoose(areas[currentAreaIndex],
  329 + ScreenUtil().setWidth(120 * 2), (value) {
  330 + state(() {
  331 + showPnumMin = true;
  332 + showPnumMax = true;
  333 + showArea = !showArea;
  334 + });
  335 + }),
  336 + ],
  337 + ),
  338 + ),
  339 + VEmptyView(60),
  340 + Container(
  341 + height: ScreenUtil().setWidth(28 * 2),
  342 + child: Row(
  343 + crossAxisAlignment: CrossAxisAlignment.start,
  344 + children: [
  345 + Text(
  346 + '*',
  347 + style: TextStyle(
  348 + fontSize: ScreenUtil().setSp(32),
  349 + color: MyColours.color_E95750),
  350 + ),
  351 + Text(
  352 + '桌位名称',
  353 + style: TextStyle(
  354 + fontSize: ScreenUtil().setSp(32),
  355 + color: MyColours.color_333333),
  356 + ),
  357 + HEmptyView(40),
  358 + Expanded(
  359 + child: TextField(
  360 + controller: controller,
  361 + maxLines: 1,
  362 + focusNode: focusNode,
  363 + // //光标颜色
  364 + // cursorColor:
  365 + // widget.isSelect ? Colors.white : MyColours.color_199095,
  366 + //输入文本的样式
  367 + style: TextStyle(
  368 + fontSize: ScreenUtil().setSp(30),
  369 + color: MyColours.color_333333),
  370 +
  371 + decoration: InputDecoration(
  372 + contentPadding: EdgeInsets.only(
  373 + bottom: ScreenUtil()
  374 + .setWidth(40)), //设置文字内容与边框距离
  375 + enabledBorder: UnderlineInputBorder(
  376 + borderSide: BorderSide(
  377 + color: MyColours.color_efefef),
  378 + ),
  379 + focusedBorder: UnderlineInputBorder(
  380 + borderSide: BorderSide(
  381 + color: MyColours.color_efefef,
  382 + width: ScreenUtil().setWidth(2)),
  383 + ),
  384 + hintText: '请输入桌位名称',
  385 + hintStyle: TextStyle(
  386 + color: MyColours.color_999999,
  387 + fontSize: ScreenUtil().setSp(30),
  388 + ),
  389 + ),
  390 + onChanged: (value) {},
  391 + onEditingComplete: () {
  392 + FocusScope.of(context).requestFocus(
  393 + FocusNode()); //点击空白处隐藏键盘
  394 + },
  395 + keyboardType: TextInputType.text,
  396 + ),
  397 + )
  398 + ],
  399 + ),
  400 + ),
  401 + VEmptyView(60),
  402 + Container(
  403 + height: ScreenUtil().setWidth(30 * 2),
  404 + child: Row(
  405 + crossAxisAlignment: CrossAxisAlignment.center,
  406 + children: [
  407 + Text(
  408 + '*',
  409 + style: TextStyle(
  410 + fontSize: ScreenUtil().setSp(32),
  411 + color: MyColours.color_E95750),
  412 + ),
  413 + Text(
  414 + '人数(选填)',
  415 + style: TextStyle(
  416 + fontSize: ScreenUtil().setSp(32),
  417 + color: MyColours.color_333333),
  418 + ),
  419 + HEmptyView(40),
  420 + // Stack(
  421 + // overflow: Overflow.visible,
  422 + // children: [
  423 + btnChoose(
  424 + pnumMin, ScreenUtil().setWidth(52 * 2),
  425 + (value) {
  426 + state(() {
  427 + showArea = true;
  428 + showPnumMax = true;
  429 + showPnumMin = !showPnumMin;
  430 + });
  431 + }),
  432 + HEmptyView(20),
  433 + Text(
  434 + '至',
  435 + style: TextStyle(
  436 + fontSize: ScreenUtil().setSp(30),
  437 + color: MyColours.color_199095),
  438 + ),
  439 + HEmptyView(20),
  440 + btnChoose(
  441 + pnumMax, ScreenUtil().setWidth(52 * 2),
  442 + (value) {
  443 + state(() {
  444 + showArea = true;
  445 + showPnumMin = true;
  446 + showPnumMax = !showPnumMax;
  447 + });
  448 + }),
  449 + ],
  450 + ),
  451 + ),
  452 + VEmptyView(80),
  453 + RoundButton(
  454 + text: '保存',
  455 + width: ScreenUtil().setWidth(300),
  456 + height: ScreenUtil().setWidth(80),
  457 + radius: ScreenUtil().setWidth(10),
  458 + fontSize: 34,
  459 + onPressed: () {
  460 + if (controller.text.trim() == '') {
  461 + Utils.showToast('请输入桌位名称!');
  462 + return;
  463 + }
  464 + // 当前选中区域
  465 + // areas[currentAreaIndex]
  466 + //最低人数
  467 + // pnumMin
  468 + //最高人数
  469 + // pnumMax
  470 +
  471 + onTap(controller.text);
  472 + Navigator.pop(context, controller.text);
  473 + })
  474 + ],
  475 + ),
  476 + ),
  477 + Positioned(
  478 + left: ScreenUtil().setWidth(113 * 2),
  479 + top: ScreenUtil().setWidth(105 * 2),
  480 + child: Offstage(
  481 + offstage: showArea,
  482 + child: selectWidget(areas, (index) {
  483 + state(() {
  484 + showArea = !showArea;
  485 + currentAreaIndex = index;
  486 + });
  487 + }),
  488 + // child: Container(
  489 + // decoration: BoxDecoration(
  490 + // color: MyColours.color_ffffff,
  491 + // borderRadius: BorderRadius.circular(
  492 + // ScreenUtil().setWidth(10)),
  493 + // border: Border.all(
  494 + // color: MyColours.color_cccccc,
  495 + // width: ScreenUtil().setWidth(2))),
  496 + // width: ScreenUtil().setWidth(120 * 2),
  497 + // height: ScreenUtil().setWidth(140 * 2),
  498 + // child: ListView.builder(
  499 + // padding: EdgeInsets.symmetric(
  500 + // horizontal:
  501 + // ScreenUtil().setWidth(20)),
  502 + // itemCount: areas.length,
  503 + // itemBuilder: (context, index) {
  504 + // return InkWell(
  505 + // onTap: () {
  506 + // state(() {
  507 + // showArea = !showArea;
  508 + // currentAreaIndex = index;
  509 + // });
  510 + // },
  511 + // child: Container(
  512 + // padding: EdgeInsets.all(
  513 + // ScreenUtil().setWidth(20)),
  514 + // decoration: BoxDecoration(
  515 + // border: Border(
  516 + // bottom: BorderSide(
  517 + // color: MyColours
  518 + // .color_efefef,
  519 + // width: ScreenUtil()
  520 + // .setWidth(2)))),
  521 + // child: Text(areas[index],
  522 + // style: TextStyle(
  523 + // color:
  524 + // MyColours.color_199095,
  525 + // fontSize: ScreenUtil()
  526 + // .setSp(28))),
  527 + // ),
  528 + // );
  529 + // }))
  530 + )),
  531 + Positioned(
  532 + left: ScreenUtil().setWidth(136 * 2),
  533 + top: ScreenUtil().setWidth(221 * 2),
  534 + child: Offstage(
  535 + offstage: showPnumMin,
  536 + child: selectWidget(pnum, (index) {
  537 + state(() {
  538 + showPnumMin = !showPnumMin;
  539 + pnumMin = pnum[index];
  540 + });
  541 + }),
  542 + )),
  543 + Positioned(
  544 + left: ScreenUtil().setWidth(223 * 2),
  545 + top: ScreenUtil().setWidth(221 * 2),
  546 + child: Offstage(
  547 + offstage: showPnumMax,
  548 + child: selectWidget(pnum, (index) {
  549 + state(() {
  550 + showPnumMax = !showPnumMax;
  551 + pnumMax = pnum[index];
  552 + });
  553 + }),
  554 + )),
  555 + Positioned(
  556 + top: 0,
  557 + right: 0,
  558 + child: InkWell(
  559 + onTap: () {
  560 + Navigator.pop(context);
  561 + },
  562 + child: Container(
  563 + padding: EdgeInsets.only(
  564 + top: ScreenUtil().setWidth(30),
  565 + right: ScreenUtil().setWidth(40),
  566 + left: ScreenUtil().setWidth(40),
  567 + bottom: ScreenUtil().setWidth(40),
  568 + ),
  569 + child: Image.asset(
  570 + Utils.getImgPath('close'),
  571 + width: ScreenUtil().setWidth(28),
  572 + height: ScreenUtil().setWidth(28),
  573 + ),
  574 + )),
  575 + )
  576 + ],
  577 + ),
  578 + ),
  579 + ),
  580 + );
  581 + });
  582 + });
  583 + }
  584 +
155 //跳转拨打电话页面 585 //跳转拨打电话页面
156 static goPhone(String phoneNum) async { 586 static goPhone(String phoneNum) async {
157 String url = "tel:$phoneNum"; 587 String url = "tel:$phoneNum";