Showing
16 changed files
with
2808 additions
and
487 deletions
| 1 | import 'package:flutter/material.dart'; | 1 | import 'package:flutter/material.dart'; |
| 2 | +import 'package:one_key/utils/utils.dart'; | ||
| 2 | 3 | ||
| 3 | ///菜单 | 4 | ///菜单 |
| 4 | 5 | ||
| @@ -14,6 +15,8 @@ class MenuModel { | @@ -14,6 +15,8 @@ class MenuModel { | ||
| 14 | int allSum; //总共选中菜数量 | 15 | int allSum; //总共选中菜数量 |
| 15 | bool isChange = false; //是否发生数量变化 | 16 | bool isChange = false; //是否发生数量变化 |
| 16 | 17 | ||
| 18 | + List<dynamic> cookbooklistShow; | ||
| 19 | + | ||
| 17 | MenuModel( | 20 | MenuModel( |
| 18 | {this.id, | 21 | {this.id, |
| 19 | this.sellerid, | 22 | this.sellerid, |
| @@ -111,6 +114,9 @@ class MenuSunModel { | @@ -111,6 +114,9 @@ class MenuSunModel { | ||
| 111 | TextEditingController amountC = TextEditingController(); | 114 | TextEditingController amountC = TextEditingController(); |
| 112 | int moreSum = 0; //排菜编辑页展示选中总数 | 115 | int moreSum = 0; //排菜编辑页展示选中总数 |
| 113 | 116 | ||
| 117 | + String nameType = '3'; //1左侧,2右侧,3顶部分开 | ||
| 118 | + String imageType = '1'; //1大图,2小图 | ||
| 119 | + | ||
| 114 | MenuSunModel( | 120 | MenuSunModel( |
| 115 | {this.id, | 121 | {this.id, |
| 116 | this.sellerid, | 122 | this.sellerid, |
| @@ -141,7 +147,9 @@ class MenuSunModel { | @@ -141,7 +147,9 @@ class MenuSunModel { | ||
| 141 | this.practice, | 147 | this.practice, |
| 142 | this.amount = 0, | 148 | this.amount = 0, |
| 143 | this.cookList, | 149 | this.cookList, |
| 144 | - this.amountC}); | 150 | + this.amountC, |
| 151 | + this.nameType, | ||
| 152 | + this.imageType}); | ||
| 145 | 153 | ||
| 146 | MenuSunModel.fromJson(Map<String, dynamic> json) { | 154 | MenuSunModel.fromJson(Map<String, dynamic> json) { |
| 147 | id = json['id']; | 155 | id = json['id']; |
| @@ -178,6 +186,10 @@ class MenuSunModel { | @@ -178,6 +186,10 @@ class MenuSunModel { | ||
| 178 | cookList.add(new MenuModel.fromJson2(v)); | 186 | cookList.add(new MenuModel.fromJson2(v)); |
| 179 | }); | 187 | }); |
| 180 | } | 188 | } |
| 189 | + // imageType = Utils.randomGet(1, 3) ?? '1'; | ||
| 190 | + // nameType = Utils.randomGet(1, 4) ?? '3'; | ||
| 191 | + imageType = name == '小炒肉' || name == '水煮肉片' || name == '西湖牛肉羹'? '2' : '1'; | ||
| 192 | + nameType = '1'; | ||
| 181 | } | 193 | } |
| 182 | 194 | ||
| 183 | MenuSunModel.fromJson3(Map<String, dynamic> json) { | 195 | MenuSunModel.fromJson3(Map<String, dynamic> json) { |
| @@ -12,6 +12,7 @@ import 'package:one_key/provider/menu_provider.dart'; | @@ -12,6 +12,7 @@ import 'package:one_key/provider/menu_provider.dart'; | ||
| 12 | import 'package:one_key/provider/upload_img_provider.dart'; | 12 | import 'package:one_key/provider/upload_img_provider.dart'; |
| 13 | import 'package:one_key/provider/user_model.dart'; | 13 | import 'package:one_key/provider/user_model.dart'; |
| 14 | import 'package:one_key/res/colors.dart'; | 14 | import 'package:one_key/res/colors.dart'; |
| 15 | +import 'package:one_key/route/navigator_util.dart'; | ||
| 15 | import 'package:one_key/utils/dialog_util.dart'; | 16 | import 'package:one_key/utils/dialog_util.dart'; |
| 16 | import 'package:one_key/utils/event_bus.dart'; | 17 | import 'package:one_key/utils/event_bus.dart'; |
| 17 | import 'package:one_key/utils/upload_image_util.dart'; | 18 | import 'package:one_key/utils/upload_image_util.dart'; |
| @@ -24,6 +25,8 @@ import 'package:one_key/widgets/v_empty_view.dart'; | @@ -24,6 +25,8 @@ import 'package:one_key/widgets/v_empty_view.dart'; | ||
| 24 | import 'package:permission_handler/permission_handler.dart'; | 25 | import 'package:permission_handler/permission_handler.dart'; |
| 25 | import 'package:provider/provider.dart'; | 26 | import 'package:provider/provider.dart'; |
| 26 | 27 | ||
| 28 | +import '../../../utils/screen_util.dart'; | ||
| 29 | + | ||
| 27 | /** | 30 | /** |
| 28 | * | 31 | * |
| 29 | * 添加菜品页面 | 32 | * 添加菜品页面 |
| @@ -202,7 +205,8 @@ class _MenuAddDishesPageState extends State<MenuAddDishesPage> { | @@ -202,7 +205,8 @@ class _MenuAddDishesPageState extends State<MenuAddDishesPage> { | ||
| 202 | FocusNode focusNode, | 205 | FocusNode focusNode, |
| 203 | String subTitle, | 206 | String subTitle, |
| 204 | {bool needStar = true, | 207 | {bool needStar = true, |
| 205 | - TextInputType inputType = TextInputType.number}) { | 208 | + TextInputType inputType = TextInputType.number, |
| 209 | + double fontsize = 16}) { | ||
| 206 | return Container( | 210 | return Container( |
| 207 | child: Row( | 211 | child: Row( |
| 208 | mainAxisAlignment: MainAxisAlignment.spaceBetween, | 212 | mainAxisAlignment: MainAxisAlignment.spaceBetween, |
| @@ -211,19 +215,18 @@ class _MenuAddDishesPageState extends State<MenuAddDishesPage> { | @@ -211,19 +215,18 @@ class _MenuAddDishesPageState extends State<MenuAddDishesPage> { | ||
| 211 | child: Text( | 215 | child: Text( |
| 212 | title, | 216 | title, |
| 213 | style: TextStyle( | 217 | style: TextStyle( |
| 214 | - color: MyColours.color_333333, | ||
| 215 | - fontWeight: FontWeight.bold, | ||
| 216 | - fontSize: ScreenUtil().setSp(34)), | 218 | + color: MyColours.color_515151, |
| 219 | + fontSize: ScreenUtil().setSp(32)), | ||
| 217 | ), | 220 | ), |
| 218 | ), | 221 | ), |
| 219 | - HEmptyView(20), | 222 | + HEmptyView(10), |
| 220 | needStar | 223 | needStar |
| 221 | ? Container( | 224 | ? Container( |
| 225 | + padding: EdgeInsets.only(top: w(5)), | ||
| 222 | child: Text( | 226 | child: Text( |
| 223 | '*', | 227 | '*', |
| 224 | style: TextStyle( | 228 | style: TextStyle( |
| 225 | - color: MyColours.color_199095, | ||
| 226 | - fontWeight: FontWeight.bold, | 229 | + color: MyColours.color_515151, |
| 227 | ), | 230 | ), |
| 228 | ), | 231 | ), |
| 229 | ) | 232 | ) |
| @@ -233,9 +236,9 @@ class _MenuAddDishesPageState extends State<MenuAddDishesPage> { | @@ -233,9 +236,9 @@ class _MenuAddDishesPageState extends State<MenuAddDishesPage> { | ||
| 233 | child: Container( | 236 | child: Container( |
| 234 | // height: ScreenUtil().setHeight(120), | 237 | // height: ScreenUtil().setHeight(120), |
| 235 | padding: EdgeInsets.only( | 238 | padding: EdgeInsets.only( |
| 236 | - left: ScreenUtil().setWidth(20), | ||
| 237 | - right: ScreenUtil().setWidth(10), | ||
| 238 | - top: ScreenUtil().setWidth(8)), | 239 | + left: ScreenUtil().setWidth(20), |
| 240 | + right: ScreenUtil().setWidth(10), | ||
| 241 | + ), | ||
| 239 | child: TextField( | 242 | child: TextField( |
| 240 | controller: editingController, | 243 | controller: editingController, |
| 241 | textAlign: TextAlign.right, | 244 | textAlign: TextAlign.right, |
| @@ -248,7 +251,8 @@ class _MenuAddDishesPageState extends State<MenuAddDishesPage> { | @@ -248,7 +251,8 @@ class _MenuAddDishesPageState extends State<MenuAddDishesPage> { | ||
| 248 | // widget.isSelect ? Colors.white : MyColours.color_199095, | 251 | // widget.isSelect ? Colors.white : MyColours.color_199095, |
| 249 | //输入文本的样式 | 252 | //输入文本的样式 |
| 250 | style: TextStyle( | 253 | style: TextStyle( |
| 251 | - fontSize: ScreenUtil().setSp(32), | 254 | + color: MyColours.color_515151, |
| 255 | + fontSize: w(fontsize), | ||
| 252 | ), | 256 | ), |
| 253 | focusNode: focusNode, | 257 | focusNode: focusNode, |
| 254 | decoration: InputDecoration( | 258 | decoration: InputDecoration( |
| @@ -256,7 +260,7 @@ class _MenuAddDishesPageState extends State<MenuAddDishesPage> { | @@ -256,7 +260,7 @@ class _MenuAddDishesPageState extends State<MenuAddDishesPage> { | ||
| 256 | hintText: hintText, | 260 | hintText: hintText, |
| 257 | hintStyle: TextStyle( | 261 | hintStyle: TextStyle( |
| 258 | color: MyColours.color_999999, | 262 | color: MyColours.color_999999, |
| 259 | - fontSize: ScreenUtil().setSp(32), | 263 | + fontSize: w(fontsize), |
| 260 | ), | 264 | ), |
| 261 | enabledBorder: new UnderlineInputBorder( | 265 | enabledBorder: new UnderlineInputBorder( |
| 262 | borderSide: BorderSide.none, | 266 | borderSide: BorderSide.none, |
| @@ -294,7 +298,7 @@ class _MenuAddDishesPageState extends State<MenuAddDishesPage> { | @@ -294,7 +298,7 @@ class _MenuAddDishesPageState extends State<MenuAddDishesPage> { | ||
| 294 | return InkWell( | 298 | return InkWell( |
| 295 | onTap: callback, | 299 | onTap: callback, |
| 296 | child: Container( | 300 | child: Container( |
| 297 | - padding: EdgeInsets.symmetric(vertical: ScreenUtil().setWidth(40)), | 301 | + // padding: EdgeInsets.symmetric(vertical: ScreenUtil().setWidth(40)), |
| 298 | child: Row( | 302 | child: Row( |
| 299 | crossAxisAlignment: CrossAxisAlignment.center, | 303 | crossAxisAlignment: CrossAxisAlignment.center, |
| 300 | mainAxisAlignment: MainAxisAlignment.center, | 304 | mainAxisAlignment: MainAxisAlignment.center, |
| @@ -303,19 +307,18 @@ class _MenuAddDishesPageState extends State<MenuAddDishesPage> { | @@ -303,19 +307,18 @@ class _MenuAddDishesPageState extends State<MenuAddDishesPage> { | ||
| 303 | child: Text( | 307 | child: Text( |
| 304 | title, | 308 | title, |
| 305 | style: TextStyle( | 309 | style: TextStyle( |
| 306 | - color: MyColours.color_333333, | ||
| 307 | - fontWeight: FontWeight.bold, | ||
| 308 | - fontSize: ScreenUtil().setSp(34)), | 310 | + color: MyColours.color_515151, |
| 311 | + fontSize: ScreenUtil().setSp(32)), | ||
| 309 | ), | 312 | ), |
| 310 | ), | 313 | ), |
| 311 | - HEmptyView(20), | 314 | + HEmptyView(10), |
| 312 | needStar | 315 | needStar |
| 313 | ? Container( | 316 | ? Container( |
| 317 | + padding: EdgeInsets.only(top: w(5)), | ||
| 314 | child: Text( | 318 | child: Text( |
| 315 | '*', | 319 | '*', |
| 316 | style: TextStyle( | 320 | style: TextStyle( |
| 317 | - color: MyColours.color_199095, | ||
| 318 | - fontWeight: FontWeight.bold, | 321 | + color: MyColours.color_515151, |
| 319 | ), | 322 | ), |
| 320 | ), | 323 | ), |
| 321 | ) | 324 | ) |
| @@ -323,11 +326,13 @@ class _MenuAddDishesPageState extends State<MenuAddDishesPage> { | @@ -323,11 +326,13 @@ class _MenuAddDishesPageState extends State<MenuAddDishesPage> { | ||
| 323 | Spacer(), | 326 | Spacer(), |
| 324 | Text(hintText, | 327 | Text(hintText, |
| 325 | style: TextStyle( | 328 | style: TextStyle( |
| 326 | - color: hintText == '请选择' | 329 | + color: hintText == '请选择' || |
| 330 | + hintText == '点击配置菜品价格' || | ||
| 331 | + hintText == '点击配置菜品做法' || | ||
| 332 | + hintText == '点击配置烹调方法' | ||
| 327 | ? MyColours.color_999999 | 333 | ? MyColours.color_999999 |
| 328 | - : MyColours.color_333333, | ||
| 329 | - fontWeight: | ||
| 330 | - hintText == '请选择' ? FontWeight.normal : FontWeight.bold, | 334 | + : MyColours.color_515151, |
| 335 | + fontWeight: FontWeight.normal, | ||
| 331 | fontSize: ScreenUtil().setSp(32), | 336 | fontSize: ScreenUtil().setSp(32), |
| 332 | )), | 337 | )), |
| 333 | HEmptyView(20), | 338 | HEmptyView(20), |
| @@ -373,6 +378,68 @@ class _MenuAddDishesPageState extends State<MenuAddDishesPage> { | @@ -373,6 +378,68 @@ class _MenuAddDishesPageState extends State<MenuAddDishesPage> { | ||
| 373 | } | 378 | } |
| 374 | } | 379 | } |
| 375 | 380 | ||
| 381 | + ///券说明 | ||
| 382 | + Widget _explain(String title, String hintText, | ||
| 383 | + TextEditingController controller, FocusNode node) { | ||
| 384 | + return Container( | ||
| 385 | + // height: ScreenUtil().setWidth(380), | ||
| 386 | + // padding: EdgeInsets.symmetric(vertical: ScreenUtil().setWidth(28)), | ||
| 387 | + child: Column( | ||
| 388 | + crossAxisAlignment: CrossAxisAlignment.start, | ||
| 389 | + children: [ | ||
| 390 | + Container( | ||
| 391 | + alignment: Alignment.centerLeft, | ||
| 392 | + padding: EdgeInsets.only(left: w(16), top: w(14), bottom: w(10)), | ||
| 393 | + // height: w(48), | ||
| 394 | + child: Text( | ||
| 395 | + title, | ||
| 396 | + textAlign: TextAlign.left, | ||
| 397 | + style: TextStyle( | ||
| 398 | + color: MyColours.color_515151, | ||
| 399 | + fontSize: ScreenUtil().setSp(32)), | ||
| 400 | + )), | ||
| 401 | + // Padding( | ||
| 402 | + // padding: EdgeInsets.only(left: w(16)), | ||
| 403 | + // child: MyDivider( | ||
| 404 | + // double.infinity, | ||
| 405 | + // w(0.5), | ||
| 406 | + // color: MyColours.color_E7E7E7, | ||
| 407 | + // )), | ||
| 408 | + Padding( | ||
| 409 | + padding: EdgeInsets.only(left: w(20), bottom: w(20)), | ||
| 410 | + child: TextField( | ||
| 411 | + controller: controller, | ||
| 412 | + focusNode: node, | ||
| 413 | + // keyboardType: TextInputType.number, //键盘类型,数字键盘 | ||
| 414 | + maxLines: 3, | ||
| 415 | + maxLength: 500, | ||
| 416 | + | ||
| 417 | + // maxLengthEnforced: true, | ||
| 418 | + style: TextStyle( | ||
| 419 | + fontSize: ScreenUtil().setSp(24), | ||
| 420 | + color: MyColours.color_515151), //输入文本的样式 | ||
| 421 | + decoration: InputDecoration( | ||
| 422 | + contentPadding: EdgeInsets.all(ScreenUtil().setWidth(30)), | ||
| 423 | + hintText: hintText, | ||
| 424 | + hintStyle: TextStyle( | ||
| 425 | + color: MyColours.color_999999, | ||
| 426 | + fontSize: ScreenUtil().setSp(24), | ||
| 427 | + ), | ||
| 428 | + border: OutlineInputBorder(borderSide: BorderSide.none), | ||
| 429 | + enabledBorder: new UnderlineInputBorder( | ||
| 430 | + borderSide: BorderSide.none, | ||
| 431 | + ), | ||
| 432 | + focusedBorder: new UnderlineInputBorder( | ||
| 433 | + borderSide: BorderSide.none, | ||
| 434 | + ), | ||
| 435 | + ), | ||
| 436 | + onChanged: (value) {}, | ||
| 437 | + )), | ||
| 438 | + ], | ||
| 439 | + ), | ||
| 440 | + ); | ||
| 441 | + } | ||
| 442 | + | ||
| 376 | @override | 443 | @override |
| 377 | Widget build(BuildContext context) { | 444 | Widget build(BuildContext context) { |
| 378 | uploadImageProvider = | 445 | uploadImageProvider = |
| @@ -487,99 +554,61 @@ class _MenuAddDishesPageState extends State<MenuAddDishesPage> { | @@ -487,99 +554,61 @@ class _MenuAddDishesPageState extends State<MenuAddDishesPage> { | ||
| 487 | swichState = !swichState; | 554 | swichState = !swichState; |
| 488 | }); | 555 | }); |
| 489 | }, | 556 | }, |
| 490 | - child: Padding( | 557 | + child: Container( |
| 558 | + height: w(48), | ||
| 491 | padding: EdgeInsets.symmetric( | 559 | padding: EdgeInsets.symmetric( |
| 492 | - horizontal: ScreenUtil().setWidth(40), | ||
| 493 | - vertical: ScreenUtil().setWidth(40), | 560 | + horizontal: ScreenUtil().setWidth(32), |
| 494 | ), | 561 | ), |
| 495 | child: Row( | 562 | child: Row( |
| 496 | mainAxisAlignment: | 563 | mainAxisAlignment: |
| 497 | MainAxisAlignment.spaceBetween, | 564 | MainAxisAlignment.spaceBetween, |
| 498 | children: [ | 565 | children: [ |
| 499 | - Column( | ||
| 500 | - crossAxisAlignment: | ||
| 501 | - CrossAxisAlignment.start, | ||
| 502 | - children: [ | ||
| 503 | - // Container( | ||
| 504 | - // child: Text( | ||
| 505 | - // swichState ? '启用' : '停用', | ||
| 506 | - // style: TextStyle( | ||
| 507 | - // color: MyColours.color_333333, | ||
| 508 | - // fontWeight: FontWeight.bold, | ||
| 509 | - // fontSize: ScreenUtil().setSp(34)), | ||
| 510 | - // ), | ||
| 511 | - // ), | ||
| 512 | - // VEmptyView(40), | ||
| 513 | - Container( | ||
| 514 | - child: Text( | ||
| 515 | - swichState | ||
| 516 | - ? '商品已上架,在所有点餐设备上显示' | ||
| 517 | - : '商品已下架', | ||
| 518 | - style: TextStyle( | ||
| 519 | - color: MyColours.color_666666, | ||
| 520 | - fontSize: ScreenUtil().setSp(24)), | ||
| 521 | - ), | ||
| 522 | - ), | ||
| 523 | - ], | 566 | + Container( |
| 567 | + child: Text( | ||
| 568 | + swichState ? '上架菜品,在所有点餐设备上显示' : '商品已下架', | ||
| 569 | + style: TextStyle( | ||
| 570 | + color: MyColours.color_666666, | ||
| 571 | + fontSize: ScreenUtil().setSp(24)), | ||
| 572 | + ), | ||
| 524 | ), | 573 | ), |
| 525 | Image.asset( | 574 | Image.asset( |
| 526 | swichState | 575 | swichState |
| 527 | ? Utils.getImgPath('swich_on') | 576 | ? Utils.getImgPath('swich_on') |
| 528 | : Utils.getImgPath('swich_off'), | 577 | : Utils.getImgPath('swich_off'), |
| 529 | - width: ScreenUtil().setWidth(122), | ||
| 530 | - height: ScreenUtil().setWidth(82), | 578 | + width: w(44), |
| 579 | + height: w(24), | ||
| 531 | ) | 580 | ) |
| 532 | ], | 581 | ], |
| 533 | )), | 582 | )), |
| 534 | ), | 583 | ), |
| 535 | - MyDivider( | ||
| 536 | - double.infinity, | ||
| 537 | - ScreenUtil().setWidth(20), | ||
| 538 | - color: Color.fromRGBO(235, 234, 239, 1), | ||
| 539 | - ), | ||
| 540 | - Container( | ||
| 541 | - height: ScreenUtil().setWidth(2), | ||
| 542 | - color: MyColours.color_efefef, | ||
| 543 | - margin: EdgeInsets.only( | ||
| 544 | - left: ScreenUtil().setWidth(40), | ||
| 545 | - right: ScreenUtil().setWidth(40)), | ||
| 546 | - ), | ||
| 547 | Padding( | 584 | Padding( |
| 585 | + padding: EdgeInsets.only(left: w(16)), | ||
| 586 | + child: MyDivider( | ||
| 587 | + double.infinity, | ||
| 588 | + w(0.5), | ||
| 589 | + color: MyColours.color_E7E7E7, | ||
| 590 | + )), | ||
| 591 | + Container( | ||
| 592 | + height: w(48), | ||
| 548 | padding: EdgeInsets.symmetric( | 593 | padding: EdgeInsets.symmetric( |
| 549 | - horizontal: ScreenUtil().setWidth(40), | 594 | + horizontal: ScreenUtil().setWidth(32), |
| 550 | ), | 595 | ), |
| 551 | - child: _textfield('菜品名称', '请输入菜品名称', | ||
| 552 | - _nameController, _nameFocusNode, '', | 596 | + child: _textfield('名称', '点击输入菜品名称', _nameController, |
| 597 | + _nameFocusNode, '', | ||
| 553 | inputType: TextInputType.text)), | 598 | inputType: TextInputType.text)), |
| 554 | - VEmptyView(10), | ||
| 555 | - Container( | ||
| 556 | - height: ScreenUtil().setWidth(2), | ||
| 557 | - color: MyColours.color_efefef, | ||
| 558 | - margin: EdgeInsets.only( | ||
| 559 | - left: ScreenUtil().setWidth(40), | ||
| 560 | - right: ScreenUtil().setWidth(40)), | ||
| 561 | - ), | ||
| 562 | - VEmptyView(10), | ||
| 563 | Padding( | 599 | Padding( |
| 564 | - padding: EdgeInsets.symmetric( | ||
| 565 | - horizontal: ScreenUtil().setWidth(40), | ||
| 566 | - ), | ||
| 567 | - child: _textfield('菜品价格', '请输入菜品价格', | ||
| 568 | - _priceController, _priceFocusNode, '元')), | ||
| 569 | - VEmptyView(10), | 600 | + padding: EdgeInsets.only(left: w(16)), |
| 601 | + child: MyDivider( | ||
| 602 | + double.infinity, | ||
| 603 | + w(0.5), | ||
| 604 | + color: MyColours.color_E7E7E7, | ||
| 605 | + )), | ||
| 570 | Container( | 606 | Container( |
| 571 | - height: ScreenUtil().setWidth(2), | ||
| 572 | - color: MyColours.color_efefef, | ||
| 573 | - margin: EdgeInsets.only( | ||
| 574 | - left: ScreenUtil().setWidth(40), | ||
| 575 | - right: ScreenUtil().setWidth(40)), | ||
| 576 | - ), | ||
| 577 | - VEmptyView(10), | ||
| 578 | - Padding( | 607 | + height: w(48), |
| 579 | padding: EdgeInsets.symmetric( | 608 | padding: EdgeInsets.symmetric( |
| 580 | - horizontal: ScreenUtil().setWidth(40), | 609 | + horizontal: ScreenUtil().setWidth(32), |
| 581 | ), | 610 | ), |
| 582 | - child: _select('菜品分类', categoryStr, () { | 611 | + child: _select('分类', categoryStr, () { |
| 583 | FocusScope.of(context) | 612 | FocusScope.of(context) |
| 584 | .requestFocus(FocusNode()); //点击空白处隐藏键盘 | 613 | .requestFocus(FocusNode()); //点击空白处隐藏键盘 |
| 585 | DialogUtil.showSelectCusmanDialog( | 614 | DialogUtil.showSelectCusmanDialog( |
| @@ -593,32 +622,81 @@ class _MenuAddDishesPageState extends State<MenuAddDishesPage> { | @@ -593,32 +622,81 @@ class _MenuAddDishesPageState extends State<MenuAddDishesPage> { | ||
| 593 | categoryStrList.indexOf(categoryStr) | 622 | categoryStrList.indexOf(categoryStr) |
| 594 | ]).then((value) {}); | 623 | ]).then((value) {}); |
| 595 | })), | 624 | })), |
| 596 | - VEmptyView(10), | ||
| 597 | - Container( | ||
| 598 | - height: ScreenUtil().setWidth(2), | ||
| 599 | - color: MyColours.color_efefef, | ||
| 600 | - margin: EdgeInsets.only( | ||
| 601 | - left: ScreenUtil().setWidth(40), | ||
| 602 | - right: ScreenUtil().setWidth(40))), | ||
| 603 | - VEmptyView(10), | ||
| 604 | Padding( | 625 | Padding( |
| 626 | + padding: EdgeInsets.only(left: w(16)), | ||
| 627 | + child: MyDivider( | ||
| 628 | + double.infinity, | ||
| 629 | + w(0.5), | ||
| 630 | + color: MyColours.color_E7E7E7, | ||
| 631 | + )), | ||
| 632 | + Container( | ||
| 633 | + height: w(48), | ||
| 605 | padding: EdgeInsets.symmetric( | 634 | padding: EdgeInsets.symmetric( |
| 606 | - horizontal: ScreenUtil().setWidth(40), | 635 | + horizontal: ScreenUtil().setWidth(32), |
| 607 | ), | 636 | ), |
| 608 | - child: _select('计价方式', specStr, () { | ||
| 609 | - FocusScope.of(context) | ||
| 610 | - .requestFocus(FocusNode()); //点击空白处隐藏键盘 | ||
| 611 | - DialogUtil.showSelectCusmanDialog( | ||
| 612 | - context, specStrList, (value) { | ||
| 613 | - if (value != null) { | ||
| 614 | - setState(() { | ||
| 615 | - specStr = specStrList[value.first]; | ||
| 616 | - }); | ||
| 617 | - } | ||
| 618 | - }, selecteds: [specStrList.indexOf(specStr)]) | ||
| 619 | - .then((value) {}); | 637 | + child: _select('价格', '点击配置菜品价格', () async { |
| 638 | + Map object = | ||
| 639 | + await NavigatorUtil.goMenuSetPricePage( | ||
| 640 | + context); | ||
| 641 | + if (object != null) { | ||
| 642 | + //选择了 | ||
| 643 | + } | ||
| 620 | })), | 644 | })), |
| 621 | - VEmptyView(10), | 645 | + Padding( |
| 646 | + padding: EdgeInsets.only(left: w(16)), | ||
| 647 | + child: MyDivider( | ||
| 648 | + double.infinity, | ||
| 649 | + w(0.5), | ||
| 650 | + color: MyColours.color_E7E7E7, | ||
| 651 | + )), | ||
| 652 | + Container( | ||
| 653 | + height: w(48), | ||
| 654 | + padding: EdgeInsets.symmetric( | ||
| 655 | + horizontal: ScreenUtil().setWidth(32), | ||
| 656 | + ), | ||
| 657 | + child: _select('做法', '点击配置菜品做法', () async { | ||
| 658 | + await NavigatorUtil.goMenuDishMethodPage(context); | ||
| 659 | + }, needStar: false)), | ||
| 660 | + Padding( | ||
| 661 | + padding: EdgeInsets.only(left: w(16)), | ||
| 662 | + child: MyDivider( | ||
| 663 | + double.infinity, | ||
| 664 | + w(0.5), | ||
| 665 | + color: MyColours.color_E7E7E7, | ||
| 666 | + )), | ||
| 667 | + Container( | ||
| 668 | + height: w(48), | ||
| 669 | + padding: EdgeInsets.symmetric( | ||
| 670 | + horizontal: ScreenUtil().setWidth(32), | ||
| 671 | + ), | ||
| 672 | + child: _textfield( | ||
| 673 | + '味型', '如咸鲜、香辣等,向客户介绍菜品味型', null, null, '', | ||
| 674 | + fontsize: 12, | ||
| 675 | + needStar: false, | ||
| 676 | + inputType: TextInputType.text)), | ||
| 677 | + Padding( | ||
| 678 | + padding: EdgeInsets.only(left: w(16)), | ||
| 679 | + child: MyDivider( | ||
| 680 | + double.infinity, | ||
| 681 | + w(0.5), | ||
| 682 | + color: MyColours.color_E7E7E7, | ||
| 683 | + )), | ||
| 684 | + Container( | ||
| 685 | + height: w(48), | ||
| 686 | + padding: EdgeInsets.symmetric( | ||
| 687 | + horizontal: ScreenUtil().setWidth(32), | ||
| 688 | + ), | ||
| 689 | + child: _textfield( | ||
| 690 | + '烹调', '如炙烤、熬煮、爆炒等,向客户介绍菜品烹调方法', null, null, '', | ||
| 691 | + fontsize: 12, needStar: false)), | ||
| 692 | + Padding( | ||
| 693 | + padding: EdgeInsets.only(left: w(16)), | ||
| 694 | + child: MyDivider( | ||
| 695 | + double.infinity, | ||
| 696 | + w(0.5), | ||
| 697 | + color: MyColours.color_E7E7E7, | ||
| 698 | + )), | ||
| 699 | + _explain('菜品简介', '请输入菜品简介', null, null) | ||
| 622 | ], | 700 | ], |
| 623 | ), | 701 | ), |
| 624 | )), | 702 | )), |
| 1 | +// import 'dart:io'; | ||
| 2 | + | ||
| 3 | +// import 'package:amap_map_fluttify/amap_map_fluttify.dart'; | ||
| 4 | +// import 'package:cached_network_image/cached_network_image.dart'; | ||
| 5 | +// import 'package:flutter/material.dart'; | ||
| 6 | +// import 'package:flutter_native_image/flutter_native_image.dart'; | ||
| 7 | +// import 'package:flutter_screenutil/flutter_screenutil.dart'; | ||
| 8 | +// import 'package:image_picker/image_picker.dart'; | ||
| 9 | +// import 'package:one_key/models/cookbook_model.dart'; | ||
| 10 | +// import 'package:one_key/models/upload_img_model.dart'; | ||
| 11 | +// import 'package:one_key/provider/menu_provider.dart'; | ||
| 12 | +// import 'package:one_key/provider/upload_img_provider.dart'; | ||
| 13 | +// import 'package:one_key/provider/user_model.dart'; | ||
| 14 | +// import 'package:one_key/res/colors.dart'; | ||
| 15 | +// import 'package:one_key/utils/dialog_util.dart'; | ||
| 16 | +// import 'package:one_key/utils/event_bus.dart'; | ||
| 17 | +// import 'package:one_key/utils/upload_image_util.dart'; | ||
| 18 | +// import 'package:one_key/utils/utils.dart'; | ||
| 19 | +// import 'package:one_key/widgets/MyDivider.dart'; | ||
| 20 | +// import 'package:one_key/widgets/h_empty_view.dart'; | ||
| 21 | +// import 'package:one_key/widgets/round_button.dart'; | ||
| 22 | +// import 'package:one_key/widgets/system_app_bar.dart'; | ||
| 23 | +// import 'package:one_key/widgets/v_empty_view.dart'; | ||
| 24 | +// import 'package:permission_handler/permission_handler.dart'; | ||
| 25 | +// import 'package:provider/provider.dart'; | ||
| 26 | + | ||
| 27 | +// /** | ||
| 28 | +// * | ||
| 29 | +// * 添加菜品页面 | ||
| 30 | +// */ | ||
| 31 | +// class MenuAddDishesPage extends StatefulWidget { | ||
| 32 | +// final bool isNew; | ||
| 33 | +// final String idstr; | ||
| 34 | +// MenuAddDishesPage({Key key, this.isNew, this.idstr}) : super(key: key); | ||
| 35 | + | ||
| 36 | +// @override | ||
| 37 | +// _MenuAddDishesPageState createState() => _MenuAddDishesPageState(); | ||
| 38 | +// } | ||
| 39 | + | ||
| 40 | +// class _MenuAddDishesPageState extends State<MenuAddDishesPage> { | ||
| 41 | +// bool swichState = true; | ||
| 42 | +// TextEditingController _nameController = TextEditingController(); | ||
| 43 | +// TextEditingController _priceController = TextEditingController(); | ||
| 44 | + | ||
| 45 | +// FocusNode _nameFocusNode = FocusNode(); | ||
| 46 | +// FocusNode _priceFocusNode = FocusNode(); | ||
| 47 | +// final picker = ImagePicker(); | ||
| 48 | +// UploadImageProvider uploadImageProvider; | ||
| 49 | +// MenuManageProvider menuManageProvider; | ||
| 50 | +// List<String> categoryStrList = []; | ||
| 51 | +// String categoryStr = '请选择'; | ||
| 52 | +// List<String> specStrList = []; | ||
| 53 | +// String specStr = '请选择'; | ||
| 54 | +// String mid = ''; | ||
| 55 | +// @override | ||
| 56 | +// void initState() { | ||
| 57 | +// super.initState(); | ||
| 58 | + | ||
| 59 | +// WidgetsBinding.instance.addPostFrameCallback((_) { | ||
| 60 | +// uploadImageProvider.dish.process = 0.01; | ||
| 61 | +// uploadImageProvider.dish.qiniuUrl = ''; | ||
| 62 | +// uploadImageProvider.notifyListeners(); | ||
| 63 | + | ||
| 64 | +// _getQiniuInfo(); | ||
| 65 | +// _getCookbookBySellerId(showLoading: false); | ||
| 66 | +// _getSpecBySellerid(); | ||
| 67 | +// if (!widget.isNew) { | ||
| 68 | +// _getCookbookById(); | ||
| 69 | +// } | ||
| 70 | +// }); | ||
| 71 | +// } | ||
| 72 | + | ||
| 73 | +// ///获取单个菜品信息 | ||
| 74 | +// _getCookbookById({bool showLoading = false}) async { | ||
| 75 | +// Map<String, String> params = { | ||
| 76 | +// "id": widget.idstr, | ||
| 77 | +// }; | ||
| 78 | +// await menuManageProvider.getCookbookById(context, params, | ||
| 79 | +// showLoading: showLoading); | ||
| 80 | +// if (menuManageProvider.cookbookOneSunModel != null) { | ||
| 81 | +// _nameController.text = menuManageProvider.cookbookOneSunModel.name; | ||
| 82 | +// swichState = | ||
| 83 | +// menuManageProvider.cookbookOneSunModel.status == '1' ? true : false; | ||
| 84 | +// _priceController.text = menuManageProvider.cookbookOneSunModel.price; | ||
| 85 | +// categoryStr = menuManageProvider.cookbookOneSunModel.className; | ||
| 86 | +// specStr = menuManageProvider.cookbookOneSunModel.unit; | ||
| 87 | +// mid = menuManageProvider.cookbookOneSunModel.id; | ||
| 88 | +// if (menuManageProvider.cookbookOneSunModel.image != null && | ||
| 89 | +// menuManageProvider.cookbookOneSunModel.image != 'null' && | ||
| 90 | +// menuManageProvider.cookbookOneSunModel.image != '') { | ||
| 91 | +// uploadImageProvider.dish.qiniuUrl = | ||
| 92 | +// menuManageProvider.cookbookOneSunModel.image; | ||
| 93 | +// } | ||
| 94 | + | ||
| 95 | +// setState(() {}); | ||
| 96 | +// } | ||
| 97 | +// } | ||
| 98 | + | ||
| 99 | +// ///计价方式 | ||
| 100 | +// _getSpecBySellerid({bool showLoading = false}) async { | ||
| 101 | +// Map<String, String> params = { | ||
| 102 | +// "sellerid": Provider.of<UserModel>(context, listen: false).user.sellerid, | ||
| 103 | +// }; | ||
| 104 | +// await menuManageProvider.getSpecBySellerid(context, params, | ||
| 105 | +// showLoading: showLoading); | ||
| 106 | +// if (menuManageProvider.specSunModel.length > 0) { | ||
| 107 | +// specStrList = []; | ||
| 108 | +// menuManageProvider.specSunModel.forEach((element) { | ||
| 109 | +// specStrList.add(element.name); | ||
| 110 | +// }); | ||
| 111 | +// } | ||
| 112 | +// } | ||
| 113 | + | ||
| 114 | +// ///添加菜品 | ||
| 115 | +// _addCookbook({bool showLoading = true}) async { | ||
| 116 | +// if (_nameController.text.trim().length == 0) { | ||
| 117 | +// Utils.showToast('请输入菜品名称'); | ||
| 118 | +// return; | ||
| 119 | +// } | ||
| 120 | +// if (_priceController.text.trim().length == 0) { | ||
| 121 | +// Utils.showToast('请输入菜品价格'); | ||
| 122 | +// return; | ||
| 123 | +// } | ||
| 124 | +// if (categoryStr == "请选择") { | ||
| 125 | +// Utils.showToast('请选择菜品分类'); | ||
| 126 | +// return; | ||
| 127 | +// } | ||
| 128 | +// if (specStr == "请选择") { | ||
| 129 | +// Utils.showToast('请选择计价方式'); | ||
| 130 | +// return; | ||
| 131 | +// } | ||
| 132 | +// String cid = ''; | ||
| 133 | +// // String unit = ''; | ||
| 134 | +// menuManageProvider.categorySunModel.forEach((element) { | ||
| 135 | +// if (element.className == categoryStr) { | ||
| 136 | +// cid = element.id; | ||
| 137 | +// } | ||
| 138 | +// }); | ||
| 139 | +// // menuManageProvider.specSunModel.forEach((element) { | ||
| 140 | +// // if (element.name == specStr) { | ||
| 141 | +// // unit = element.id; | ||
| 142 | +// // } | ||
| 143 | +// // }); | ||
| 144 | +// Map<String, String> params = { | ||
| 145 | +// "sellerid": Provider.of<UserModel>(context, listen: false).user.sellerid, | ||
| 146 | +// 'cid': cid, | ||
| 147 | +// 'unit': specStr, | ||
| 148 | +// 'name': _nameController.text, | ||
| 149 | +// 'status': swichState ? '1' : '0', | ||
| 150 | +// 'price': _priceController.text | ||
| 151 | +// }; | ||
| 152 | +// if (mid != '') { | ||
| 153 | +// params['id'] = mid; | ||
| 154 | +// } | ||
| 155 | +// if (uploadImageProvider.dish.qiniuUrl != null && | ||
| 156 | +// uploadImageProvider.dish.qiniuUrl != '') { | ||
| 157 | +// params['image'] = uploadImageProvider.dish.qiniuUrl; | ||
| 158 | +// } | ||
| 159 | +// bool sucess = false; | ||
| 160 | +// if (mid != '') { | ||
| 161 | +// sucess = await menuManageProvider.setCookbookById(context, params, | ||
| 162 | +// showLoading: showLoading); | ||
| 163 | +// } else { | ||
| 164 | +// sucess = await menuManageProvider.addCookbook(context, params, | ||
| 165 | +// showLoading: showLoading); | ||
| 166 | +// } | ||
| 167 | + | ||
| 168 | +// if (sucess) { | ||
| 169 | +// EventBus().emit('menu_manage_page'); | ||
| 170 | +// Navigator.of(context).pop(); | ||
| 171 | +// } | ||
| 172 | +// } | ||
| 173 | + | ||
| 174 | +// ///获取分类数据 | ||
| 175 | +// _getCookbookBySellerId({bool showLoading = true}) async { | ||
| 176 | +// Map<String, String> params = { | ||
| 177 | +// "SellerId": Provider.of<UserModel>(context, listen: false).user.sellerid, | ||
| 178 | +// }; | ||
| 179 | +// await menuManageProvider.getCookbookClassBySellerId(context, params, | ||
| 180 | +// showLoading: showLoading); | ||
| 181 | +// if (menuManageProvider.categorySunModel.length > 0) { | ||
| 182 | +// categoryStrList = []; | ||
| 183 | +// menuManageProvider.categorySunModel.forEach((element) { | ||
| 184 | +// if (element.className != '10道必点菜') { | ||
| 185 | +// categoryStrList.add(element.className); | ||
| 186 | +// } | ||
| 187 | +// }); | ||
| 188 | +// } | ||
| 189 | +// } | ||
| 190 | + | ||
| 191 | +// ///获取七牛云token | ||
| 192 | +// /// | ||
| 193 | +// _getQiniuInfo() async { | ||
| 194 | +// await uploadImageProvider.getQiniuInfo(context, {}); | ||
| 195 | +// } | ||
| 196 | + | ||
| 197 | +// ///输入框 | ||
| 198 | +// Widget _textfield( | ||
| 199 | +// String title, | ||
| 200 | +// String hintText, | ||
| 201 | +// TextEditingController editingController, | ||
| 202 | +// FocusNode focusNode, | ||
| 203 | +// String subTitle, | ||
| 204 | +// {bool needStar = true, | ||
| 205 | +// TextInputType inputType = TextInputType.number}) { | ||
| 206 | +// return Container( | ||
| 207 | +// child: Row( | ||
| 208 | +// mainAxisAlignment: MainAxisAlignment.spaceBetween, | ||
| 209 | +// children: [ | ||
| 210 | +// Container( | ||
| 211 | +// child: Text( | ||
| 212 | +// title, | ||
| 213 | +// style: TextStyle( | ||
| 214 | +// color: MyColours.color_333333, | ||
| 215 | +// fontWeight: FontWeight.bold, | ||
| 216 | +// fontSize: ScreenUtil().setSp(34)), | ||
| 217 | +// ), | ||
| 218 | +// ), | ||
| 219 | +// HEmptyView(20), | ||
| 220 | +// needStar | ||
| 221 | +// ? Container( | ||
| 222 | +// child: Text( | ||
| 223 | +// '*', | ||
| 224 | +// style: TextStyle( | ||
| 225 | +// color: MyColours.color_199095, | ||
| 226 | +// fontWeight: FontWeight.bold, | ||
| 227 | +// ), | ||
| 228 | +// ), | ||
| 229 | +// ) | ||
| 230 | +// : SizedBox(), | ||
| 231 | +// // Spacer(), | ||
| 232 | +// Expanded( | ||
| 233 | +// child: Container( | ||
| 234 | +// // height: ScreenUtil().setHeight(120), | ||
| 235 | +// padding: EdgeInsets.only( | ||
| 236 | +// left: ScreenUtil().setWidth(20), | ||
| 237 | +// right: ScreenUtil().setWidth(10), | ||
| 238 | +// top: ScreenUtil().setWidth(8)), | ||
| 239 | +// child: TextField( | ||
| 240 | +// controller: editingController, | ||
| 241 | +// textAlign: TextAlign.right, | ||
| 242 | +// // textAlignVertical: TextAlignVertical.bottom, | ||
| 243 | +// maxLines: 1, | ||
| 244 | +// inputFormatters: [], | ||
| 245 | + | ||
| 246 | +// // //光标颜色 | ||
| 247 | +// // cursorColor: | ||
| 248 | +// // widget.isSelect ? Colors.white : MyColours.color_199095, | ||
| 249 | +// //输入文本的样式 | ||
| 250 | +// style: TextStyle( | ||
| 251 | +// fontSize: ScreenUtil().setSp(32), | ||
| 252 | +// ), | ||
| 253 | +// focusNode: focusNode, | ||
| 254 | +// decoration: InputDecoration( | ||
| 255 | +// border: OutlineInputBorder(borderSide: BorderSide.none), | ||
| 256 | +// hintText: hintText, | ||
| 257 | +// hintStyle: TextStyle( | ||
| 258 | +// color: MyColours.color_999999, | ||
| 259 | +// fontSize: ScreenUtil().setSp(32), | ||
| 260 | +// ), | ||
| 261 | +// enabledBorder: new UnderlineInputBorder( | ||
| 262 | +// borderSide: BorderSide.none, | ||
| 263 | +// ), | ||
| 264 | +// focusedBorder: new UnderlineInputBorder( | ||
| 265 | +// borderSide: BorderSide.none, | ||
| 266 | +// ), | ||
| 267 | +// contentPadding: EdgeInsets.zero, | ||
| 268 | +// ), | ||
| 269 | +// onChanged: (value) {}, | ||
| 270 | +// onEditingComplete: () { | ||
| 271 | +// FocusScope.of(context) | ||
| 272 | +// .requestFocus(FocusNode()); //点击空白处隐藏键盘 | ||
| 273 | +// }, | ||
| 274 | +// keyboardType: inputType, | ||
| 275 | +// )), | ||
| 276 | +// ), | ||
| 277 | +// Container( | ||
| 278 | +// child: Text( | ||
| 279 | +// subTitle, | ||
| 280 | +// style: TextStyle( | ||
| 281 | +// color: MyColours.color_333333, | ||
| 282 | +// fontWeight: FontWeight.bold, | ||
| 283 | +// fontSize: ScreenUtil().setSp(32)), | ||
| 284 | +// ), | ||
| 285 | +// ), | ||
| 286 | +// ], | ||
| 287 | +// ), | ||
| 288 | +// ); | ||
| 289 | +// } | ||
| 290 | + | ||
| 291 | +// ///选择 | ||
| 292 | +// Widget _select(String title, String hintText, VoidCallback callback, | ||
| 293 | +// {bool needStar = true}) { | ||
| 294 | +// return InkWell( | ||
| 295 | +// onTap: callback, | ||
| 296 | +// child: Container( | ||
| 297 | +// padding: EdgeInsets.symmetric(vertical: ScreenUtil().setWidth(40)), | ||
| 298 | +// child: Row( | ||
| 299 | +// crossAxisAlignment: CrossAxisAlignment.center, | ||
| 300 | +// mainAxisAlignment: MainAxisAlignment.center, | ||
| 301 | +// children: [ | ||
| 302 | +// Container( | ||
| 303 | +// child: Text( | ||
| 304 | +// title, | ||
| 305 | +// style: TextStyle( | ||
| 306 | +// color: MyColours.color_333333, | ||
| 307 | +// fontWeight: FontWeight.bold, | ||
| 308 | +// fontSize: ScreenUtil().setSp(34)), | ||
| 309 | +// ), | ||
| 310 | +// ), | ||
| 311 | +// HEmptyView(20), | ||
| 312 | +// needStar | ||
| 313 | +// ? Container( | ||
| 314 | +// child: Text( | ||
| 315 | +// '*', | ||
| 316 | +// style: TextStyle( | ||
| 317 | +// color: MyColours.color_199095, | ||
| 318 | +// fontWeight: FontWeight.bold, | ||
| 319 | +// ), | ||
| 320 | +// ), | ||
| 321 | +// ) | ||
| 322 | +// : SizedBox(), | ||
| 323 | +// Spacer(), | ||
| 324 | +// Text(hintText, | ||
| 325 | +// style: TextStyle( | ||
| 326 | +// color: hintText == '请选择' | ||
| 327 | +// ? MyColours.color_999999 | ||
| 328 | +// : MyColours.color_333333, | ||
| 329 | +// fontWeight: | ||
| 330 | +// hintText == '请选择' ? FontWeight.normal : FontWeight.bold, | ||
| 331 | +// fontSize: ScreenUtil().setSp(32), | ||
| 332 | +// )), | ||
| 333 | +// HEmptyView(20), | ||
| 334 | +// Image.asset( | ||
| 335 | +// Utils.getImgPath('arr_right_gray'), | ||
| 336 | +// width: ScreenUtil().setWidth(12), | ||
| 337 | +// height: ScreenUtil().setWidth(22), | ||
| 338 | +// ) | ||
| 339 | +// ], | ||
| 340 | +// ), | ||
| 341 | +// ), | ||
| 342 | +// ); | ||
| 343 | +// } | ||
| 344 | + | ||
| 345 | +// // 当前的任务状态 | ||
| 346 | +// ///#相机拍照,单图选择 | ||
| 347 | +// _getFromPictureOrCamera(imageSource) async { | ||
| 348 | +// final pickedFile = await picker.pickImage(source: imageSource); | ||
| 349 | +// File compressedFile = await FlutterNativeImage.compressImage( | ||
| 350 | +// pickedFile.path, | ||
| 351 | +// quality: 50, | ||
| 352 | +// percentage: 50); | ||
| 353 | +// setState(() { | ||
| 354 | +// if (pickedFile != null) { | ||
| 355 | +// UploadImgModel imgModel = UploadImgModel(); | ||
| 356 | +// imgModel.file = compressedFile; | ||
| 357 | +// imgModel.process = 0.01; | ||
| 358 | +// uploadImageProvider.dish = imgModel; | ||
| 359 | +// } else { | ||
| 360 | +// print('No image selected.'); | ||
| 361 | +// } | ||
| 362 | +// }); | ||
| 363 | +// if (pickedFile != null) { | ||
| 364 | +// uploadImageProvider.dish.process = 0.01; | ||
| 365 | +// uploadImageProvider.dish.qiniuUrl = null; | ||
| 366 | +// bool need = await Utils.sizeNeed(File(pickedFile.path)); | ||
| 367 | +// File file = File(pickedFile.path); | ||
| 368 | +// if (need) { | ||
| 369 | +// file = File(compressedFile.absolute.path); | ||
| 370 | +// } | ||
| 371 | +// UploadImageUtil() | ||
| 372 | +// .startUploadOnly(context, file, 3, true, uploadImageProvider); | ||
| 373 | +// } | ||
| 374 | +// } | ||
| 375 | + | ||
| 376 | +// @override | ||
| 377 | +// Widget build(BuildContext context) { | ||
| 378 | +// uploadImageProvider = | ||
| 379 | +// Provider.of<UploadImageProvider>(context, listen: true); | ||
| 380 | +// menuManageProvider = Provider.of<MenuManageProvider>(context, listen: true); | ||
| 381 | +// return Material( | ||
| 382 | +// child: InkWell( | ||
| 383 | +// onTap: () { | ||
| 384 | +// FocusScope.of(context).requestFocus(FocusNode()); //点击空白处隐藏键盘 | ||
| 385 | +// }, | ||
| 386 | +// child: Scaffold( | ||
| 387 | +// appBar: SystemAppBar('添加菜品', onTap: () { | ||
| 388 | +// Navigator.pop(context); | ||
| 389 | +// }), | ||
| 390 | +// body: Column(children: [ | ||
| 391 | +// Expanded( | ||
| 392 | +// child: SingleChildScrollView( | ||
| 393 | +// child: Column( | ||
| 394 | +// children: [ | ||
| 395 | +// InkWell( | ||
| 396 | +// onTap: () { | ||
| 397 | +// DialogUtil.openImageModalBottomSheet(context, | ||
| 398 | +// lCallback: () { | ||
| 399 | +// Utils.getPickPermission(context, () { | ||
| 400 | +// _getFromPictureOrCamera(ImageSource.camera); | ||
| 401 | +// Navigator.pop(context); | ||
| 402 | +// }, Permission.camera); | ||
| 403 | +// }, rCallback: () { | ||
| 404 | +// Utils.getPickPermission(context, () { | ||
| 405 | +// _getFromPictureOrCamera(ImageSource.gallery); | ||
| 406 | +// // _getFromPictureOrCamera(ImageSource.gallery); | ||
| 407 | +// Navigator.pop(context); | ||
| 408 | +// }, | ||
| 409 | +// Platform.isAndroid | ||
| 410 | +// ? Permission.storage | ||
| 411 | +// : Permission.photos); | ||
| 412 | +// }); | ||
| 413 | +// }, | ||
| 414 | +// child: Stack(children: [ | ||
| 415 | +// uploadImageProvider.dish.file == null | ||
| 416 | +// ? uploadImageProvider.dish.qiniuUrl != null && | ||
| 417 | +// uploadImageProvider.dish.qiniuUrl != | ||
| 418 | +// '' | ||
| 419 | +// ? CachedNetworkImage( | ||
| 420 | +// imageUrl: | ||
| 421 | +// uploadImageProvider.dish.qiniuUrl, | ||
| 422 | +// fit: BoxFit.cover, | ||
| 423 | +// width: double.infinity, | ||
| 424 | +// height: ScreenUtil().setWidth(400), | ||
| 425 | +// ) | ||
| 426 | +// : Container( | ||
| 427 | +// width: double.infinity, | ||
| 428 | +// height: ScreenUtil().setWidth(400), | ||
| 429 | +// color: | ||
| 430 | +// Color.fromRGBO(235, 234, 239, 1), | ||
| 431 | +// child: Column( | ||
| 432 | +// mainAxisAlignment: | ||
| 433 | +// MainAxisAlignment.center, | ||
| 434 | +// children: [ | ||
| 435 | +// Container( | ||
| 436 | +// padding: EdgeInsets.all( | ||
| 437 | +// ScreenUtil().setWidth(34)), | ||
| 438 | +// decoration: BoxDecoration( | ||
| 439 | +// shape: BoxShape.circle, | ||
| 440 | +// border: Border.all( | ||
| 441 | +// width: ScreenUtil() | ||
| 442 | +// .setWidth(2), | ||
| 443 | +// color: MyColours | ||
| 444 | +// .color_c1c1c1, | ||
| 445 | +// )), | ||
| 446 | +// child: Image.asset( | ||
| 447 | +// Utils.getImgPath( | ||
| 448 | +// 'take-picture'), | ||
| 449 | +// width: ScreenUtil() | ||
| 450 | +// .setWidth(80)), | ||
| 451 | +// ), | ||
| 452 | +// VEmptyView(20), | ||
| 453 | +// Text( | ||
| 454 | +// '+菜谱效果图', | ||
| 455 | +// style: TextStyle( | ||
| 456 | +// fontSize: | ||
| 457 | +// ScreenUtil().setSp(30), | ||
| 458 | +// color: | ||
| 459 | +// MyColours.color_999999), | ||
| 460 | +// ) | ||
| 461 | +// ], | ||
| 462 | +// ), | ||
| 463 | +// ) | ||
| 464 | +// : Image.file( | ||
| 465 | +// uploadImageProvider.dish.file, | ||
| 466 | +// fit: BoxFit.cover, | ||
| 467 | +// width: double.infinity, | ||
| 468 | +// height: ScreenUtil().setWidth(400), | ||
| 469 | +// ), | ||
| 470 | +// (uploadImageProvider.dish.file != null) && | ||
| 471 | +// uploadImageProvider.dish.process != 1 && | ||
| 472 | +// uploadImageProvider.dish.process != 0.01 | ||
| 473 | +// ? Container( | ||
| 474 | +// width: double.infinity, | ||
| 475 | +// height: ScreenUtil().setWidth(400), | ||
| 476 | +// child: Center( | ||
| 477 | +// child: Text('上传中...', | ||
| 478 | +// style: TextStyle( | ||
| 479 | +// color: MyColours.color_999999)), | ||
| 480 | +// ), | ||
| 481 | +// ) | ||
| 482 | +// : Container(), | ||
| 483 | +// ])), | ||
| 484 | +// InkWell( | ||
| 485 | +// onTap: () { | ||
| 486 | +// setState(() { | ||
| 487 | +// swichState = !swichState; | ||
| 488 | +// }); | ||
| 489 | +// }, | ||
| 490 | +// child: Padding( | ||
| 491 | +// padding: EdgeInsets.symmetric( | ||
| 492 | +// horizontal: ScreenUtil().setWidth(40), | ||
| 493 | +// vertical: ScreenUtil().setWidth(40), | ||
| 494 | +// ), | ||
| 495 | +// child: Row( | ||
| 496 | +// mainAxisAlignment: | ||
| 497 | +// MainAxisAlignment.spaceBetween, | ||
| 498 | +// children: [ | ||
| 499 | +// Column( | ||
| 500 | +// crossAxisAlignment: | ||
| 501 | +// CrossAxisAlignment.start, | ||
| 502 | +// children: [ | ||
| 503 | +// // Container( | ||
| 504 | +// // child: Text( | ||
| 505 | +// // swichState ? '启用' : '停用', | ||
| 506 | +// // style: TextStyle( | ||
| 507 | +// // color: MyColours.color_333333, | ||
| 508 | +// // fontWeight: FontWeight.bold, | ||
| 509 | +// // fontSize: ScreenUtil().setSp(34)), | ||
| 510 | +// // ), | ||
| 511 | +// // ), | ||
| 512 | +// // VEmptyView(40), | ||
| 513 | +// Container( | ||
| 514 | +// child: Text( | ||
| 515 | +// swichState | ||
| 516 | +// ? '商品已上架,在所有点餐设备上显示' | ||
| 517 | +// : '商品已下架', | ||
| 518 | +// style: TextStyle( | ||
| 519 | +// color: MyColours.color_666666, | ||
| 520 | +// fontSize: ScreenUtil().setSp(24)), | ||
| 521 | +// ), | ||
| 522 | +// ), | ||
| 523 | +// ], | ||
| 524 | +// ), | ||
| 525 | +// Image.asset( | ||
| 526 | +// swichState | ||
| 527 | +// ? Utils.getImgPath('swich_on') | ||
| 528 | +// : Utils.getImgPath('swich_off'), | ||
| 529 | +// width: ScreenUtil().setWidth(122), | ||
| 530 | +// height: ScreenUtil().setWidth(82), | ||
| 531 | +// ) | ||
| 532 | +// ], | ||
| 533 | +// )), | ||
| 534 | +// ), | ||
| 535 | +// MyDivider( | ||
| 536 | +// double.infinity, | ||
| 537 | +// ScreenUtil().setWidth(20), | ||
| 538 | +// color: Color.fromRGBO(235, 234, 239, 1), | ||
| 539 | +// ), | ||
| 540 | +// Container( | ||
| 541 | +// height: ScreenUtil().setWidth(2), | ||
| 542 | +// color: MyColours.color_efefef, | ||
| 543 | +// margin: EdgeInsets.only( | ||
| 544 | +// left: ScreenUtil().setWidth(40), | ||
| 545 | +// right: ScreenUtil().setWidth(40)), | ||
| 546 | +// ), | ||
| 547 | +// Padding( | ||
| 548 | +// padding: EdgeInsets.symmetric( | ||
| 549 | +// horizontal: ScreenUtil().setWidth(40), | ||
| 550 | +// ), | ||
| 551 | +// child: _textfield('菜品名称', '请输入菜品名称', | ||
| 552 | +// _nameController, _nameFocusNode, '', | ||
| 553 | +// inputType: TextInputType.text)), | ||
| 554 | +// VEmptyView(10), | ||
| 555 | +// Container( | ||
| 556 | +// height: ScreenUtil().setWidth(2), | ||
| 557 | +// color: MyColours.color_efefef, | ||
| 558 | +// margin: EdgeInsets.only( | ||
| 559 | +// left: ScreenUtil().setWidth(40), | ||
| 560 | +// right: ScreenUtil().setWidth(40)), | ||
| 561 | +// ), | ||
| 562 | +// VEmptyView(10), | ||
| 563 | +// Padding( | ||
| 564 | +// padding: EdgeInsets.symmetric( | ||
| 565 | +// horizontal: ScreenUtil().setWidth(40), | ||
| 566 | +// ), | ||
| 567 | +// child: _textfield('菜品价格', '请输入菜品价格', | ||
| 568 | +// _priceController, _priceFocusNode, '元')), | ||
| 569 | +// VEmptyView(10), | ||
| 570 | +// Container( | ||
| 571 | +// height: ScreenUtil().setWidth(2), | ||
| 572 | +// color: MyColours.color_efefef, | ||
| 573 | +// margin: EdgeInsets.only( | ||
| 574 | +// left: ScreenUtil().setWidth(40), | ||
| 575 | +// right: ScreenUtil().setWidth(40)), | ||
| 576 | +// ), | ||
| 577 | +// VEmptyView(10), | ||
| 578 | +// Padding( | ||
| 579 | +// padding: EdgeInsets.symmetric( | ||
| 580 | +// horizontal: ScreenUtil().setWidth(40), | ||
| 581 | +// ), | ||
| 582 | +// child: _select('菜品分类', categoryStr, () { | ||
| 583 | +// FocusScope.of(context) | ||
| 584 | +// .requestFocus(FocusNode()); //点击空白处隐藏键盘 | ||
| 585 | +// DialogUtil.showSelectCusmanDialog( | ||
| 586 | +// context, categoryStrList, (value) { | ||
| 587 | +// if (value != null) { | ||
| 588 | +// setState(() { | ||
| 589 | +// categoryStr = categoryStrList[value.first]; | ||
| 590 | +// }); | ||
| 591 | +// } | ||
| 592 | +// }, selecteds: [ | ||
| 593 | +// categoryStrList.indexOf(categoryStr) | ||
| 594 | +// ]).then((value) {}); | ||
| 595 | +// })), | ||
| 596 | +// VEmptyView(10), | ||
| 597 | +// Container( | ||
| 598 | +// height: ScreenUtil().setWidth(2), | ||
| 599 | +// color: MyColours.color_efefef, | ||
| 600 | +// margin: EdgeInsets.only( | ||
| 601 | +// left: ScreenUtil().setWidth(40), | ||
| 602 | +// right: ScreenUtil().setWidth(40))), | ||
| 603 | +// VEmptyView(10), | ||
| 604 | +// Padding( | ||
| 605 | +// padding: EdgeInsets.symmetric( | ||
| 606 | +// horizontal: ScreenUtil().setWidth(40), | ||
| 607 | +// ), | ||
| 608 | +// child: _select('计价方式', specStr, () { | ||
| 609 | +// FocusScope.of(context) | ||
| 610 | +// .requestFocus(FocusNode()); //点击空白处隐藏键盘 | ||
| 611 | +// DialogUtil.showSelectCusmanDialog( | ||
| 612 | +// context, specStrList, (value) { | ||
| 613 | +// if (value != null) { | ||
| 614 | +// setState(() { | ||
| 615 | +// specStr = specStrList[value.first]; | ||
| 616 | +// }); | ||
| 617 | +// } | ||
| 618 | +// }, selecteds: [specStrList.indexOf(specStr)]) | ||
| 619 | +// .then((value) {}); | ||
| 620 | +// })), | ||
| 621 | +// VEmptyView(10), | ||
| 622 | +// ], | ||
| 623 | +// ), | ||
| 624 | +// )), | ||
| 625 | +// Padding( | ||
| 626 | +// padding: EdgeInsets.fromLTRB(ScreenUtil().setWidth(40), 0, | ||
| 627 | +// ScreenUtil().setWidth(40), ScreenUtil().setWidth(40)), | ||
| 628 | +// child: RoundButton( | ||
| 629 | +// onPressed: () async { | ||
| 630 | +// FocusScope.of(context) | ||
| 631 | +// .requestFocus(FocusNode()); //点击空白处隐藏键盘 | ||
| 632 | +// _addCookbook(); | ||
| 633 | +// }, | ||
| 634 | +// text: '保存', | ||
| 635 | +// fontSize: 34, | ||
| 636 | +// isBold: false, | ||
| 637 | +// height: ScreenUtil().setWidth(80), | ||
| 638 | +// width: double.infinity, | ||
| 639 | +// radius: ScreenUtil().setWidth(10), | ||
| 640 | +// )) | ||
| 641 | +// ])))); | ||
| 642 | +// } | ||
| 643 | +// } |
| 1 | +import 'package:flutter/material.dart'; | ||
| 2 | +import 'package:flutter_screenutil/flutter_screenutil.dart'; | ||
| 3 | +import 'package:one_key/res/colors.dart'; | ||
| 4 | +import 'package:one_key/utils/dialog_util.dart'; | ||
| 5 | +import 'package:one_key/widgets/system_app_bar.dart'; | ||
| 6 | + | ||
| 7 | +import '../../../utils/screen_util.dart'; | ||
| 8 | +import '../../../utils/utils.dart'; | ||
| 9 | +import '../../../widgets/round_button.dart'; | ||
| 10 | + | ||
| 11 | +/** | ||
| 12 | + * 菜品做法选择 | ||
| 13 | + */ | ||
| 14 | +class MenuDishMethodPage extends StatefulWidget { | ||
| 15 | + MenuDishMethodPage({Key key}) : super(key: key); | ||
| 16 | + | ||
| 17 | + @override | ||
| 18 | + _MenuDishMethodPageState createState() => _MenuDishMethodPageState(); | ||
| 19 | +} | ||
| 20 | + | ||
| 21 | +class _MenuDishMethodPageState extends State<MenuDishMethodPage> { | ||
| 22 | + List data = ['清蒸', '爆炒', '红烧', '椒盐']; | ||
| 23 | + @override | ||
| 24 | + Widget build(BuildContext context) { | ||
| 25 | + return Scaffold( | ||
| 26 | + backgroundColor: MyColours.color_DBDBDB, | ||
| 27 | + appBar: SystemAppBar('菜品做法选择'), | ||
| 28 | + body: Column( | ||
| 29 | + children: [ | ||
| 30 | + Container( | ||
| 31 | + width: double.infinity, | ||
| 32 | + height: w(48), | ||
| 33 | + padding: EdgeInsets.symmetric(horizontal: w(16)), | ||
| 34 | + alignment: Alignment.centerLeft, | ||
| 35 | + color: MyColours.color_ffffff, | ||
| 36 | + child: Text( | ||
| 37 | + '选择当前菜品支持选择的做法:', | ||
| 38 | + style: TextStyle( | ||
| 39 | + fontSize: font(16), color: MyColours.color_515151), | ||
| 40 | + )), | ||
| 41 | + Expanded( | ||
| 42 | + child: ListView.builder( | ||
| 43 | + itemCount: data.length + 1, | ||
| 44 | + shrinkWrap: true, | ||
| 45 | + itemBuilder: (context, index) { | ||
| 46 | + if ((index == 0 && data.length == 0) || | ||
| 47 | + data.length == index) { | ||
| 48 | + return InkWell( | ||
| 49 | + onTap: () { | ||
| 50 | + DialogUtil.textfeildAlertDialog(context, | ||
| 51 | + title: '添加做法', | ||
| 52 | + hintText: '输入菜品做法名称', rCallback: (name) { | ||
| 53 | + //确定添加 | ||
| 54 | + setState(() { | ||
| 55 | + data.add(name); | ||
| 56 | + }); | ||
| 57 | + }); | ||
| 58 | + }, | ||
| 59 | + child: Container( | ||
| 60 | + height: w(64), | ||
| 61 | + color: MyColours.color_ffffff, | ||
| 62 | + margin: EdgeInsets.only(top: w(10)), | ||
| 63 | + alignment: Alignment.center, | ||
| 64 | + child: Text( | ||
| 65 | + '添加做法', | ||
| 66 | + style: TextStyle( | ||
| 67 | + fontSize: font(24), | ||
| 68 | + color: MyColours.color_000000), | ||
| 69 | + ), | ||
| 70 | + )); | ||
| 71 | + } | ||
| 72 | + return Container( | ||
| 73 | + height: w(48), | ||
| 74 | + color: MyColours.color_ffffff, | ||
| 75 | + margin: EdgeInsets.only(top: w(10)), | ||
| 76 | + padding: EdgeInsets.symmetric(horizontal: w(16)), | ||
| 77 | + child: Row( | ||
| 78 | + mainAxisAlignment: MainAxisAlignment.spaceBetween, | ||
| 79 | + children: [ | ||
| 80 | + Text( | ||
| 81 | + data[index], | ||
| 82 | + style: TextStyle( | ||
| 83 | + fontSize: font(16), | ||
| 84 | + color: MyColours.color_515151), | ||
| 85 | + ), | ||
| 86 | + InkWell( | ||
| 87 | + onTap: () { | ||
| 88 | + setState(() {}); | ||
| 89 | + }, | ||
| 90 | + child: Image.asset( | ||
| 91 | + true | ||
| 92 | + ? Utils.getImgPath('swich_on') | ||
| 93 | + : Utils.getImgPath('swich_off'), | ||
| 94 | + width: w(44), | ||
| 95 | + height: w(24), | ||
| 96 | + )) | ||
| 97 | + ], | ||
| 98 | + )); | ||
| 99 | + })), | ||
| 100 | + Container( | ||
| 101 | + color: MyColours.color_ffffff, | ||
| 102 | + padding: EdgeInsets.fromLTRB(w(45), w(13), w(45), w(26)), | ||
| 103 | + child: RoundButton( | ||
| 104 | + onPressed: () async { | ||
| 105 | + FocusScope.of(context).requestFocus(FocusNode()); //点击空白处隐藏键盘 | ||
| 106 | + // _addCookbook(); | ||
| 107 | + }, | ||
| 108 | + text: '保存', | ||
| 109 | + fontSize: 34, | ||
| 110 | + isBold: false, | ||
| 111 | + height: ScreenUtil().setWidth(80), | ||
| 112 | + width: double.infinity, | ||
| 113 | + radius: ScreenUtil().setWidth(10), | ||
| 114 | + )) | ||
| 115 | + ], | ||
| 116 | + ), | ||
| 117 | + ); | ||
| 118 | + } | ||
| 119 | +} |
| 1 | import 'package:amap_map_fluttify/amap_map_fluttify.dart'; | 1 | import 'package:amap_map_fluttify/amap_map_fluttify.dart'; |
| 2 | import 'package:cached_network_image/cached_network_image.dart'; | 2 | import 'package:cached_network_image/cached_network_image.dart'; |
| 3 | import 'package:flutter/material.dart'; | 3 | import 'package:flutter/material.dart'; |
| 4 | -import 'package:flutter_easyrefresh/easy_refresh.dart'; | ||
| 5 | import 'package:flutter_screenutil/flutter_screenutil.dart'; | 4 | import 'package:flutter_screenutil/flutter_screenutil.dart'; |
| 6 | import 'package:one_key/constant/state.dart'; | 5 | import 'package:one_key/constant/state.dart'; |
| 7 | import 'package:one_key/models/cookbook_category_model.dart'; | 6 | import 'package:one_key/models/cookbook_category_model.dart'; |
| @@ -10,6 +9,7 @@ import 'package:one_key/provider/menu_provider.dart'; | @@ -10,6 +9,7 @@ import 'package:one_key/provider/menu_provider.dart'; | ||
| 10 | import 'package:one_key/provider/user_model.dart'; | 9 | import 'package:one_key/provider/user_model.dart'; |
| 11 | import 'package:one_key/res/colors.dart'; | 10 | import 'package:one_key/res/colors.dart'; |
| 12 | import 'package:one_key/route/navigator_util.dart'; | 11 | import 'package:one_key/route/navigator_util.dart'; |
| 12 | +import 'package:one_key/utils/dialog_util.dart'; | ||
| 13 | import 'package:one_key/utils/event_bus.dart'; | 13 | import 'package:one_key/utils/event_bus.dart'; |
| 14 | import 'package:one_key/utils/utils.dart'; | 14 | import 'package:one_key/utils/utils.dart'; |
| 15 | import 'package:one_key/widgets/MyDivider.dart'; | 15 | import 'package:one_key/widgets/MyDivider.dart'; |
| @@ -21,6 +21,8 @@ import 'package:one_key/widgets/v_empty_view.dart'; | @@ -21,6 +21,8 @@ import 'package:one_key/widgets/v_empty_view.dart'; | ||
| 21 | import 'package:provider/provider.dart'; | 21 | import 'package:provider/provider.dart'; |
| 22 | import 'package:flutter_staggered_grid_view/flutter_staggered_grid_view.dart'; | 22 | import 'package:flutter_staggered_grid_view/flutter_staggered_grid_view.dart'; |
| 23 | 23 | ||
| 24 | +import '../../../utils/screen_util.dart'; | ||
| 25 | + | ||
| 24 | class MenuManagePage extends StatefulWidget { | 26 | class MenuManagePage extends StatefulWidget { |
| 25 | MenuManagePage({Key key}) : super(key: key); | 27 | MenuManagePage({Key key}) : super(key: key); |
| 26 | 28 | ||
| @@ -86,13 +88,278 @@ class _MenuManagePageState extends State<MenuManagePage> { | @@ -86,13 +88,278 @@ class _MenuManagePageState extends State<MenuManagePage> { | ||
| 86 | 88 | ||
| 87 | await menuManageProvider.getCookbookByClass(context, params, | 89 | await menuManageProvider.getCookbookByClass(context, params, |
| 88 | showLoading: showLoading); | 90 | showLoading: showLoading); |
| 91 | + | ||
| 92 | + if (menuManageProvider.menuModel != null) { | ||
| 93 | + List<MenuModel> temp = []; | ||
| 94 | + for (int i = 0; i < menuManageProvider.menuModel.length; i++) { | ||
| 95 | + List<dynamic> listSub = []; | ||
| 96 | + for (int j = 0; | ||
| 97 | + j < menuManageProvider.menuModel[i].cookbooklist.length; | ||
| 98 | + j++) { | ||
| 99 | + MenuSunModel menuSunModel = | ||
| 100 | + menuManageProvider.menuModel[i].cookbooklist[j]; | ||
| 101 | + if (menuSunModel.imageType == '1') { | ||
| 102 | + //大图 | ||
| 103 | + listSub.add(menuSunModel); | ||
| 104 | + } else { | ||
| 105 | + //小图 | ||
| 106 | + //判断下一个是大图还是小图 | ||
| 107 | + if (menuManageProvider.menuModel[i].cookbooklist.length - 1 > j) { | ||
| 108 | + if (menuManageProvider | ||
| 109 | + .menuModel[i].cookbooklist[j + 1].imageType == | ||
| 110 | + '1') { | ||
| 111 | + //下一个是大图 | ||
| 112 | + listSub.add(menuSunModel); | ||
| 113 | + } else { | ||
| 114 | + //下一个是小图 | ||
| 115 | + | ||
| 116 | + List<MenuSunModel> subTemp = []; | ||
| 117 | + subTemp.add(menuSunModel); | ||
| 118 | + subTemp | ||
| 119 | + .add(menuManageProvider.menuModel[i].cookbooklist[j + 1]); | ||
| 120 | + listSub.add(subTemp); | ||
| 121 | + j++; | ||
| 122 | + } | ||
| 123 | + } else { | ||
| 124 | + listSub.add(menuSunModel); | ||
| 125 | + } | ||
| 126 | + } | ||
| 127 | + } | ||
| 128 | + menuManageProvider.menuModel[i].cookbooklistShow = listSub; | ||
| 129 | + temp.add(menuManageProvider.menuModel[i]); | ||
| 130 | + } | ||
| 131 | + | ||
| 132 | + menuManageProvider.menuModel = temp; | ||
| 133 | + } | ||
| 134 | + } | ||
| 135 | + //左边 | ||
| 136 | + | ||
| 137 | + Widget _topLeft(MenuSunModel model) { | ||
| 138 | + return Container( | ||
| 139 | + child: Column( | ||
| 140 | + crossAxisAlignment: CrossAxisAlignment.start, | ||
| 141 | + children: [ | ||
| 142 | + Text( | ||
| 143 | + model.name, | ||
| 144 | + style: TextStyle( | ||
| 145 | + fontWeight: FontWeight.bold, | ||
| 146 | + fontSize: font(20), | ||
| 147 | + color: MyColours.color_DBDBDB, | ||
| 148 | + shadows: [ | ||
| 149 | + BoxShadow( | ||
| 150 | + color: MyColours.color_000000, | ||
| 151 | + offset: Offset(0, 1), | ||
| 152 | + blurRadius: w(2), | ||
| 153 | + spreadRadius: w(20)) | ||
| 154 | + ]), | ||
| 155 | + ), | ||
| 156 | + VEmptyView(20), | ||
| 157 | + Text('味型:咸鲜 烹调:熬煮', | ||
| 158 | + style: | ||
| 159 | + TextStyle(fontSize: font(12), color: MyColours.color_DBDBDB)), | ||
| 160 | + VEmptyView(20), | ||
| 161 | + Text( | ||
| 162 | + '¥${model.price}/${model.unit} 会员 ¥${model.price}/${model.unit} ', | ||
| 163 | + textAlign: TextAlign.right, | ||
| 164 | + style: TextStyle( | ||
| 165 | + fontWeight: FontWeight.bold, | ||
| 166 | + fontSize: font(14), | ||
| 167 | + color: MyColours.color_DBDBDB, | ||
| 168 | + shadows: [ | ||
| 169 | + BoxShadow( | ||
| 170 | + color: MyColours.color_000000, | ||
| 171 | + offset: Offset(0, 1), | ||
| 172 | + blurRadius: w(2), | ||
| 173 | + spreadRadius: w(20)) | ||
| 174 | + ]), | ||
| 175 | + ), | ||
| 176 | + ], | ||
| 177 | + ), | ||
| 178 | + ); | ||
| 179 | + } | ||
| 180 | + | ||
| 181 | + //右边 | ||
| 182 | + Widget _topRight(MenuSunModel model) { | ||
| 183 | + return Container( | ||
| 184 | + child: Column( | ||
| 185 | + crossAxisAlignment: CrossAxisAlignment.end, | ||
| 186 | + children: [ | ||
| 187 | + Text( | ||
| 188 | + model.name, | ||
| 189 | + style: TextStyle( | ||
| 190 | + fontWeight: FontWeight.bold, | ||
| 191 | + fontSize: font(20), | ||
| 192 | + color: MyColours.color_DBDBDB, | ||
| 193 | + shadows: [ | ||
| 194 | + BoxShadow( | ||
| 195 | + color: MyColours.color_000000, | ||
| 196 | + offset: Offset(0, 1), | ||
| 197 | + blurRadius: w(2), | ||
| 198 | + spreadRadius: w(20)) | ||
| 199 | + ]), | ||
| 200 | + ), | ||
| 201 | + VEmptyView(20), | ||
| 202 | + Text('味型:咸鲜 烹调:熬煮', | ||
| 203 | + style: | ||
| 204 | + TextStyle(fontSize: font(12), color: MyColours.color_DBDBDB)), | ||
| 205 | + VEmptyView(20), | ||
| 206 | + Text( | ||
| 207 | + '¥${model.price}/${model.unit} 会员 ¥${model.price}/${model.unit} ', | ||
| 208 | + textAlign: TextAlign.right, | ||
| 209 | + style: TextStyle( | ||
| 210 | + fontWeight: FontWeight.bold, | ||
| 211 | + fontSize: font(14), | ||
| 212 | + color: MyColours.color_DBDBDB, | ||
| 213 | + shadows: [ | ||
| 214 | + BoxShadow( | ||
| 215 | + color: MyColours.color_000000, | ||
| 216 | + offset: Offset(0, 1), | ||
| 217 | + blurRadius: w(2), | ||
| 218 | + spreadRadius: w(20)) | ||
| 219 | + ]), | ||
| 220 | + ), | ||
| 221 | + ], | ||
| 222 | + ), | ||
| 223 | + ); | ||
| 224 | + } | ||
| 225 | + | ||
| 226 | +//顶部分开 | ||
| 227 | + Widget _topBetween(MenuSunModel model) { | ||
| 228 | + return Row( | ||
| 229 | + mainAxisAlignment: MainAxisAlignment.spaceBetween, | ||
| 230 | + crossAxisAlignment: CrossAxisAlignment.start, | ||
| 231 | + children: [ | ||
| 232 | + Container( | ||
| 233 | + width: w(134), | ||
| 234 | + child: Column( | ||
| 235 | + crossAxisAlignment: CrossAxisAlignment.start, | ||
| 236 | + children: [ | ||
| 237 | + Text( | ||
| 238 | + model.name, | ||
| 239 | + style: TextStyle( | ||
| 240 | + fontWeight: FontWeight.bold, | ||
| 241 | + fontSize: font(20), | ||
| 242 | + color: MyColours.color_DBDBDB, | ||
| 243 | + shadows: [ | ||
| 244 | + BoxShadow( | ||
| 245 | + color: MyColours.color_000000, | ||
| 246 | + offset: Offset(0, 1), | ||
| 247 | + blurRadius: w(2), | ||
| 248 | + spreadRadius: w(20)) | ||
| 249 | + ]), | ||
| 250 | + ), | ||
| 251 | + VEmptyView(20), | ||
| 252 | + Text('味型:咸鲜 烹调:熬煮', | ||
| 253 | + style: TextStyle( | ||
| 254 | + fontSize: font(12), color: MyColours.color_DBDBDB)) | ||
| 255 | + ], | ||
| 256 | + ), | ||
| 257 | + ), | ||
| 258 | + HEmptyView(10), | ||
| 259 | + Text( | ||
| 260 | + '¥${model.price}/${model.unit} 会员 ¥${model.price}/${model.unit} ', | ||
| 261 | + textAlign: TextAlign.right, | ||
| 262 | + style: TextStyle( | ||
| 263 | + fontWeight: FontWeight.bold, | ||
| 264 | + fontSize: font(14), | ||
| 265 | + color: MyColours.color_DBDBDB, | ||
| 266 | + shadows: [ | ||
| 267 | + BoxShadow( | ||
| 268 | + color: MyColours.color_000000, | ||
| 269 | + offset: Offset(0, 1), | ||
| 270 | + blurRadius: w(2), | ||
| 271 | + spreadRadius: w(20)) | ||
| 272 | + ]), | ||
| 273 | + ), | ||
| 274 | + ], | ||
| 275 | + ); | ||
| 276 | + } | ||
| 277 | + | ||
| 278 | + Widget _smallMenu(MenuSunModel model) { | ||
| 279 | + return Container( | ||
| 280 | + width: ScreenUtil().screenWidth / 2, | ||
| 281 | + color: MyColours.color_4D4E50, | ||
| 282 | + child: Column( | ||
| 283 | + crossAxisAlignment: CrossAxisAlignment.start, | ||
| 284 | + children: [ | ||
| 285 | + VEmptyView(30), | ||
| 286 | + Padding( | ||
| 287 | + padding: EdgeInsets.symmetric(horizontal: w(10)), | ||
| 288 | + child: Text( | ||
| 289 | + model.name, | ||
| 290 | + style: TextStyle( | ||
| 291 | + fontWeight: FontWeight.bold, | ||
| 292 | + fontSize: font(20), | ||
| 293 | + color: MyColours.color_DBDBDB, | ||
| 294 | + shadows: [ | ||
| 295 | + BoxShadow( | ||
| 296 | + color: MyColours.color_000000, | ||
| 297 | + offset: Offset(0, 1), | ||
| 298 | + blurRadius: w(2), | ||
| 299 | + spreadRadius: w(20)) | ||
| 300 | + ]), | ||
| 301 | + )), | ||
| 302 | + VEmptyView(20), | ||
| 303 | + Padding( | ||
| 304 | + padding: EdgeInsets.symmetric(horizontal: w(10)), | ||
| 305 | + child: Text('味型:咸鲜 烹调:熬煮', | ||
| 306 | + style: TextStyle( | ||
| 307 | + fontSize: font(12), color: MyColours.color_DBDBDB))), | ||
| 308 | + VEmptyView(20), | ||
| 309 | + Padding( | ||
| 310 | + padding: EdgeInsets.symmetric(horizontal: w(10)), | ||
| 311 | + child: Text( | ||
| 312 | + '¥${model.price}/${model.unit} 会员 ¥${model.price}/${model.unit} ', | ||
| 313 | + textAlign: TextAlign.right, | ||
| 314 | + style: TextStyle( | ||
| 315 | + fontWeight: FontWeight.bold, | ||
| 316 | + fontSize: font(14), | ||
| 317 | + color: MyColours.color_DBDBDB, | ||
| 318 | + shadows: [ | ||
| 319 | + BoxShadow( | ||
| 320 | + color: MyColours.color_000000, | ||
| 321 | + offset: Offset(0, 1), | ||
| 322 | + blurRadius: w(2), | ||
| 323 | + spreadRadius: w(20)) | ||
| 324 | + ]), | ||
| 325 | + )), | ||
| 326 | + VEmptyView(30), | ||
| 327 | + if (model.image != null) | ||
| 328 | + CachedNetworkImage( | ||
| 329 | + imageUrl: model.image, | ||
| 330 | + fit: BoxFit.cover, | ||
| 331 | + width: ScreenUtil().screenWidth / 2, | ||
| 332 | + height: w(125), | ||
| 333 | + ), | ||
| 334 | + if (true) | ||
| 335 | + Padding( | ||
| 336 | + padding: EdgeInsets.symmetric(horizontal: w(10), vertical: w(10)), | ||
| 337 | + child: Text( | ||
| 338 | + '江南传统名菜,口味咸鲜,汤白汁浓,肉质酥肥,笋清香脆嫩,鲜味浓厚。', | ||
| 339 | + style: TextStyle( | ||
| 340 | + color: MyColours.color_DBDBDB, fontSize: font(12)), | ||
| 341 | + ), | ||
| 342 | + ), | ||
| 343 | + Align( | ||
| 344 | + alignment: Alignment.centerRight, | ||
| 345 | + child: Padding( | ||
| 346 | + padding: | ||
| 347 | + EdgeInsets.only(right: w(20), top: w(19), bottom: w(19)), | ||
| 348 | + child: Image.asset( | ||
| 349 | + Utils.getImgPath('add_area'), | ||
| 350 | + width: w(22), | ||
| 351 | + ), | ||
| 352 | + )), | ||
| 353 | + ], | ||
| 354 | + ), | ||
| 355 | + ); | ||
| 89 | } | 356 | } |
| 90 | 357 | ||
| 91 | @override | 358 | @override |
| 92 | Widget build(BuildContext context) { | 359 | Widget build(BuildContext context) { |
| 93 | menuManageProvider = Provider.of<MenuManageProvider>(context, listen: true); | 360 | menuManageProvider = Provider.of<MenuManageProvider>(context, listen: true); |
| 94 | return Scaffold( | 361 | return Scaffold( |
| 95 | - backgroundColor: MyColours.color_ffffff, | 362 | + backgroundColor: MyColours.color_DBDBDB, |
| 96 | appBar: SystemAppBar( | 363 | appBar: SystemAppBar( |
| 97 | '菜单管理', | 364 | '菜单管理', |
| 98 | onTap: () { | 365 | onTap: () { |
| @@ -109,69 +376,99 @@ class _MenuManagePageState extends State<MenuManagePage> { | @@ -109,69 +376,99 @@ class _MenuManagePageState extends State<MenuManagePage> { | ||
| 109 | builder: (context, model, _) { | 376 | builder: (context, model, _) { |
| 110 | if (model.pageState != PageState.Success) { | 377 | if (model.pageState != PageState.Success) { |
| 111 | return Column(children: [ | 378 | return Column(children: [ |
| 112 | - Expanded( | ||
| 113 | - child: ExceptionPage( | ||
| 114 | - pageState: model.pageState, | ||
| 115 | - callback: () { | ||
| 116 | - // offset = 0; | ||
| 117 | - // getMessage(showLoading: true); | ||
| 118 | - // _couponNetworkData(); | ||
| 119 | - _getCookbookByClass(showLoading: true); | ||
| 120 | - }, | ||
| 121 | - emptyMsg: "菜品是空哒,快点击分类管理添加分类和菜品吧", | ||
| 122 | - emptyImg: "empty_search", | ||
| 123 | - showMsg: "加载中,请稍后...", | ||
| 124 | - )), | ||
| 125 | - Row( | ||
| 126 | - mainAxisAlignment: MainAxisAlignment.spaceBetween, | ||
| 127 | - children: [ | ||
| 128 | - !isShow | ||
| 129 | - ? SizedBox() | ||
| 130 | - : Padding( | ||
| 131 | - padding: EdgeInsets.fromLTRB( | ||
| 132 | - ScreenUtil().setWidth(40), | ||
| 133 | - 0, | ||
| 134 | - ScreenUtil().setWidth(40), | ||
| 135 | - ScreenUtil().setWidth(40)), | 379 | + model.pageState != PageState.Empty |
| 380 | + ? Expanded( | ||
| 381 | + child: ExceptionPage( | ||
| 382 | + pageState: model.pageState, | ||
| 383 | + callback: () { | ||
| 384 | + // offset = 0; | ||
| 385 | + // getMessage(showLoading: true); | ||
| 386 | + // _couponNetworkData(); | ||
| 387 | + _getCookbookByClass(showLoading: true); | ||
| 388 | + }, | ||
| 389 | + emptyMsg: "菜品是空哒,快点击分类管理添加分类和菜品吧", | ||
| 390 | + emptyImg: "empty_search", | ||
| 391 | + showMsg: "加载中,请稍后...", | ||
| 392 | + )) | ||
| 393 | + : Expanded( | ||
| 394 | + child: Container( | ||
| 395 | + color: MyColours.color_4D4E50, | ||
| 396 | + padding: EdgeInsets.symmetric(horizontal: w(20)), | ||
| 397 | + child: Column( | ||
| 398 | + crossAxisAlignment: CrossAxisAlignment.start, | ||
| 399 | + children: [ | ||
| 400 | + VEmptyView(222), | ||
| 401 | + Text( | ||
| 402 | + '您还没有创建菜谱,建议按照如下顺序创建店铺专属菜谱:\n1、点击分类管理创建菜谱分类,如热菜、凉菜等;\n2、点击添加菜品,创建菜品;\n3、在菜品列表中,长按菜品,可以配置菜品显示方式。\n', | ||
| 403 | + style: TextStyle( | ||
| 404 | + height: 1.3, | ||
| 405 | + color: MyColours.color_DBDBDB, | ||
| 406 | + fontSize: font(16), | ||
| 407 | + fontWeight: FontWeight.bold), | ||
| 408 | + ), | ||
| 409 | + VEmptyView(12), | ||
| 410 | + Text( | ||
| 411 | + '赶快来创建您的专业菜谱吧!', | ||
| 412 | + style: TextStyle( | ||
| 413 | + height: 1.3, | ||
| 414 | + color: MyColours.color_DBDBDB, | ||
| 415 | + fontSize: font(16), | ||
| 416 | + fontWeight: FontWeight.bold), | ||
| 417 | + ), | ||
| 418 | + ], | ||
| 419 | + ), | ||
| 420 | + )), | ||
| 421 | + Container( | ||
| 422 | + padding: EdgeInsets.symmetric(horizontal: w(23)), | ||
| 423 | + // height: w(80), | ||
| 424 | + child: Row( | ||
| 425 | + mainAxisAlignment: MainAxisAlignment.spaceBetween, | ||
| 426 | + children: [ | ||
| 427 | + Padding( | ||
| 428 | + padding: | ||
| 429 | + EdgeInsets.only(top: w(12), bottom: w(25)), | ||
| 136 | child: RoundButton( | 430 | child: RoundButton( |
| 137 | onPressed: () async { | 431 | onPressed: () async { |
| 138 | - await NavigatorUtil.goMenuAddDishesPage( | ||
| 139 | - context); | 432 | + bool needRefresh = |
| 433 | + await NavigatorUtil.goMenuCategoryPage( | ||
| 434 | + context); | ||
| 435 | + print(needRefresh); | ||
| 436 | + if (needRefresh != null && needRefresh) { | ||
| 437 | + //刷新页面数据 | ||
| 438 | + // _controller.callRefresh(); | ||
| 439 | + // _couponNetworkData(); | ||
| 440 | + } | ||
| 140 | }, | 441 | }, |
| 141 | - text: '添加\n菜品', | ||
| 142 | - fontSize: 26, | ||
| 143 | - isBold: false, | ||
| 144 | - height: ScreenUtil().setWidth(120), | ||
| 145 | - width: ScreenUtil().setWidth(120), | ||
| 146 | - radius: ScreenUtil().setWidth(60), | 442 | + text: '分类管理', |
| 443 | + fontSize: 32, | ||
| 444 | + gradientStart: MyColours.color_ffffff, | ||
| 445 | + gradientEnd: MyColours.color_ffffff, | ||
| 446 | + borderColor: MyColours.color_438E93, | ||
| 447 | + textColor: MyColours.color_438E93, | ||
| 448 | + isBold: true, | ||
| 449 | + height: w(43), | ||
| 450 | + width: w(100), | ||
| 451 | + radius: r(5), | ||
| 147 | )), | 452 | )), |
| 148 | - Padding( | ||
| 149 | - padding: EdgeInsets.fromLTRB( | ||
| 150 | - ScreenUtil().setWidth(40), | ||
| 151 | - 0, | ||
| 152 | - ScreenUtil().setWidth(40), | ||
| 153 | - ScreenUtil().setWidth(40)), | ||
| 154 | - child: RoundButton( | ||
| 155 | - onPressed: () async { | ||
| 156 | - bool needRefresh = | ||
| 157 | - await NavigatorUtil.goMenuCategoryPage( | ||
| 158 | - context); | ||
| 159 | - print(needRefresh); | ||
| 160 | - if (needRefresh != null && needRefresh) { | ||
| 161 | - //刷新页面数据 | ||
| 162 | - // _controller.callRefresh(); | ||
| 163 | - // _couponNetworkData(); | ||
| 164 | - } | ||
| 165 | - }, | ||
| 166 | - text: '分类\n管理', | ||
| 167 | - fontSize: 26, | ||
| 168 | - isBold: false, | ||
| 169 | - height: ScreenUtil().setWidth(120), | ||
| 170 | - width: ScreenUtil().setWidth(120), | ||
| 171 | - radius: ScreenUtil().setWidth(60), | ||
| 172 | - )) | ||
| 173 | - ], | ||
| 174 | - ) | 453 | + !isShow |
| 454 | + ? SizedBox() | ||
| 455 | + : Padding( | ||
| 456 | + padding: EdgeInsets.only( | ||
| 457 | + top: w(12), bottom: w(25)), | ||
| 458 | + child: RoundButton( | ||
| 459 | + onPressed: () async { | ||
| 460 | + await NavigatorUtil.goMenuAddDishesPage( | ||
| 461 | + context); | ||
| 462 | + }, | ||
| 463 | + text: '添加菜品', | ||
| 464 | + fontSize: 32, | ||
| 465 | + isBold: true, | ||
| 466 | + width: w(218), | ||
| 467 | + height: w(43), | ||
| 468 | + radius: r(5), | ||
| 469 | + )) | ||
| 470 | + ], | ||
| 471 | + )) | ||
| 175 | ]); | 472 | ]); |
| 176 | } else { | 473 | } else { |
| 177 | // double cellWidth = (MediaQuery.of(context).size.width - | 474 | // double cellWidth = (MediaQuery.of(context).size.width - |
| @@ -181,303 +478,348 @@ class _MenuManagePageState extends State<MenuManagePage> { | @@ -181,303 +478,348 @@ class _MenuManagePageState extends State<MenuManagePage> { | ||
| 181 | return Column(children: [ | 478 | return Column(children: [ |
| 182 | Expanded( | 479 | Expanded( |
| 183 | child: ListView.builder( | 480 | child: ListView.builder( |
| 184 | - padding: EdgeInsets.symmetric( | ||
| 185 | - horizontal: ScreenUtil().setWidth(40), | ||
| 186 | - vertical: ScreenUtil().setWidth(40)), | ||
| 187 | itemCount: menuManageProvider.menuModel.length, | 481 | itemCount: menuManageProvider.menuModel.length, |
| 188 | shrinkWrap: true, | 482 | shrinkWrap: true, |
| 189 | controller: _controller, | 483 | controller: _controller, |
| 190 | itemBuilder: (BuildContext context, int indexOut) { | 484 | itemBuilder: (BuildContext context, int indexOut) { |
| 191 | return Column( | 485 | return Column( |
| 192 | children: [ | 486 | children: [ |
| 193 | - Row( | ||
| 194 | - mainAxisAlignment: MainAxisAlignment.center, | ||
| 195 | - children: [ | ||
| 196 | - Container( | ||
| 197 | - width: ScreenUtil().setWidth(10), | ||
| 198 | - height: ScreenUtil().setWidth(10), | ||
| 199 | - decoration: BoxDecoration( | ||
| 200 | - color: MyColours.color_0D0D0D, | ||
| 201 | - shape: BoxShape.circle), | ||
| 202 | - ), | ||
| 203 | - MyDivider(ScreenUtil().setWidth(80), | ||
| 204 | - ScreenUtil().setWidth(2), | ||
| 205 | - color: MyColours.color_0D0D0D), | ||
| 206 | - HEmptyView(20), | ||
| 207 | - Text( | ||
| 208 | - menuManageProvider | ||
| 209 | - .menuModel[indexOut].className, | ||
| 210 | - style: TextStyle( | ||
| 211 | - color: MyColours.color_333333, | ||
| 212 | - fontSize: ScreenUtil().setSp(28), | ||
| 213 | - ), | ||
| 214 | - ), | ||
| 215 | - HEmptyView(20), | ||
| 216 | - MyDivider(ScreenUtil().setWidth(80), | ||
| 217 | - ScreenUtil().setWidth(2), | ||
| 218 | - color: MyColours.color_0D0D0D), | ||
| 219 | - Container( | ||
| 220 | - width: ScreenUtil().setWidth(10), | ||
| 221 | - height: ScreenUtil().setWidth(10), | ||
| 222 | - decoration: BoxDecoration( | ||
| 223 | - color: MyColours.color_0D0D0D, | ||
| 224 | - shape: BoxShape.circle), | ||
| 225 | - ), | ||
| 226 | - ], | ||
| 227 | - ), | ||
| 228 | - StaggeredGridView.countBuilder( | ||
| 229 | - padding: EdgeInsets.symmetric( | ||
| 230 | - vertical: ScreenUtil().setWidth(40)), | ||
| 231 | - shrinkWrap: true, | ||
| 232 | - crossAxisCount: 4, | ||
| 233 | - itemCount: menuManageProvider | ||
| 234 | - .menuModel[indexOut].cookbooklist.length, | ||
| 235 | - physics: NeverScrollableScrollPhysics(), | ||
| 236 | - itemBuilder: | ||
| 237 | - (BuildContext context, int index) { | ||
| 238 | - MenuSunModel model = menuManageProvider | 487 | + Container( |
| 488 | + height: w(32), | ||
| 489 | + color: MyColours.color_4D4E50, | ||
| 490 | + margin: EdgeInsets.only(bottom: (w(2))), | ||
| 491 | + child: Row( | ||
| 492 | + mainAxisAlignment: | ||
| 493 | + MainAxisAlignment.center, | ||
| 494 | + children: [ | ||
| 495 | + Container( | ||
| 496 | + width: ScreenUtil().setWidth(10), | ||
| 497 | + height: ScreenUtil().setWidth(10), | ||
| 498 | + decoration: BoxDecoration( | ||
| 499 | + color: MyColours.color_DBDBDB, | ||
| 500 | + shape: BoxShape.circle), | ||
| 501 | + ), | ||
| 502 | + MyDivider(ScreenUtil().setWidth(80), | ||
| 503 | + ScreenUtil().setWidth(2), | ||
| 504 | + color: MyColours.color_DBDBDB), | ||
| 505 | + HEmptyView(20), | ||
| 506 | + Text( | ||
| 507 | + menuManageProvider | ||
| 508 | + .menuModel[indexOut].className, | ||
| 509 | + style: TextStyle( | ||
| 510 | + color: MyColours.color_ffffff, | ||
| 511 | + fontSize: ScreenUtil().setSp(28), | ||
| 512 | + ), | ||
| 513 | + ), | ||
| 514 | + HEmptyView(20), | ||
| 515 | + MyDivider(ScreenUtil().setWidth(80), | ||
| 516 | + ScreenUtil().setWidth(2), | ||
| 517 | + color: MyColours.color_DBDBDB), | ||
| 518 | + Container( | ||
| 519 | + width: ScreenUtil().setWidth(10), | ||
| 520 | + height: ScreenUtil().setWidth(10), | ||
| 521 | + decoration: BoxDecoration( | ||
| 522 | + color: MyColours.color_DBDBDB, | ||
| 523 | + shape: BoxShape.circle), | ||
| 524 | + ), | ||
| 525 | + ], | ||
| 526 | + )), | ||
| 527 | + ListView.builder( | ||
| 528 | + itemCount: menuManageProvider | ||
| 239 | .menuModel[indexOut] | 529 | .menuModel[indexOut] |
| 240 | - .cookbooklist[index]; | ||
| 241 | - double cellWidth = ((MediaQuery.of(context) | ||
| 242 | - .size | ||
| 243 | - .width - | ||
| 244 | - ScreenUtil() | ||
| 245 | - .setWidth(40 * 2 + 15 * 2)) / | ||
| 246 | - 2); | ||
| 247 | - return InkWell( | ||
| 248 | - onTap: () async { | ||
| 249 | - await NavigatorUtil | ||
| 250 | - .goMenuAddDishesPage(context, | ||
| 251 | - isNew: false, | ||
| 252 | - idstr: model.id); | ||
| 253 | - }, | ||
| 254 | - child: model.image != null | ||
| 255 | - ? Stack(children: [ | ||
| 256 | - Column( | ||
| 257 | - crossAxisAlignment: | ||
| 258 | - CrossAxisAlignment.start, | ||
| 259 | - children: [ | ||
| 260 | - Container( | ||
| 261 | - decoration: BoxDecoration( | ||
| 262 | - borderRadius: | ||
| 263 | - BorderRadius.circular( | ||
| 264 | - ScreenUtil() | ||
| 265 | - .setWidth( | ||
| 266 | - 10))), | ||
| 267 | - child: ClipRRect( | ||
| 268 | - borderRadius: | ||
| 269 | - BorderRadius.circular( | 530 | + .cookbooklistShow |
| 531 | + .length, | ||
| 532 | + shrinkWrap: true, | ||
| 533 | + controller: _controller, | ||
| 534 | + itemBuilder: (context, index) { | ||
| 535 | + if (menuManageProvider.menuModel[indexOut] | ||
| 536 | + .cookbooklistShow[index] | ||
| 537 | + is MenuSunModel) { | ||
| 538 | + MenuSunModel model = menuManageProvider | ||
| 539 | + .menuModel[indexOut] | ||
| 540 | + .cookbooklistShow[index]; | ||
| 541 | + | ||
| 542 | + if (model.imageType == '2') { | ||
| 543 | + //小图 | ||
| 544 | + return GestureDetector( | ||
| 545 | + onLongPress: () async { | ||
| 546 | + print('onLongPress 长按事件'); | ||
| 547 | + Map object = await DialogUtil | ||
| 548 | + .menuMagageAlertDialog( | ||
| 549 | + context); | ||
| 550 | + if (object != null) { | ||
| 551 | + print(object); | ||
| 552 | + // 'name_type':'1', | ||
| 553 | + // 'image_type':'1', | ||
| 554 | + // 'move':'1' | ||
| 555 | + } | ||
| 556 | + }, | ||
| 557 | + child: Stack( | ||
| 558 | + children: [ | ||
| 559 | + _smallMenu(model), | ||
| 560 | + Positioned( | ||
| 561 | + bottom: ScreenUtil() | ||
| 562 | + .setWidth(14), | ||
| 563 | + // right: ScreenUtil().setWidth(20), | ||
| 564 | + child: model.status == '1' | ||
| 565 | + ? SizedBox() | ||
| 566 | + : Image.asset( | ||
| 567 | + Utils.getImgPath( | ||
| 568 | + 'stop-sell'), | ||
| 569 | + width: | ||
| 270 | ScreenUtil() | 570 | ScreenUtil() |
| 271 | .setWidth( | 571 | .setWidth( |
| 272 | - 10)), | ||
| 273 | - child: | ||
| 274 | - CachedNetworkImage( | ||
| 275 | - imageUrl: | ||
| 276 | - model.image, | ||
| 277 | - fit: BoxFit.cover, | ||
| 278 | - width: cellWidth, | ||
| 279 | - height: ScreenUtil() | ||
| 280 | - .setWidth(210), | ||
| 281 | - ), | ||
| 282 | - )), | ||
| 283 | - VEmptyView(15), | ||
| 284 | - Text( | ||
| 285 | - model.name, | ||
| 286 | - style: TextStyle( | ||
| 287 | - color: MyColours | ||
| 288 | - .color_333333, | ||
| 289 | - fontSize: ScreenUtil() | ||
| 290 | - .setSp(34), | ||
| 291 | - fontWeight: | ||
| 292 | - FontWeight.bold), | ||
| 293 | - ), | ||
| 294 | - VEmptyView(8), | ||
| 295 | - Text( | ||
| 296 | - '${model.price}元/${model.unit}', | ||
| 297 | - style: TextStyle( | ||
| 298 | - color: MyColours | ||
| 299 | - .color_333333, | ||
| 300 | - fontSize: ScreenUtil() | ||
| 301 | - .setSp(28), | ||
| 302 | - )) | ||
| 303 | - ], | ||
| 304 | - ), | ||
| 305 | - Positioned( | ||
| 306 | - bottom: ScreenUtil() | ||
| 307 | - .setWidth(14), | ||
| 308 | - right: ScreenUtil() | ||
| 309 | - .setWidth(20), | ||
| 310 | - child: model.status == '1' | ||
| 311 | - ? SizedBox() | ||
| 312 | - : Image.asset( | ||
| 313 | - Utils.getImgPath( | ||
| 314 | - 'stop-sell'), | ||
| 315 | - width: ScreenUtil() | ||
| 316 | - .setWidth(82), | ||
| 317 | - height: ScreenUtil() | ||
| 318 | - .setWidth(52), | ||
| 319 | - )), | ||
| 320 | - ]) | ||
| 321 | - : Stack(children: [ | ||
| 322 | - Container( | ||
| 323 | - width: cellWidth, | ||
| 324 | - height: ScreenUtil() | ||
| 325 | - .setWidth(210), | 572 | + 182), |
| 573 | + // height: ScreenUtil() | ||
| 574 | + // .setWidth(52), | ||
| 575 | + )) | ||
| 576 | + ], | ||
| 577 | + )); | ||
| 578 | + } | ||
| 326 | 579 | ||
| 327 | - decoration: BoxDecoration( | ||
| 328 | - color: index % 2 == 0 | ||
| 329 | - ? Color.fromRGBO( | ||
| 330 | - 247, 230, 230, 1) | ||
| 331 | - : Color.fromRGBO( | ||
| 332 | - 234, 236, 252, 1), | ||
| 333 | - borderRadius: BorderRadius | ||
| 334 | - .circular(ScreenUtil() | ||
| 335 | - .setWidth(10))), | ||
| 336 | - child: Container( | ||
| 337 | - padding: | ||
| 338 | - EdgeInsets.symmetric( | ||
| 339 | - horizontal: | ||
| 340 | - ScreenUtil() | ||
| 341 | - .setWidth( | ||
| 342 | - 20)), | ||
| 343 | - child: Column( | ||
| 344 | - crossAxisAlignment: | ||
| 345 | - CrossAxisAlignment | ||
| 346 | - .start, | ||
| 347 | - mainAxisAlignment: | ||
| 348 | - MainAxisAlignment | 580 | + return GestureDetector( |
| 581 | + onLongPress: () { | ||
| 582 | + print('onLongPress 长按事件'); | ||
| 583 | + }, | ||
| 584 | + child: Stack(children: [ | ||
| 585 | + Container( | ||
| 586 | + color: MyColours.color_4D4E50, | ||
| 587 | + margin: EdgeInsets.only( | ||
| 588 | + bottom: (w(2))), | ||
| 589 | + child: Column( | ||
| 590 | + crossAxisAlignment: model | ||
| 591 | + .imageType != | ||
| 592 | + '2' && | ||
| 593 | + model.nameType == '1' | ||
| 594 | + ? CrossAxisAlignment.start | ||
| 595 | + : model.imageType != | ||
| 596 | + '2' && | ||
| 597 | + model.nameType == | ||
| 598 | + '2' | ||
| 599 | + ? CrossAxisAlignment | ||
| 600 | + .end | ||
| 601 | + : CrossAxisAlignment | ||
| 349 | .center, | 602 | .center, |
| 350 | - children: [ | ||
| 351 | - Text( | ||
| 352 | - model.name, | 603 | + children: [ |
| 604 | + Container( | ||
| 605 | + padding: | ||
| 606 | + EdgeInsets.only( | ||
| 607 | + top: w(20), | ||
| 608 | + left: w(20), | ||
| 609 | + right: w(20), | ||
| 610 | + bottom: w(15)), | ||
| 611 | + child: model.imageType != | ||
| 612 | + '2' && | ||
| 613 | + model.nameType == | ||
| 614 | + '3' | ||
| 615 | + ? _topBetween(model) | ||
| 616 | + : model.imageType != | ||
| 617 | + '2' && | ||
| 618 | + model.nameType == | ||
| 619 | + '2' | ||
| 620 | + ? _topRight( | ||
| 621 | + model) | ||
| 622 | + : model.imageType != | ||
| 623 | + '2' && | ||
| 624 | + model.nameType == | ||
| 625 | + '1' | ||
| 626 | + ? _topLeft( | ||
| 627 | + model) | ||
| 628 | + : _topLeft( | ||
| 629 | + model)), | ||
| 630 | + if (model.image != null) | ||
| 631 | + CachedNetworkImage( | ||
| 632 | + imageUrl: model.image, | ||
| 633 | + fit: BoxFit.cover, | ||
| 634 | + width: double.infinity, | ||
| 635 | + height: w(250), | ||
| 636 | + ), | ||
| 637 | + if (true) | ||
| 638 | + Padding( | ||
| 639 | + padding: EdgeInsets | ||
| 640 | + .symmetric( | ||
| 641 | + horizontal: | ||
| 642 | + w(16), | ||
| 643 | + vertical: | ||
| 644 | + w(10)), | ||
| 645 | + child: Text( | ||
| 646 | + '江南传统名菜,口味咸鲜,汤白汁浓,肉质酥肥,笋清香脆嫩,鲜味浓厚。', | ||
| 353 | style: TextStyle( | 647 | style: TextStyle( |
| 354 | color: MyColours | 648 | color: MyColours |
| 355 | - .color_333333, | 649 | + .color_DBDBDB, |
| 356 | fontSize: | 650 | fontSize: |
| 357 | - ScreenUtil() | ||
| 358 | - .setSp( | ||
| 359 | - 34), | ||
| 360 | - fontWeight: | ||
| 361 | - FontWeight | ||
| 362 | - .bold), | 651 | + font(12)), |
| 363 | ), | 652 | ), |
| 364 | - VEmptyView(40), | ||
| 365 | - Text( | ||
| 366 | - '${model.price}元/${model.unit}', | ||
| 367 | - style: TextStyle( | ||
| 368 | - color: MyColours | ||
| 369 | - .color_333333, | ||
| 370 | - fontSize: | ||
| 371 | - ScreenUtil() | ||
| 372 | - .setSp( | ||
| 373 | - 28), | ||
| 374 | - )) | ||
| 375 | - ], | ||
| 376 | - ), | ||
| 377 | - ), | ||
| 378 | - | ||
| 379 | - // VEmptyView(15), | ||
| 380 | - // Text( | ||
| 381 | - // ' ', | ||
| 382 | - // style: TextStyle( | ||
| 383 | - // color: MyColours.color_333333, | ||
| 384 | - // fontSize: | ||
| 385 | - // ScreenUtil().setSp(34), | ||
| 386 | - // fontWeight: FontWeight.bold), | ||
| 387 | - // ), | ||
| 388 | - // VEmptyView(20), | ||
| 389 | - // Text(' ', | ||
| 390 | - // style: TextStyle( | ||
| 391 | - // color: MyColours.color_333333, | ||
| 392 | - // fontSize: | ||
| 393 | - // ScreenUtil().setSp(28), | ||
| 394 | - // )) | ||
| 395 | - ), | ||
| 396 | - Positioned( | ||
| 397 | - bottom: ScreenUtil() | ||
| 398 | - .setWidth(46), | ||
| 399 | - right: ScreenUtil() | ||
| 400 | - .setWidth(20), | ||
| 401 | - child: model.status == '1' | ||
| 402 | - ? SizedBox() | ||
| 403 | - : Image.asset( | 653 | + ), |
| 654 | + Align( | ||
| 655 | + alignment: Alignment | ||
| 656 | + .centerRight, | ||
| 657 | + child: Padding( | ||
| 658 | + padding: | ||
| 659 | + EdgeInsets.only( | ||
| 660 | + right: w(40), | ||
| 661 | + top: w(19), | ||
| 662 | + bottom: | ||
| 663 | + w(19)), | ||
| 664 | + child: Image.asset( | ||
| 404 | Utils.getImgPath( | 665 | Utils.getImgPath( |
| 405 | - 'stop-sell'), | ||
| 406 | - width: ScreenUtil() | ||
| 407 | - .setWidth(82), | ||
| 408 | - height: ScreenUtil() | ||
| 409 | - .setWidth(52), | ||
| 410 | - )), | ||
| 411 | - ])); | ||
| 412 | - }, | ||
| 413 | - staggeredTileBuilder: (int index) => | ||
| 414 | - new StaggeredTile.count( | ||
| 415 | - 2, | ||
| 416 | - menuManageProvider | ||
| 417 | - .menuModel[indexOut] | ||
| 418 | - .cookbooklist[index] | ||
| 419 | - .image != | ||
| 420 | - null | ||
| 421 | - ? ScreenUtil().setWidth(4.2) | ||
| 422 | - : ScreenUtil().setWidth(2.85)), | ||
| 423 | - mainAxisSpacing: | ||
| 424 | - ScreenUtil().setWidth(15 * 2), | ||
| 425 | - crossAxisSpacing: | ||
| 426 | - ScreenUtil().setWidth(15 * 2), | ||
| 427 | - ), | 666 | + 'add_area'), |
| 667 | + width: w(22), | ||
| 668 | + ), | ||
| 669 | + )) | ||
| 670 | + ], | ||
| 671 | + ), | ||
| 672 | + ), | ||
| 673 | + Positioned( | ||
| 674 | + bottom: | ||
| 675 | + ScreenUtil().setWidth(14), | ||
| 676 | + right: | ||
| 677 | + ScreenUtil().setWidth(20), | ||
| 678 | + child: model.status == '1' | ||
| 679 | + ? SizedBox() | ||
| 680 | + : Image.asset( | ||
| 681 | + Utils.getImgPath( | ||
| 682 | + 'stop-sell'), | ||
| 683 | + width: ScreenUtil() | ||
| 684 | + .setWidth(182), | ||
| 685 | + // height: ScreenUtil() | ||
| 686 | + // .setWidth(52), | ||
| 687 | + )), | ||
| 688 | + ])); | ||
| 689 | + } else if (menuManageProvider | ||
| 690 | + .menuModel[indexOut] | ||
| 691 | + .cookbooklistShow[index] is List) { | ||
| 692 | + List<MenuSunModel> temp = | ||
| 693 | + menuManageProvider | ||
| 694 | + .menuModel[indexOut] | ||
| 695 | + .cookbooklistShow[index]; | ||
| 696 | + return Padding( | ||
| 697 | + padding: | ||
| 698 | + EdgeInsets.only(bottom: w(2)), | ||
| 699 | + child: Row( | ||
| 700 | + children: [ | ||
| 701 | + Expanded( | ||
| 702 | + flex: 1, | ||
| 703 | + child: GestureDetector( | ||
| 704 | + onLongPress: () { | ||
| 705 | + print( | ||
| 706 | + 'onLongPress 长按事件'); | ||
| 707 | + }, | ||
| 708 | + child: Stack( | ||
| 709 | + children: [ | ||
| 710 | + _smallMenu(temp[0]), | ||
| 711 | + Positioned( | ||
| 712 | + bottom: | ||
| 713 | + ScreenUtil() | ||
| 714 | + .setWidth( | ||
| 715 | + 14), | ||
| 716 | + // right: ScreenUtil().setWidth(20), | ||
| 717 | + child: temp[0] | ||
| 718 | + .status == | ||
| 719 | + '1' | ||
| 720 | + ? SizedBox() | ||
| 721 | + : Image | ||
| 722 | + .asset( | ||
| 723 | + Utils.getImgPath( | ||
| 724 | + 'stop-sell'), | ||
| 725 | + width: ScreenUtil() | ||
| 726 | + .setWidth(182), | ||
| 727 | + // height: ScreenUtil() | ||
| 728 | + // .setWidth(52), | ||
| 729 | + )) | ||
| 730 | + ], | ||
| 731 | + ))), | ||
| 732 | + HEmptyView(4), | ||
| 733 | + Expanded( | ||
| 734 | + flex: 1, | ||
| 735 | + child: GestureDetector( | ||
| 736 | + onLongPress: () { | ||
| 737 | + print( | ||
| 738 | + 'onLongPress 长按事件'); | ||
| 739 | + }, | ||
| 740 | + child: Stack( | ||
| 741 | + children: [ | ||
| 742 | + _smallMenu(temp[1]), | ||
| 743 | + Positioned( | ||
| 744 | + bottom: | ||
| 745 | + ScreenUtil() | ||
| 746 | + .setWidth( | ||
| 747 | + 14), | ||
| 748 | + // right: ScreenUtil().setWidth(20), | ||
| 749 | + child: temp[1] | ||
| 750 | + .status == | ||
| 751 | + '1' | ||
| 752 | + ? SizedBox() | ||
| 753 | + : Image | ||
| 754 | + .asset( | ||
| 755 | + Utils.getImgPath( | ||
| 756 | + 'stop-sell'), | ||
| 757 | + width: ScreenUtil() | ||
| 758 | + .setWidth(182), | ||
| 759 | + // height: ScreenUtil() | ||
| 760 | + // .setWidth(52), | ||
| 761 | + )) | ||
| 762 | + ], | ||
| 763 | + ))) | ||
| 764 | + ], | ||
| 765 | + )); | ||
| 766 | + } | ||
| 767 | + }) | ||
| 428 | ], | 768 | ], |
| 429 | ); | 769 | ); |
| 430 | })), | 770 | })), |
| 431 | - Row( | ||
| 432 | - mainAxisAlignment: MainAxisAlignment.spaceBetween, | ||
| 433 | - children: [ | ||
| 434 | - !isShow | ||
| 435 | - ? SizedBox() | ||
| 436 | - : Padding( | ||
| 437 | - padding: EdgeInsets.fromLTRB( | ||
| 438 | - ScreenUtil().setWidth(40), | ||
| 439 | - 0, | ||
| 440 | - ScreenUtil().setWidth(40), | ||
| 441 | - ScreenUtil().setWidth(40)), | 771 | + Container( |
| 772 | + padding: EdgeInsets.symmetric(horizontal: w(23)), | ||
| 773 | + // height: w(80), | ||
| 774 | + color: MyColours.color_FAFAFA, | ||
| 775 | + child: Row( | ||
| 776 | + mainAxisAlignment: MainAxisAlignment.spaceBetween, | ||
| 777 | + children: [ | ||
| 778 | + Padding( | ||
| 779 | + padding: | ||
| 780 | + EdgeInsets.only(top: w(12), bottom: w(25)), | ||
| 442 | child: RoundButton( | 781 | child: RoundButton( |
| 443 | onPressed: () async { | 782 | onPressed: () async { |
| 444 | - await NavigatorUtil.goMenuAddDishesPage( | ||
| 445 | - context); | 783 | + bool needRefresh = |
| 784 | + await NavigatorUtil.goMenuCategoryPage( | ||
| 785 | + context); | ||
| 786 | + print(needRefresh); | ||
| 787 | + if (needRefresh != null && needRefresh) { | ||
| 788 | + //刷新页面数据 | ||
| 789 | + // _controller.callRefresh(); | ||
| 790 | + // _couponNetworkData(); | ||
| 791 | + } | ||
| 446 | }, | 792 | }, |
| 447 | - text: '添加\n菜品', | ||
| 448 | - fontSize: 26, | ||
| 449 | - isBold: false, | ||
| 450 | - height: ScreenUtil().setWidth(120), | ||
| 451 | - width: ScreenUtil().setWidth(120), | ||
| 452 | - radius: ScreenUtil().setWidth(60), | 793 | + text: '分类管理', |
| 794 | + fontSize: 32, | ||
| 795 | + gradientStart: MyColours.color_ffffff, | ||
| 796 | + gradientEnd: MyColours.color_ffffff, | ||
| 797 | + borderColor: MyColours.color_438E93, | ||
| 798 | + textColor: MyColours.color_438E93, | ||
| 799 | + isBold: true, | ||
| 800 | + height: w(43), | ||
| 801 | + width: w(100), | ||
| 802 | + radius: r(5), | ||
| 453 | )), | 803 | )), |
| 454 | - Padding( | ||
| 455 | - padding: EdgeInsets.fromLTRB( | ||
| 456 | - ScreenUtil().setWidth(40), | ||
| 457 | - 0, | ||
| 458 | - ScreenUtil().setWidth(40), | ||
| 459 | - ScreenUtil().setWidth(40)), | ||
| 460 | - child: RoundButton( | ||
| 461 | - onPressed: () async { | ||
| 462 | - bool needRefresh = | ||
| 463 | - await NavigatorUtil.goMenuCategoryPage( | ||
| 464 | - context); | ||
| 465 | - print(needRefresh); | ||
| 466 | - if (needRefresh != null && needRefresh) { | ||
| 467 | - //刷新页面数据 | ||
| 468 | - // _controller.callRefresh(); | ||
| 469 | - // _couponNetworkData(); | ||
| 470 | - } | ||
| 471 | - }, | ||
| 472 | - text: '分类\n管理', | ||
| 473 | - fontSize: 26, | ||
| 474 | - isBold: false, | ||
| 475 | - height: ScreenUtil().setWidth(120), | ||
| 476 | - width: ScreenUtil().setWidth(120), | ||
| 477 | - radius: ScreenUtil().setWidth(60), | ||
| 478 | - )) | ||
| 479 | - ], | ||
| 480 | - ) | 804 | + !isShow |
| 805 | + ? SizedBox() | ||
| 806 | + : Padding( | ||
| 807 | + padding: EdgeInsets.only( | ||
| 808 | + top: w(12), bottom: w(25)), | ||
| 809 | + child: RoundButton( | ||
| 810 | + onPressed: () async { | ||
| 811 | + await NavigatorUtil.goMenuAddDishesPage( | ||
| 812 | + context); | ||
| 813 | + }, | ||
| 814 | + text: '添加菜品', | ||
| 815 | + fontSize: 32, | ||
| 816 | + isBold: true, | ||
| 817 | + width: w(218), | ||
| 818 | + height: w(43), | ||
| 819 | + radius: r(5), | ||
| 820 | + )) | ||
| 821 | + ], | ||
| 822 | + )) | ||
| 481 | ]); | 823 | ]); |
| 482 | } | 824 | } |
| 483 | }, | 825 | }, |
| 1 | +// import 'package:amap_map_fluttify/amap_map_fluttify.dart'; | ||
| 2 | +// import 'package:cached_network_image/cached_network_image.dart'; | ||
| 3 | +// import 'package:flutter/material.dart'; | ||
| 4 | +// import 'package:flutter_easyrefresh/easy_refresh.dart'; | ||
| 5 | +// import 'package:flutter_screenutil/flutter_screenutil.dart'; | ||
| 6 | +// import 'package:one_key/constant/state.dart'; | ||
| 7 | +// import 'package:one_key/models/cookbook_category_model.dart'; | ||
| 8 | +// import 'package:one_key/models/cookbook_model.dart'; | ||
| 9 | +// import 'package:one_key/provider/menu_provider.dart'; | ||
| 10 | +// import 'package:one_key/provider/user_model.dart'; | ||
| 11 | +// import 'package:one_key/res/colors.dart'; | ||
| 12 | +// import 'package:one_key/route/navigator_util.dart'; | ||
| 13 | +// import 'package:one_key/utils/event_bus.dart'; | ||
| 14 | +// import 'package:one_key/utils/utils.dart'; | ||
| 15 | +// import 'package:one_key/widgets/MyDivider.dart'; | ||
| 16 | +// import 'package:one_key/widgets/h_empty_view.dart'; | ||
| 17 | +// import 'package:one_key/widgets/page_exception.dart'; | ||
| 18 | +// import 'package:one_key/widgets/round_button.dart'; | ||
| 19 | +// import 'package:one_key/widgets/system_app_bar.dart'; | ||
| 20 | +// import 'package:one_key/widgets/v_empty_view.dart'; | ||
| 21 | +// import 'package:provider/provider.dart'; | ||
| 22 | +// import 'package:flutter_staggered_grid_view/flutter_staggered_grid_view.dart'; | ||
| 23 | + | ||
| 24 | +// class MenuManagePage extends StatefulWidget { | ||
| 25 | +// MenuManagePage({Key key}) : super(key: key); | ||
| 26 | + | ||
| 27 | +// @override | ||
| 28 | +// _MenuManagePageState createState() => _MenuManagePageState(); | ||
| 29 | +// } | ||
| 30 | + | ||
| 31 | +// class _MenuManagePageState extends State<MenuManagePage> { | ||
| 32 | +// ScrollController _controller = ScrollController(); | ||
| 33 | +// MenuManageProvider menuManageProvider; | ||
| 34 | +// bool isShow = false; //添加菜品按钮 | ||
| 35 | +// @override | ||
| 36 | +// void initState() { | ||
| 37 | +// super.initState(); | ||
| 38 | +// WidgetsBinding.instance.addPostFrameCallback((timeStamp) { | ||
| 39 | +// _getCookbookByClass(showLoading: false); | ||
| 40 | +// _getCookbookBySellerId(); | ||
| 41 | +// }); | ||
| 42 | +// EventBus().on('menu_manage_page', (arg) { | ||
| 43 | +// _getCookbookByClass(showLoading: false); | ||
| 44 | +// _getCookbookBySellerId(); | ||
| 45 | +// }); | ||
| 46 | +// } | ||
| 47 | + | ||
| 48 | +// @override | ||
| 49 | +// void dispose() { | ||
| 50 | +// // TODO: implement dispose | ||
| 51 | +// super.dispose(); | ||
| 52 | +// EventBus().off('menu_manage_page'); | ||
| 53 | +// } | ||
| 54 | + | ||
| 55 | +// ///获取分类数据 | ||
| 56 | +// _getCookbookBySellerId({bool showLoading = true}) async { | ||
| 57 | +// Map<String, String> params = { | ||
| 58 | +// "SellerId": Provider.of<UserModel>(context, listen: false).user.sellerid, | ||
| 59 | +// }; | ||
| 60 | + | ||
| 61 | +// await menuManageProvider.getCookbookClassBySellerId(context, params, | ||
| 62 | +// showLoading: showLoading); | ||
| 63 | +// List<CookbookCategorySunModel> temp = []; | ||
| 64 | +// if (menuManageProvider.categorySunModel.length > 0) { | ||
| 65 | +// menuManageProvider.categorySunModel.forEach((element) { | ||
| 66 | +// if (element.className != '10道必点菜') { | ||
| 67 | +// temp.add(element); | ||
| 68 | +// } | ||
| 69 | +// }); | ||
| 70 | +// } | ||
| 71 | +// if (temp.length == 0) { | ||
| 72 | +// setState(() { | ||
| 73 | +// isShow = false; | ||
| 74 | +// }); | ||
| 75 | +// } else { | ||
| 76 | +// setState(() { | ||
| 77 | +// isShow = true; | ||
| 78 | +// }); | ||
| 79 | +// } | ||
| 80 | +// } | ||
| 81 | + | ||
| 82 | +// _getCookbookByClass({bool showLoading = true}) async { | ||
| 83 | +// Map<String, String> params = { | ||
| 84 | +// "sellerid": Provider.of<UserModel>(context, listen: false).user.sellerid, | ||
| 85 | +// }; | ||
| 86 | + | ||
| 87 | +// await menuManageProvider.getCookbookByClass(context, params, | ||
| 88 | +// showLoading: showLoading); | ||
| 89 | +// } | ||
| 90 | + | ||
| 91 | +// @override | ||
| 92 | +// Widget build(BuildContext context) { | ||
| 93 | +// menuManageProvider = Provider.of<MenuManageProvider>(context, listen: true); | ||
| 94 | +// return Scaffold( | ||
| 95 | +// backgroundColor: MyColours.color_ffffff, | ||
| 96 | +// appBar: SystemAppBar( | ||
| 97 | +// '菜单管理', | ||
| 98 | +// onTap: () { | ||
| 99 | +// EventBus().emit('changeStatusColor'); | ||
| 100 | +// Navigator.of(context).pop(); | ||
| 101 | +// }, | ||
| 102 | +// ), | ||
| 103 | +// body: WillPopScope( | ||
| 104 | +// onWillPop: () { | ||
| 105 | +// EventBus().emit('changeStatusColor'); | ||
| 106 | +// Navigator.of(context).pop(); | ||
| 107 | +// }, | ||
| 108 | +// child: Consumer<MenuManageProvider>( | ||
| 109 | +// builder: (context, model, _) { | ||
| 110 | +// if (model.pageState != PageState.Success) { | ||
| 111 | +// return Column(children: [ | ||
| 112 | +// Expanded( | ||
| 113 | +// child: ExceptionPage( | ||
| 114 | +// pageState: model.pageState, | ||
| 115 | +// callback: () { | ||
| 116 | +// // offset = 0; | ||
| 117 | +// // getMessage(showLoading: true); | ||
| 118 | +// // _couponNetworkData(); | ||
| 119 | +// _getCookbookByClass(showLoading: true); | ||
| 120 | +// }, | ||
| 121 | +// emptyMsg: "菜品是空哒,快点击分类管理添加分类和菜品吧", | ||
| 122 | +// emptyImg: "empty_search", | ||
| 123 | +// showMsg: "加载中,请稍后...", | ||
| 124 | +// )), | ||
| 125 | +// Row( | ||
| 126 | +// mainAxisAlignment: MainAxisAlignment.spaceBetween, | ||
| 127 | +// children: [ | ||
| 128 | +// !isShow | ||
| 129 | +// ? SizedBox() | ||
| 130 | +// : Padding( | ||
| 131 | +// padding: EdgeInsets.fromLTRB( | ||
| 132 | +// ScreenUtil().setWidth(40), | ||
| 133 | +// 0, | ||
| 134 | +// ScreenUtil().setWidth(40), | ||
| 135 | +// ScreenUtil().setWidth(40)), | ||
| 136 | +// child: RoundButton( | ||
| 137 | +// onPressed: () async { | ||
| 138 | +// await NavigatorUtil.goMenuAddDishesPage( | ||
| 139 | +// context); | ||
| 140 | +// }, | ||
| 141 | +// text: '添加\n菜品', | ||
| 142 | +// fontSize: 26, | ||
| 143 | +// isBold: false, | ||
| 144 | +// height: ScreenUtil().setWidth(120), | ||
| 145 | +// width: ScreenUtil().setWidth(120), | ||
| 146 | +// radius: ScreenUtil().setWidth(60), | ||
| 147 | +// )), | ||
| 148 | +// Padding( | ||
| 149 | +// padding: EdgeInsets.fromLTRB( | ||
| 150 | +// ScreenUtil().setWidth(40), | ||
| 151 | +// 0, | ||
| 152 | +// ScreenUtil().setWidth(40), | ||
| 153 | +// ScreenUtil().setWidth(40)), | ||
| 154 | +// child: RoundButton( | ||
| 155 | +// onPressed: () async { | ||
| 156 | +// bool needRefresh = | ||
| 157 | +// await NavigatorUtil.goMenuCategoryPage( | ||
| 158 | +// context); | ||
| 159 | +// print(needRefresh); | ||
| 160 | +// if (needRefresh != null && needRefresh) { | ||
| 161 | +// //刷新页面数据 | ||
| 162 | +// // _controller.callRefresh(); | ||
| 163 | +// // _couponNetworkData(); | ||
| 164 | +// } | ||
| 165 | +// }, | ||
| 166 | +// text: '分类\n管理', | ||
| 167 | +// fontSize: 26, | ||
| 168 | +// isBold: false, | ||
| 169 | +// height: ScreenUtil().setWidth(120), | ||
| 170 | +// width: ScreenUtil().setWidth(120), | ||
| 171 | +// radius: ScreenUtil().setWidth(60), | ||
| 172 | +// )) | ||
| 173 | +// ], | ||
| 174 | +// ) | ||
| 175 | +// ]); | ||
| 176 | +// } else { | ||
| 177 | +// // double cellWidth = (MediaQuery.of(context).size.width - | ||
| 178 | +// // ScreenUtil().setWidth(40 * 2 + 15 * 2) / 2); | ||
| 179 | +// // double desiredCellHeight = ScreenUtil().setWidth(700); | ||
| 180 | +// // double childAspectRatio = cellWidth / desiredCellHeight; | ||
| 181 | +// return Column(children: [ | ||
| 182 | +// Expanded( | ||
| 183 | +// child: ListView.builder( | ||
| 184 | +// padding: EdgeInsets.symmetric( | ||
| 185 | +// horizontal: ScreenUtil().setWidth(40), | ||
| 186 | +// vertical: ScreenUtil().setWidth(40)), | ||
| 187 | +// itemCount: menuManageProvider.menuModel.length, | ||
| 188 | +// shrinkWrap: true, | ||
| 189 | +// controller: _controller, | ||
| 190 | +// itemBuilder: (BuildContext context, int indexOut) { | ||
| 191 | +// return Column( | ||
| 192 | +// children: [ | ||
| 193 | +// Row( | ||
| 194 | +// mainAxisAlignment: MainAxisAlignment.center, | ||
| 195 | +// children: [ | ||
| 196 | +// Container( | ||
| 197 | +// width: ScreenUtil().setWidth(10), | ||
| 198 | +// height: ScreenUtil().setWidth(10), | ||
| 199 | +// decoration: BoxDecoration( | ||
| 200 | +// color: MyColours.color_0D0D0D, | ||
| 201 | +// shape: BoxShape.circle), | ||
| 202 | +// ), | ||
| 203 | +// MyDivider(ScreenUtil().setWidth(80), | ||
| 204 | +// ScreenUtil().setWidth(2), | ||
| 205 | +// color: MyColours.color_0D0D0D), | ||
| 206 | +// HEmptyView(20), | ||
| 207 | +// Text( | ||
| 208 | +// menuManageProvider | ||
| 209 | +// .menuModel[indexOut].className, | ||
| 210 | +// style: TextStyle( | ||
| 211 | +// color: MyColours.color_333333, | ||
| 212 | +// fontSize: ScreenUtil().setSp(28), | ||
| 213 | +// ), | ||
| 214 | +// ), | ||
| 215 | +// HEmptyView(20), | ||
| 216 | +// MyDivider(ScreenUtil().setWidth(80), | ||
| 217 | +// ScreenUtil().setWidth(2), | ||
| 218 | +// color: MyColours.color_0D0D0D), | ||
| 219 | +// Container( | ||
| 220 | +// width: ScreenUtil().setWidth(10), | ||
| 221 | +// height: ScreenUtil().setWidth(10), | ||
| 222 | +// decoration: BoxDecoration( | ||
| 223 | +// color: MyColours.color_0D0D0D, | ||
| 224 | +// shape: BoxShape.circle), | ||
| 225 | +// ), | ||
| 226 | +// ], | ||
| 227 | +// ), | ||
| 228 | +// StaggeredGridView.countBuilder( | ||
| 229 | +// padding: EdgeInsets.symmetric( | ||
| 230 | +// vertical: ScreenUtil().setWidth(40)), | ||
| 231 | +// shrinkWrap: true, | ||
| 232 | +// crossAxisCount: 4, | ||
| 233 | +// itemCount: menuManageProvider | ||
| 234 | +// .menuModel[indexOut].cookbooklist.length, | ||
| 235 | +// physics: NeverScrollableScrollPhysics(), | ||
| 236 | +// itemBuilder: | ||
| 237 | +// (BuildContext context, int index) { | ||
| 238 | +// MenuSunModel model = menuManageProvider | ||
| 239 | +// .menuModel[indexOut] | ||
| 240 | +// .cookbooklist[index]; | ||
| 241 | +// double cellWidth = ((MediaQuery.of(context) | ||
| 242 | +// .size | ||
| 243 | +// .width - | ||
| 244 | +// ScreenUtil() | ||
| 245 | +// .setWidth(40 * 2 + 15 * 2)) / | ||
| 246 | +// 2); | ||
| 247 | +// return InkWell( | ||
| 248 | +// onTap: () async { | ||
| 249 | +// await NavigatorUtil | ||
| 250 | +// .goMenuAddDishesPage(context, | ||
| 251 | +// isNew: false, | ||
| 252 | +// idstr: model.id); | ||
| 253 | +// }, | ||
| 254 | +// child: model.image != null | ||
| 255 | +// ? Stack(children: [ | ||
| 256 | +// Column( | ||
| 257 | +// crossAxisAlignment: | ||
| 258 | +// CrossAxisAlignment.start, | ||
| 259 | +// children: [ | ||
| 260 | +// Container( | ||
| 261 | +// decoration: BoxDecoration( | ||
| 262 | +// borderRadius: | ||
| 263 | +// BorderRadius.circular( | ||
| 264 | +// ScreenUtil() | ||
| 265 | +// .setWidth( | ||
| 266 | +// 10))), | ||
| 267 | +// child: ClipRRect( | ||
| 268 | +// borderRadius: | ||
| 269 | +// BorderRadius.circular( | ||
| 270 | +// ScreenUtil() | ||
| 271 | +// .setWidth( | ||
| 272 | +// 10)), | ||
| 273 | +// child: | ||
| 274 | +// CachedNetworkImage( | ||
| 275 | +// imageUrl: | ||
| 276 | +// model.image, | ||
| 277 | +// fit: BoxFit.cover, | ||
| 278 | +// width: cellWidth, | ||
| 279 | +// height: ScreenUtil() | ||
| 280 | +// .setWidth(210), | ||
| 281 | +// ), | ||
| 282 | +// )), | ||
| 283 | +// VEmptyView(15), | ||
| 284 | +// Text( | ||
| 285 | +// model.name, | ||
| 286 | +// style: TextStyle( | ||
| 287 | +// color: MyColours | ||
| 288 | +// .color_333333, | ||
| 289 | +// fontSize: ScreenUtil() | ||
| 290 | +// .setSp(34), | ||
| 291 | +// fontWeight: | ||
| 292 | +// FontWeight.bold), | ||
| 293 | +// ), | ||
| 294 | +// VEmptyView(8), | ||
| 295 | +// Text( | ||
| 296 | +// '${model.price}元/${model.unit}', | ||
| 297 | +// style: TextStyle( | ||
| 298 | +// color: MyColours | ||
| 299 | +// .color_333333, | ||
| 300 | +// fontSize: ScreenUtil() | ||
| 301 | +// .setSp(28), | ||
| 302 | +// )) | ||
| 303 | +// ], | ||
| 304 | +// ), | ||
| 305 | +// Positioned( | ||
| 306 | +// bottom: ScreenUtil() | ||
| 307 | +// .setWidth(14), | ||
| 308 | +// right: ScreenUtil() | ||
| 309 | +// .setWidth(20), | ||
| 310 | +// child: model.status == '1' | ||
| 311 | +// ? SizedBox() | ||
| 312 | +// : Image.asset( | ||
| 313 | +// Utils.getImgPath( | ||
| 314 | +// 'stop-sell'), | ||
| 315 | +// width: ScreenUtil() | ||
| 316 | +// .setWidth(82), | ||
| 317 | +// height: ScreenUtil() | ||
| 318 | +// .setWidth(52), | ||
| 319 | +// )), | ||
| 320 | +// ]) | ||
| 321 | +// : Stack(children: [ | ||
| 322 | +// Container( | ||
| 323 | +// width: cellWidth, | ||
| 324 | +// height: ScreenUtil() | ||
| 325 | +// .setWidth(210), | ||
| 326 | + | ||
| 327 | +// decoration: BoxDecoration( | ||
| 328 | +// color: index % 2 == 0 | ||
| 329 | +// ? Color.fromRGBO( | ||
| 330 | +// 247, 230, 230, 1) | ||
| 331 | +// : Color.fromRGBO( | ||
| 332 | +// 234, 236, 252, 1), | ||
| 333 | +// borderRadius: BorderRadius | ||
| 334 | +// .circular(ScreenUtil() | ||
| 335 | +// .setWidth(10))), | ||
| 336 | +// child: Container( | ||
| 337 | +// padding: | ||
| 338 | +// EdgeInsets.symmetric( | ||
| 339 | +// horizontal: | ||
| 340 | +// ScreenUtil() | ||
| 341 | +// .setWidth( | ||
| 342 | +// 20)), | ||
| 343 | +// child: Column( | ||
| 344 | +// crossAxisAlignment: | ||
| 345 | +// CrossAxisAlignment | ||
| 346 | +// .start, | ||
| 347 | +// mainAxisAlignment: | ||
| 348 | +// MainAxisAlignment | ||
| 349 | +// .center, | ||
| 350 | +// children: [ | ||
| 351 | +// Text( | ||
| 352 | +// model.name, | ||
| 353 | +// style: TextStyle( | ||
| 354 | +// color: MyColours | ||
| 355 | +// .color_333333, | ||
| 356 | +// fontSize: | ||
| 357 | +// ScreenUtil() | ||
| 358 | +// .setSp( | ||
| 359 | +// 34), | ||
| 360 | +// fontWeight: | ||
| 361 | +// FontWeight | ||
| 362 | +// .bold), | ||
| 363 | +// ), | ||
| 364 | +// VEmptyView(40), | ||
| 365 | +// Text( | ||
| 366 | +// '${model.price}元/${model.unit}', | ||
| 367 | +// style: TextStyle( | ||
| 368 | +// color: MyColours | ||
| 369 | +// .color_333333, | ||
| 370 | +// fontSize: | ||
| 371 | +// ScreenUtil() | ||
| 372 | +// .setSp( | ||
| 373 | +// 28), | ||
| 374 | +// )) | ||
| 375 | +// ], | ||
| 376 | +// ), | ||
| 377 | +// ), | ||
| 378 | + | ||
| 379 | +// // VEmptyView(15), | ||
| 380 | +// // Text( | ||
| 381 | +// // ' ', | ||
| 382 | +// // style: TextStyle( | ||
| 383 | +// // color: MyColours.color_333333, | ||
| 384 | +// // fontSize: | ||
| 385 | +// // ScreenUtil().setSp(34), | ||
| 386 | +// // fontWeight: FontWeight.bold), | ||
| 387 | +// // ), | ||
| 388 | +// // VEmptyView(20), | ||
| 389 | +// // Text(' ', | ||
| 390 | +// // style: TextStyle( | ||
| 391 | +// // color: MyColours.color_333333, | ||
| 392 | +// // fontSize: | ||
| 393 | +// // ScreenUtil().setSp(28), | ||
| 394 | +// // )) | ||
| 395 | +// ), | ||
| 396 | +// Positioned( | ||
| 397 | +// bottom: ScreenUtil() | ||
| 398 | +// .setWidth(46), | ||
| 399 | +// right: ScreenUtil() | ||
| 400 | +// .setWidth(20), | ||
| 401 | +// child: model.status == '1' | ||
| 402 | +// ? SizedBox() | ||
| 403 | +// : Image.asset( | ||
| 404 | +// Utils.getImgPath( | ||
| 405 | +// 'stop-sell'), | ||
| 406 | +// width: ScreenUtil() | ||
| 407 | +// .setWidth(82), | ||
| 408 | +// height: ScreenUtil() | ||
| 409 | +// .setWidth(52), | ||
| 410 | +// )), | ||
| 411 | +// ])); | ||
| 412 | +// }, | ||
| 413 | +// staggeredTileBuilder: (int index) => | ||
| 414 | +// new StaggeredTile.count( | ||
| 415 | +// 2, | ||
| 416 | +// menuManageProvider | ||
| 417 | +// .menuModel[indexOut] | ||
| 418 | +// .cookbooklist[index] | ||
| 419 | +// .image != | ||
| 420 | +// null | ||
| 421 | +// ? ScreenUtil().setWidth(4.2) | ||
| 422 | +// : ScreenUtil().setWidth(2.85)), | ||
| 423 | +// mainAxisSpacing: | ||
| 424 | +// ScreenUtil().setWidth(15 * 2), | ||
| 425 | +// crossAxisSpacing: | ||
| 426 | +// ScreenUtil().setWidth(15 * 2), | ||
| 427 | +// ), | ||
| 428 | +// ], | ||
| 429 | +// ); | ||
| 430 | +// })), | ||
| 431 | +// Row( | ||
| 432 | +// mainAxisAlignment: MainAxisAlignment.spaceBetween, | ||
| 433 | +// children: [ | ||
| 434 | +// !isShow | ||
| 435 | +// ? SizedBox() | ||
| 436 | +// : Padding( | ||
| 437 | +// padding: EdgeInsets.fromLTRB( | ||
| 438 | +// ScreenUtil().setWidth(40), | ||
| 439 | +// 0, | ||
| 440 | +// ScreenUtil().setWidth(40), | ||
| 441 | +// ScreenUtil().setWidth(40)), | ||
| 442 | +// child: RoundButton( | ||
| 443 | +// onPressed: () async { | ||
| 444 | +// await NavigatorUtil.goMenuAddDishesPage( | ||
| 445 | +// context); | ||
| 446 | +// }, | ||
| 447 | +// text: '添加\n菜品', | ||
| 448 | +// fontSize: 26, | ||
| 449 | +// isBold: false, | ||
| 450 | +// height: ScreenUtil().setWidth(120), | ||
| 451 | +// width: ScreenUtil().setWidth(120), | ||
| 452 | +// radius: ScreenUtil().setWidth(60), | ||
| 453 | +// )), | ||
| 454 | +// Padding( | ||
| 455 | +// padding: EdgeInsets.fromLTRB( | ||
| 456 | +// ScreenUtil().setWidth(40), | ||
| 457 | +// 0, | ||
| 458 | +// ScreenUtil().setWidth(40), | ||
| 459 | +// ScreenUtil().setWidth(40)), | ||
| 460 | +// child: RoundButton( | ||
| 461 | +// onPressed: () async { | ||
| 462 | +// bool needRefresh = | ||
| 463 | +// await NavigatorUtil.goMenuCategoryPage( | ||
| 464 | +// context); | ||
| 465 | +// print(needRefresh); | ||
| 466 | +// if (needRefresh != null && needRefresh) { | ||
| 467 | +// //刷新页面数据 | ||
| 468 | +// // _controller.callRefresh(); | ||
| 469 | +// // _couponNetworkData(); | ||
| 470 | +// } | ||
| 471 | +// }, | ||
| 472 | +// text: '分类\n管理', | ||
| 473 | +// fontSize: 26, | ||
| 474 | +// isBold: false, | ||
| 475 | +// height: ScreenUtil().setWidth(120), | ||
| 476 | +// width: ScreenUtil().setWidth(120), | ||
| 477 | +// radius: ScreenUtil().setWidth(60), | ||
| 478 | +// )) | ||
| 479 | +// ], | ||
| 480 | +// ) | ||
| 481 | +// ]); | ||
| 482 | +// } | ||
| 483 | +// }, | ||
| 484 | +// ), | ||
| 485 | +// // VEmptyView(20), | ||
| 486 | +// )); | ||
| 487 | +// } | ||
| 488 | +// } |
| 1 | +import 'package:flutter/material.dart'; | ||
| 2 | +import 'package:flutter_keyboard_visibility/flutter_keyboard_visibility.dart'; | ||
| 3 | +import 'package:one_key/route/navigator_util.dart'; | ||
| 4 | +import 'package:one_key/widgets/round_button.dart'; | ||
| 5 | +import 'package:one_key/widgets/system_app_bar.dart'; | ||
| 6 | +import 'package:one_key/widgets/v_empty_view.dart'; | ||
| 7 | + | ||
| 8 | +import '../../../res/colors.dart'; | ||
| 9 | +import '../../../utils/screen_util.dart'; | ||
| 10 | +import '../../../utils/utils.dart'; | ||
| 11 | +import '../../../widgets/MyDivider.dart'; | ||
| 12 | +import '../../../widgets/h_empty_view.dart'; | ||
| 13 | + | ||
| 14 | +/** | ||
| 15 | + * | ||
| 16 | + * 配置规格和价格 | ||
| 17 | + */ | ||
| 18 | +class MenuSetPricePage extends StatefulWidget { | ||
| 19 | + MenuSetPricePage({Key key}) : super(key: key); | ||
| 20 | + | ||
| 21 | + @override | ||
| 22 | + _MenuSetPricePageState createState() => _MenuSetPricePageState(); | ||
| 23 | +} | ||
| 24 | + | ||
| 25 | +class _MenuSetPricePageState extends State<MenuSetPricePage> { | ||
| 26 | + bool swichState = false; | ||
| 27 | + | ||
| 28 | + List data = ['', '']; | ||
| 29 | + | ||
| 30 | + ///输入框 | ||
| 31 | + Widget _textfield( | ||
| 32 | + String title, | ||
| 33 | + String hintText, | ||
| 34 | + TextEditingController editingController, | ||
| 35 | + FocusNode focusNode, | ||
| 36 | + String subTitle, | ||
| 37 | + {bool needStar = true, | ||
| 38 | + TextInputType inputType = TextInputType.number}) { | ||
| 39 | + return Container( | ||
| 40 | + child: Row( | ||
| 41 | + mainAxisAlignment: MainAxisAlignment.spaceBetween, | ||
| 42 | + children: [ | ||
| 43 | + Container( | ||
| 44 | + child: Text( | ||
| 45 | + title, | ||
| 46 | + style: | ||
| 47 | + TextStyle(color: MyColours.color_515151, fontSize: font(16)), | ||
| 48 | + ), | ||
| 49 | + ), | ||
| 50 | + HEmptyView(10), | ||
| 51 | + needStar | ||
| 52 | + ? Container( | ||
| 53 | + padding: EdgeInsets.only(top: w(5)), | ||
| 54 | + child: Text( | ||
| 55 | + '*', | ||
| 56 | + style: TextStyle( | ||
| 57 | + color: MyColours.color_515151, | ||
| 58 | + ), | ||
| 59 | + ), | ||
| 60 | + ) | ||
| 61 | + : SizedBox(), | ||
| 62 | + // Spacer(), | ||
| 63 | + Expanded( | ||
| 64 | + child: Container( | ||
| 65 | + // height: ScreenUtil().setHeight(120), | ||
| 66 | + padding: EdgeInsets.only( | ||
| 67 | + left: w(10), | ||
| 68 | + right: w(10), | ||
| 69 | + ), | ||
| 70 | + child: TextField( | ||
| 71 | + controller: editingController, | ||
| 72 | + textAlign: TextAlign.right, | ||
| 73 | + // textAlignVertical: TextAlignVertical.bottom, | ||
| 74 | + maxLines: 1, | ||
| 75 | + inputFormatters: [], | ||
| 76 | + | ||
| 77 | + // //光标颜色 | ||
| 78 | + // cursorColor: | ||
| 79 | + // widget.isSelect ? Colors.white : MyColours.color_199095, | ||
| 80 | + //输入文本的样式 | ||
| 81 | + style: TextStyle( | ||
| 82 | + color: MyColours.color_515151, | ||
| 83 | + fontSize: font(16), | ||
| 84 | + ), | ||
| 85 | + focusNode: focusNode, | ||
| 86 | + decoration: InputDecoration( | ||
| 87 | + border: OutlineInputBorder(borderSide: BorderSide.none), | ||
| 88 | + hintText: hintText, | ||
| 89 | + hintStyle: TextStyle( | ||
| 90 | + color: MyColours.color_999999, | ||
| 91 | + fontSize: font(16), | ||
| 92 | + ), | ||
| 93 | + enabledBorder: new UnderlineInputBorder( | ||
| 94 | + borderSide: BorderSide.none, | ||
| 95 | + ), | ||
| 96 | + focusedBorder: new UnderlineInputBorder( | ||
| 97 | + borderSide: BorderSide.none, | ||
| 98 | + ), | ||
| 99 | + contentPadding: EdgeInsets.zero, | ||
| 100 | + ), | ||
| 101 | + onChanged: (value) {}, | ||
| 102 | + onEditingComplete: () { | ||
| 103 | + FocusScope.of(context) | ||
| 104 | + .requestFocus(FocusNode()); //点击空白处隐藏键盘 | ||
| 105 | + }, | ||
| 106 | + keyboardType: inputType, | ||
| 107 | + )), | ||
| 108 | + ), | ||
| 109 | + Container( | ||
| 110 | + child: Text( | ||
| 111 | + subTitle, | ||
| 112 | + style: TextStyle( | ||
| 113 | + color: MyColours.color_333333, | ||
| 114 | + fontWeight: FontWeight.bold, | ||
| 115 | + fontSize: font(16)), | ||
| 116 | + ), | ||
| 117 | + ), | ||
| 118 | + ], | ||
| 119 | + ), | ||
| 120 | + ); | ||
| 121 | + } | ||
| 122 | + | ||
| 123 | + ///选择 | ||
| 124 | + Widget _select(String title, String hintText, VoidCallback callback, | ||
| 125 | + {bool needStar = true}) { | ||
| 126 | + return InkWell( | ||
| 127 | + onTap: callback, | ||
| 128 | + child: Container( | ||
| 129 | + // padding: EdgeInsets.symmetric(vertical: ScreenUtil().setWidth(40)), | ||
| 130 | + child: Row( | ||
| 131 | + crossAxisAlignment: CrossAxisAlignment.center, | ||
| 132 | + mainAxisAlignment: MainAxisAlignment.center, | ||
| 133 | + children: [ | ||
| 134 | + Container( | ||
| 135 | + child: Text( | ||
| 136 | + title, | ||
| 137 | + style: TextStyle( | ||
| 138 | + color: MyColours.color_515151, fontSize: font(16)), | ||
| 139 | + ), | ||
| 140 | + ), | ||
| 141 | + HEmptyView(10), | ||
| 142 | + needStar | ||
| 143 | + ? Container( | ||
| 144 | + padding: EdgeInsets.only(top: w(5)), | ||
| 145 | + child: Text( | ||
| 146 | + '*', | ||
| 147 | + style: TextStyle( | ||
| 148 | + color: MyColours.color_515151, | ||
| 149 | + ), | ||
| 150 | + ), | ||
| 151 | + ) | ||
| 152 | + : SizedBox(), | ||
| 153 | + Spacer(), | ||
| 154 | + Text(hintText, | ||
| 155 | + style: TextStyle( | ||
| 156 | + color: hintText == '请选择' || | ||
| 157 | + hintText == '点击配置菜品价格' || | ||
| 158 | + hintText == '点击配置菜品做法' || | ||
| 159 | + hintText == '点击配置烹调方法' || | ||
| 160 | + hintText == '请选择销售单位' | ||
| 161 | + ? MyColours.color_999999 | ||
| 162 | + : MyColours.color_515151, | ||
| 163 | + fontWeight: FontWeight.normal, | ||
| 164 | + fontSize: font(16), | ||
| 165 | + )), | ||
| 166 | + HEmptyView(20), | ||
| 167 | + Image.asset( | ||
| 168 | + Utils.getImgPath('arr_right_gray'), | ||
| 169 | + width: w(6), | ||
| 170 | + height: w(11), | ||
| 171 | + ) | ||
| 172 | + ], | ||
| 173 | + ), | ||
| 174 | + ), | ||
| 175 | + ); | ||
| 176 | + } | ||
| 177 | + | ||
| 178 | + @override | ||
| 179 | + Widget build(BuildContext context) { | ||
| 180 | + return KeyboardDismissOnTap( | ||
| 181 | + child: Scaffold( | ||
| 182 | + backgroundColor: MyColours.color_DBDBDB, | ||
| 183 | + appBar: SystemAppBar('菜品规格及定价'), | ||
| 184 | + body: Column( | ||
| 185 | + children: [ | ||
| 186 | + Expanded( | ||
| 187 | + child: ListView.builder( | ||
| 188 | + shrinkWrap: true, | ||
| 189 | + itemCount: data.length + 1, | ||
| 190 | + itemBuilder: (context, index) { | ||
| 191 | + if ((index == 0 && data.length == 0) || | ||
| 192 | + index == data.length) { | ||
| 193 | + return InkWell( | ||
| 194 | + onTap: () { | ||
| 195 | + data.add(''); | ||
| 196 | + setState(() {}); | ||
| 197 | + }, | ||
| 198 | + child: Container( | ||
| 199 | + height: w(190), | ||
| 200 | + color: MyColours.color_ffffff, | ||
| 201 | + child: Column( | ||
| 202 | + mainAxisAlignment: MainAxisAlignment.center, | ||
| 203 | + children: [ | ||
| 204 | + Image.asset( | ||
| 205 | + Utils.getImgPath('f_add_image'), | ||
| 206 | + width: w(30), | ||
| 207 | + ), | ||
| 208 | + VEmptyView(46), | ||
| 209 | + Text( | ||
| 210 | + '添加定价', | ||
| 211 | + style: TextStyle( | ||
| 212 | + color: MyColours.color_000000, | ||
| 213 | + fontSize: font(24)), | ||
| 214 | + ) | ||
| 215 | + ], | ||
| 216 | + ), | ||
| 217 | + )); | ||
| 218 | + } | ||
| 219 | + return Container( | ||
| 220 | + color: MyColours.color_ffffff, | ||
| 221 | + margin: EdgeInsets.only(bottom: w(12)), | ||
| 222 | + child: Column( | ||
| 223 | + children: [ | ||
| 224 | + InkWell( | ||
| 225 | + onTap: () { | ||
| 226 | + setState(() { | ||
| 227 | + swichState = !swichState; | ||
| 228 | + }); | ||
| 229 | + }, | ||
| 230 | + child: Container( | ||
| 231 | + height: w(48), | ||
| 232 | + padding: EdgeInsets.symmetric( | ||
| 233 | + horizontal: w(16), | ||
| 234 | + ), | ||
| 235 | + child: Row( | ||
| 236 | + mainAxisAlignment: | ||
| 237 | + MainAxisAlignment.spaceBetween, | ||
| 238 | + children: [ | ||
| 239 | + Container( | ||
| 240 | + child: Text( | ||
| 241 | + '启用该规格', | ||
| 242 | + style: TextStyle( | ||
| 243 | + color: MyColours.color_515151, | ||
| 244 | + fontSize: font(16)), | ||
| 245 | + ), | ||
| 246 | + ), | ||
| 247 | + Image.asset( | ||
| 248 | + swichState | ||
| 249 | + ? Utils.getImgPath('swich_on') | ||
| 250 | + : Utils.getImgPath('swich_off'), | ||
| 251 | + width: w(44), | ||
| 252 | + height: w(24), | ||
| 253 | + ) | ||
| 254 | + ], | ||
| 255 | + )), | ||
| 256 | + ), | ||
| 257 | + Padding( | ||
| 258 | + padding: EdgeInsets.only(left: w(16)), | ||
| 259 | + child: MyDivider( | ||
| 260 | + double.infinity, | ||
| 261 | + w(0.5), | ||
| 262 | + color: MyColours.color_E7E7E7, | ||
| 263 | + )), | ||
| 264 | + Container( | ||
| 265 | + height: w(48), | ||
| 266 | + padding: | ||
| 267 | + EdgeInsets.symmetric(horizontal: w(16)), | ||
| 268 | + child: _select('销售单位', '请选择销售单位', () async { | ||
| 269 | + await NavigatorUtil.goMenuUnitPage(context); | ||
| 270 | + }, needStar: false)), | ||
| 271 | + Padding( | ||
| 272 | + padding: EdgeInsets.only(left: w(16)), | ||
| 273 | + child: MyDivider( | ||
| 274 | + double.infinity, | ||
| 275 | + w(0.5), | ||
| 276 | + color: MyColours.color_E7E7E7, | ||
| 277 | + )), | ||
| 278 | + Container( | ||
| 279 | + height: w(48), | ||
| 280 | + padding: | ||
| 281 | + EdgeInsets.symmetric(horizontal: w(16)), | ||
| 282 | + child: | ||
| 283 | + _textfield('售价', '点击输入售价', null, null, '')), | ||
| 284 | + Padding( | ||
| 285 | + padding: EdgeInsets.only(left: w(16)), | ||
| 286 | + child: MyDivider( | ||
| 287 | + double.infinity, | ||
| 288 | + w(0.5), | ||
| 289 | + color: MyColours.color_E7E7E7, | ||
| 290 | + )), | ||
| 291 | + Container( | ||
| 292 | + height: w(48), | ||
| 293 | + padding: | ||
| 294 | + EdgeInsets.symmetric(horizontal: w(16)), | ||
| 295 | + child: _textfield( | ||
| 296 | + '会员价格', '点击输入会员价格', null, null, '')), | ||
| 297 | + ], | ||
| 298 | + ), | ||
| 299 | + ); | ||
| 300 | + })), | ||
| 301 | + Container( | ||
| 302 | + color: MyColours.color_ffffff, | ||
| 303 | + padding: EdgeInsets.only( | ||
| 304 | + left: w(15), right: w(15), top: w(13), bottom: w(26)), | ||
| 305 | + child: RoundButton( | ||
| 306 | + text: '保存', | ||
| 307 | + textColor: MyColours.color_F8F9FD, | ||
| 308 | + bgColor: MyColours.color_438E93, | ||
| 309 | + radius: r(5), | ||
| 310 | + fontSize: 32, | ||
| 311 | + isBold: true, | ||
| 312 | + onPressed: () {}, | ||
| 313 | + ), | ||
| 314 | + ) | ||
| 315 | + ], | ||
| 316 | + ), | ||
| 317 | + ), | ||
| 318 | + ); | ||
| 319 | + } | ||
| 320 | +} |
lib/pages/my/menu_type/menu_unit_page.dart
0 → 100644
| 1 | +import 'package:flutter/material.dart'; | ||
| 2 | +import 'package:one_key/res/colors.dart'; | ||
| 3 | +import 'package:one_key/utils/dialog_util.dart'; | ||
| 4 | +import 'package:one_key/utils/utils.dart'; | ||
| 5 | +import 'package:one_key/widgets/h_empty_view.dart'; | ||
| 6 | +import 'package:one_key/widgets/system_app_bar.dart'; | ||
| 7 | + | ||
| 8 | +import '../../../utils/screen_util.dart'; | ||
| 9 | + | ||
| 10 | +/** | ||
| 11 | + * 销售单位 份、位、晚 | ||
| 12 | + */ | ||
| 13 | + | ||
| 14 | +class MenuUnitPage extends StatefulWidget { | ||
| 15 | + MenuUnitPage({Key key}) : super(key: key); | ||
| 16 | + | ||
| 17 | + @override | ||
| 18 | + _MenuUnitPageState createState() => _MenuUnitPageState(); | ||
| 19 | +} | ||
| 20 | + | ||
| 21 | +class _MenuUnitPageState extends State<MenuUnitPage> { | ||
| 22 | + List data = ['位', '份']; | ||
| 23 | + bool select = true; | ||
| 24 | + @override | ||
| 25 | + Widget build(BuildContext context) { | ||
| 26 | + return Scaffold( | ||
| 27 | + backgroundColor: MyColours.color_DBDBDB, | ||
| 28 | + appBar: SystemAppBar('销售单位'), | ||
| 29 | + body: ListView.builder( | ||
| 30 | + itemCount: data.length + 1, | ||
| 31 | + itemBuilder: (context, index) { | ||
| 32 | + if ((index == 0 && data.length == 0) || index == data.length) { | ||
| 33 | + return Container( | ||
| 34 | + height: w(48), | ||
| 35 | + margin: EdgeInsets.only(top: w(10), left: w(10), right: w(10)), | ||
| 36 | + decoration: BoxDecoration( | ||
| 37 | + color: MyColours.color_ffffff, | ||
| 38 | + border: | ||
| 39 | + Border.all(width: w(1), color: MyColours.color_515151), | ||
| 40 | + borderRadius: BorderRadius.circular(r(5))), | ||
| 41 | + child: Row( | ||
| 42 | + mainAxisAlignment: MainAxisAlignment.center, | ||
| 43 | + children: [ | ||
| 44 | + Image.asset( | ||
| 45 | + Utils.getImgPath('f_add_image'), | ||
| 46 | + width: w(15), | ||
| 47 | + ), | ||
| 48 | + HEmptyView(22), | ||
| 49 | + Text( | ||
| 50 | + '添加新规格', | ||
| 51 | + textAlign: TextAlign.center, | ||
| 52 | + style: TextStyle( | ||
| 53 | + color: MyColours.color_515151, fontSize: font(16)), | ||
| 54 | + ), | ||
| 55 | + ], | ||
| 56 | + ), | ||
| 57 | + ); | ||
| 58 | + } | ||
| 59 | + return Container( | ||
| 60 | + height: w(48), | ||
| 61 | + margin: EdgeInsets.only(top: w(10), left: w(10), right: w(10)), | ||
| 62 | + decoration: BoxDecoration( | ||
| 63 | + color: | ||
| 64 | + select ? MyColours.color_438E93 : MyColours.color_ffffff, | ||
| 65 | + border: Border.all( | ||
| 66 | + width: w(1), | ||
| 67 | + color: select | ||
| 68 | + ? MyColours.color_438E93 | ||
| 69 | + : MyColours.color_515151), | ||
| 70 | + borderRadius: BorderRadius.circular(r(5))), | ||
| 71 | + child: Row( | ||
| 72 | + children: [ | ||
| 73 | + Expanded( | ||
| 74 | + child: Text( | ||
| 75 | + '份', | ||
| 76 | + textAlign: TextAlign.center, | ||
| 77 | + style: TextStyle( | ||
| 78 | + color: select | ||
| 79 | + ? MyColours.color_F8F9FD | ||
| 80 | + : MyColours.color_515151, | ||
| 81 | + fontSize: font(16)), | ||
| 82 | + )), | ||
| 83 | + InkWell( | ||
| 84 | + onTap: () { | ||
| 85 | + DialogUtil.cupertinoAlertDialog(context, | ||
| 86 | + content: | ||
| 87 | + '确定要删除销售规格“条”吗?删除后,您可以通过添加新规格增加。\n如果有菜品使用该销售单位定价,则无法删除。', | ||
| 88 | + textAlign: TextAlign.left,rCallback: (){ | ||
| 89 | + //确定删除 | ||
| 90 | + }); | ||
| 91 | + }, | ||
| 92 | + child: Image.asset( | ||
| 93 | + Utils.getImgPath('close'), | ||
| 94 | + width: w(15), | ||
| 95 | + )), | ||
| 96 | + HEmptyView(20) | ||
| 97 | + ], | ||
| 98 | + ), | ||
| 99 | + ); | ||
| 100 | + }), | ||
| 101 | + ); | ||
| 102 | + } | ||
| 103 | +} |
lib/pages/my/menu_type/text_ex.dart
0 → 100644
| 1 | import 'package:flutter/material.dart'; | 1 | import 'package:flutter/material.dart'; |
| 2 | 2 | ||
| 3 | class MyColours { | 3 | class MyColours { |
| 4 | - | ||
| 5 | - | 4 | + static const Color color_4D4E50 = Color(0xFF4D4E50); |
| 6 | static const Color color_00715F = Color(0xFF00715F); | 5 | static const Color color_00715F = Color(0xFF00715F); |
| 7 | static const Color color_80D9D9D9 = Color(0x80D9D9D9); | 6 | static const Color color_80D9D9D9 = Color(0x80D9D9D9); |
| 8 | static const Color color_42A5FF = Color(0xFF42A5FF); | 7 | static const Color color_42A5FF = Color(0xFF42A5FF); |
| @@ -1643,4 +1643,30 @@ class NavigatorUtil { | @@ -1643,4 +1643,30 @@ class NavigatorUtil { | ||
| 1643 | "${Routes.order_share_page}?object=${FluroConvertUtils.object2string(object)}&priceSum=$priceSum&memberPriceSum=$memberPriceSum&planDishText=${Uri.encodeComponent(planDishText)}&name=${Uri.encodeComponent(name)}&remark=${Uri.encodeComponent(remark)}&detail=${FluroConvertUtils.object2string(detailEntity)}&isRecharge=${isRecharge}&isRecommend=${isRecommend}&recommend=${Uri.encodeComponent(recommend)}", | 1643 | "${Routes.order_share_page}?object=${FluroConvertUtils.object2string(object)}&priceSum=$priceSum&memberPriceSum=$memberPriceSum&planDishText=${Uri.encodeComponent(planDishText)}&name=${Uri.encodeComponent(name)}&remark=${Uri.encodeComponent(remark)}&detail=${FluroConvertUtils.object2string(detailEntity)}&isRecharge=${isRecharge}&isRecommend=${isRecommend}&recommend=${Uri.encodeComponent(recommend)}", |
| 1644 | replace: replace); | 1644 | replace: replace); |
| 1645 | } | 1645 | } |
| 1646 | + | ||
| 1647 | + ///菜单管理------规格和价格设置 | ||
| 1648 | + static Future<dynamic> goMenuSetPricePage( | ||
| 1649 | + BuildContext context, { | ||
| 1650 | + replace = false, | ||
| 1651 | + }) { | ||
| 1652 | + return _navigateTo(context, "${Routes.menu_set_price_page}", | ||
| 1653 | + replace: replace); | ||
| 1654 | + } | ||
| 1655 | + | ||
| 1656 | + ///菜单管理-----配置销售单位 | ||
| 1657 | + static Future<dynamic> goMenuUnitPage( | ||
| 1658 | + BuildContext context, { | ||
| 1659 | + replace = false, | ||
| 1660 | + }) { | ||
| 1661 | + return _navigateTo(context, "${Routes.menu_unit_page}", replace: replace); | ||
| 1662 | + } | ||
| 1663 | + | ||
| 1664 | + ///菜单管理-----做法 | ||
| 1665 | + static Future<dynamic> goMenuDishMethodPage( | ||
| 1666 | + BuildContext context, { | ||
| 1667 | + replace = false, | ||
| 1668 | + }) { | ||
| 1669 | + return _navigateTo(context, "${Routes.menu_dish_method_page}", | ||
| 1670 | + replace: replace); | ||
| 1671 | + } | ||
| 1646 | } | 1672 | } |
| @@ -86,6 +86,7 @@ import 'package:one_key/pages/my/feast_manage/feast_deposit_manage_page.dart'; | @@ -86,6 +86,7 @@ import 'package:one_key/pages/my/feast_manage/feast_deposit_manage_page.dart'; | ||
| 86 | import 'package:one_key/pages/my/feast_manage/feast_personal_page.dart'; | 86 | import 'package:one_key/pages/my/feast_manage/feast_personal_page.dart'; |
| 87 | import 'package:one_key/pages/my/feast_manage/feast_setmeal_manage_page.dart'; | 87 | import 'package:one_key/pages/my/feast_manage/feast_setmeal_manage_page.dart'; |
| 88 | import 'package:one_key/pages/my/marketing_center/book_notification/marking_interaction_page.dart'; | 88 | import 'package:one_key/pages/my/marketing_center/book_notification/marking_interaction_page.dart'; |
| 89 | +import 'package:one_key/pages/my/menu_type/menu_set_price_page.dart'; | ||
| 89 | import 'package:one_key/pages/my/personnel_type/base_info_personnal_page.dart'; | 90 | import 'package:one_key/pages/my/personnel_type/base_info_personnal_page.dart'; |
| 90 | import 'package:one_key/pages/my/personnel_type/personnel_detail_page.dart'; | 91 | import 'package:one_key/pages/my/personnel_type/personnel_detail_page.dart'; |
| 91 | import 'package:one_key/pages/my/personnel_type/personnel_manage_page.dart'; | 92 | import 'package:one_key/pages/my/personnel_type/personnel_manage_page.dart'; |
| @@ -95,9 +96,9 @@ import 'package:one_key/pages/my/personnel_type/personnel_password_show_page.dar | @@ -95,9 +96,9 @@ import 'package:one_key/pages/my/personnel_type/personnel_password_show_page.dar | ||
| 95 | import 'package:one_key/pages/my/base_info.dart'; | 96 | import 'package:one_key/pages/my/base_info.dart'; |
| 96 | import 'package:one_key/pages/my/book_time_set.dart'; | 97 | import 'package:one_key/pages/my/book_time_set.dart'; |
| 97 | import 'package:one_key/pages/my/contant_page.dart'; | 98 | import 'package:one_key/pages/my/contant_page.dart'; |
| 98 | -import 'package:one_key/pages/my/menu_type/menu_add_dishes_page.dart'; | 99 | +import 'package:one_key/pages/my/menu_type/menu_add_dishes_page_old.dart'; |
| 99 | import 'package:one_key/pages/my/menu_type/menu_category_page.dart'; | 100 | import 'package:one_key/pages/my/menu_type/menu_category_page.dart'; |
| 100 | -import 'package:one_key/pages/my/menu_type/menu_manage_page.dart'; | 101 | +import 'package:one_key/pages/my/menu_type/menu_manage_page_old.dart'; |
| 101 | import 'package:one_key/pages/my/my_integral_page.dart'; | 102 | import 'package:one_key/pages/my/my_integral_page.dart'; |
| 102 | import 'package:one_key/pages/my/photo_type/photo_manager_page.dart'; | 103 | import 'package:one_key/pages/my/photo_type/photo_manager_page.dart'; |
| 103 | import 'package:one_key/pages/my/receive_orders_time_set.dart'; | 104 | import 'package:one_key/pages/my/receive_orders_time_set.dart'; |
| @@ -196,6 +197,10 @@ import '../pages/my/marketing_center/recharge/recharge_detail_page.dart'; | @@ -196,6 +197,10 @@ import '../pages/my/marketing_center/recharge/recharge_detail_page.dart'; | ||
| 196 | import '../pages/my/marketing_center/recharge/recharge_edit_page.dart'; | 197 | import '../pages/my/marketing_center/recharge/recharge_edit_page.dart'; |
| 197 | import '../pages/my/marketing_center/recharge/recharge_home_page.dart'; | 198 | import '../pages/my/marketing_center/recharge/recharge_home_page.dart'; |
| 198 | import '../pages/my/marketing_center/recharge/recharge_select_store_coupon_page.dart'; | 199 | import '../pages/my/marketing_center/recharge/recharge_select_store_coupon_page.dart'; |
| 200 | +import '../pages/my/menu_type/menu_add_dishes_page.dart'; | ||
| 201 | +import '../pages/my/menu_type/menu_dish_method_page.dart'; | ||
| 202 | +import '../pages/my/menu_type/menu_manage_page.dart'; | ||
| 203 | +import '../pages/my/menu_type/menu_unit_page.dart'; | ||
| 199 | import '../pages/my/plan_dish/final_plan_dish_page.dart'; | 204 | import '../pages/my/plan_dish/final_plan_dish_page.dart'; |
| 200 | import '../pages/my/plan_dish/my_plan_dish_home_page.dart'; | 205 | import '../pages/my/plan_dish/my_plan_dish_home_page.dart'; |
| 201 | import '../pages/my/plan_dish/plan_dish_create_select_type_page.dart'; | 206 | import '../pages/my/plan_dish/plan_dish_create_select_type_page.dart'; |
| @@ -2586,7 +2591,8 @@ var verificationCouponPageHandle = new Handler( | @@ -2586,7 +2591,8 @@ var verificationCouponPageHandle = new Handler( | ||
| 2586 | // selectList = selectIDs.split(','); | 2591 | // selectList = selectIDs.split(','); |
| 2587 | // } | 2592 | // } |
| 2588 | return ChangeNotifierProvider<CouponProvider>( | 2593 | return ChangeNotifierProvider<CouponProvider>( |
| 2589 | - create: (_) => CouponProvider(), child: VerificationCouponPage(idstr:idstr)); | 2594 | + create: (_) => CouponProvider(), |
| 2595 | + child: VerificationCouponPage(idstr: idstr)); | ||
| 2590 | }); | 2596 | }); |
| 2591 | 2597 | ||
| 2592 | ///充值优惠选择 | 2598 | ///充值优惠选择 |
| @@ -2603,20 +2609,6 @@ var markingRechargeSelectPageHandle = new Handler( | @@ -2603,20 +2609,6 @@ var markingRechargeSelectPageHandle = new Handler( | ||
| 2603 | ///排菜单微信分享截屏页 | 2609 | ///排菜单微信分享截屏页 |
| 2604 | var orderSharePageHandle = new Handler( | 2610 | var orderSharePageHandle = new Handler( |
| 2605 | handlerFunc: (BuildContext context, Map<dynamic, List<Object>> params) { | 2611 | handlerFunc: (BuildContext context, Map<dynamic, List<Object>> params) { |
| 2606 | - // String fromPage = params["fromPage"].first; | ||
| 2607 | - // String tids = params["tids"].first; | ||
| 2608 | - | ||
| 2609 | - // String tableidNow = params["tableidNow"].first; | ||
| 2610 | - // bool canChoose = params["canChoose"].first == "true" ? true : false; | ||
| 2611 | - // List<TableList> res = []; | ||
| 2612 | - // if (params.keys.contains('object')) { | ||
| 2613 | - // Map object = FluroConvertUtils.string2map(params["object"].first); | ||
| 2614 | - // List temp = object['object']; | ||
| 2615 | - | ||
| 2616 | - // for (var item in temp) { | ||
| 2617 | - // res.add(TableList.fromJson(item)); | ||
| 2618 | - // } | ||
| 2619 | - // } | ||
| 2620 | NotebookDetail detailEntity = NotebookDetail.fromJson(json | 2612 | NotebookDetail detailEntity = NotebookDetail.fromJson(json |
| 2621 | .decode(FluroConvertUtils.fluroCnParamsDecode(params["detail"].first))); | 2613 | .decode(FluroConvertUtils.fluroCnParamsDecode(params["detail"].first))); |
| 2622 | List<MenuModel> res = []; | 2614 | List<MenuModel> res = []; |
| @@ -2643,7 +2635,6 @@ var orderSharePageHandle = new Handler( | @@ -2643,7 +2635,6 @@ var orderSharePageHandle = new Handler( | ||
| 2643 | RechargeListSunModel rechargeListSunModel; | 2635 | RechargeListSunModel rechargeListSunModel; |
| 2644 | 2636 | ||
| 2645 | if (params.keys.contains('recharge')) { | 2637 | if (params.keys.contains('recharge')) { |
| 2646 | - | ||
| 2647 | rechargeListSunModel = RechargeListSunModel.fromJson(json.decode( | 2638 | rechargeListSunModel = RechargeListSunModel.fromJson(json.decode( |
| 2648 | FluroConvertUtils.fluroCnParamsDecode(params["recharge"].first))); | 2639 | FluroConvertUtils.fluroCnParamsDecode(params["recharge"].first))); |
| 2649 | } | 2640 | } |
| @@ -2651,8 +2642,7 @@ var orderSharePageHandle = new Handler( | @@ -2651,8 +2642,7 @@ var orderSharePageHandle = new Handler( | ||
| 2651 | String recommend = params["recommend"].first; | 2642 | String recommend = params["recommend"].first; |
| 2652 | 2643 | ||
| 2653 | bool isRecommend = FluroConvertUtils.string2bool(params["isRecommend"].first); | 2644 | bool isRecommend = FluroConvertUtils.string2bool(params["isRecommend"].first); |
| 2654 | - bool isRecharge = | ||
| 2655 | - FluroConvertUtils.string2bool(params["isRecharge"].first); | 2645 | + bool isRecharge = FluroConvertUtils.string2bool(params["isRecharge"].first); |
| 2656 | 2646 | ||
| 2657 | return ChangeNotifierProvider<PlanDishProvider>( | 2647 | return ChangeNotifierProvider<PlanDishProvider>( |
| 2658 | create: (_) => PlanDishProvider(), | 2648 | create: (_) => PlanDishProvider(), |
| @@ -2671,3 +2661,36 @@ var orderSharePageHandle = new Handler( | @@ -2671,3 +2661,36 @@ var orderSharePageHandle = new Handler( | ||
| 2671 | isRecommend: isRecommend, | 2661 | isRecommend: isRecommend, |
| 2672 | isRecharge: isRecharge))); | 2662 | isRecharge: isRecharge))); |
| 2673 | }); | 2663 | }); |
| 2664 | + | ||
| 2665 | +///菜单管理--设置价格 | ||
| 2666 | +var menuSetPricePageHandle = new Handler( | ||
| 2667 | + handlerFunc: (BuildContext context, Map<dynamic, List<Object>> params) { | ||
| 2668 | + // String idstr = params["idstr"].first; | ||
| 2669 | + // NotebookDetail detailEntity = NotebookDetail.fromJson(json | ||
| 2670 | + // .decode(FluroConvertUtils.fluroCnParamsDecode(params["detail"].first))); | ||
| 2671 | + return ChangeNotifierProvider<MenuManageProvider>( | ||
| 2672 | + create: (_) => MenuManageProvider(), child: MenuSetPricePage()); | ||
| 2673 | +}); | ||
| 2674 | + | ||
| 2675 | + | ||
| 2676 | + | ||
| 2677 | +///菜单管理--配置销售单位 | ||
| 2678 | +var menuUnitPageHandle = new Handler( | ||
| 2679 | + handlerFunc: (BuildContext context, Map<dynamic, List<Object>> params) { | ||
| 2680 | + // String idstr = params["idstr"].first; | ||
| 2681 | + // NotebookDetail detailEntity = NotebookDetail.fromJson(json | ||
| 2682 | + // .decode(FluroConvertUtils.fluroCnParamsDecode(params["detail"].first))); | ||
| 2683 | + return ChangeNotifierProvider<MenuManageProvider>( | ||
| 2684 | + create: (_) => MenuManageProvider(), child: MenuUnitPage()); | ||
| 2685 | +}); | ||
| 2686 | + | ||
| 2687 | + | ||
| 2688 | +///菜单管理--做法 | ||
| 2689 | +var menuDishMethodPageHandle = new Handler( | ||
| 2690 | + handlerFunc: (BuildContext context, Map<dynamic, List<Object>> params) { | ||
| 2691 | + // String idstr = params["idstr"].first; | ||
| 2692 | + // NotebookDetail detailEntity = NotebookDetail.fromJson(json | ||
| 2693 | + // .decode(FluroConvertUtils.fluroCnParamsDecode(params["detail"].first))); | ||
| 2694 | + return ChangeNotifierProvider<MenuManageProvider>( | ||
| 2695 | + create: (_) => MenuManageProvider(), child: MenuDishMethodPage()); | ||
| 2696 | +}); |
| @@ -237,6 +237,17 @@ class Routes { | @@ -237,6 +237,17 @@ class Routes { | ||
| 237 | "/marking_recharge_select_page"; //充值优惠单选择页面 | 237 | "/marking_recharge_select_page"; //充值优惠单选择页面 |
| 238 | static String order_share_page = "/order_share_page"; //排菜单微信分享截屏 | 238 | static String order_share_page = "/order_share_page"; //排菜单微信分享截屏 |
| 239 | 239 | ||
| 240 | +/** 菜单管理 | ||
| 241 | + */ | ||
| 242 | + | ||
| 243 | + static String menu_set_price_page = "/menu_set_price_page"; //菜单管理---配置规格和价格 | ||
| 244 | + | ||
| 245 | + static String menu_unit_page = "/menu_unit_page"; //菜单管理---配置销售单位 | ||
| 246 | + | ||
| 247 | + static String menu_dish_method_page = "/menu_dish_method_page"; //菜单管理---做法 | ||
| 248 | + | ||
| 249 | + | ||
| 250 | + | ||
| 240 | static void configureRoutes(FluroRouter router) { | 251 | static void configureRoutes(FluroRouter router) { |
| 241 | router.notFoundHandler = new Handler( | 252 | router.notFoundHandler = new Handler( |
| 242 | handlerFunc: (BuildContext context, Map<String, List<String>> params) { | 253 | handlerFunc: (BuildContext context, Map<String, List<String>> params) { |
| @@ -456,8 +467,11 @@ class Routes { | @@ -456,8 +467,11 @@ class Routes { | ||
| 456 | 467 | ||
| 457 | router.define(marking_recharge_select_page, | 468 | router.define(marking_recharge_select_page, |
| 458 | handler: markingRechargeSelectPageHandle); | 469 | handler: markingRechargeSelectPageHandle); |
| 459 | - router.define(order_share_page, | ||
| 460 | - handler: orderSharePageHandle); | ||
| 461 | - | 470 | + router.define(order_share_page, handler: orderSharePageHandle); |
| 471 | + router.define(menu_set_price_page, handler: menuSetPricePageHandle); | ||
| 472 | + router.define(menu_unit_page, handler: menuUnitPageHandle); | ||
| 473 | + router.define(menu_dish_method_page,handler: menuDishMethodPageHandle); | ||
| 474 | + | ||
| 475 | + | ||
| 462 | } | 476 | } |
| 463 | } | 477 | } |
| @@ -53,6 +53,145 @@ typedef ClickCallback = void Function(String value); | @@ -53,6 +53,145 @@ typedef ClickCallback = void Function(String value); | ||
| 53 | // }; | 53 | // }; |
| 54 | 54 | ||
| 55 | class DialogUtil { | 55 | class DialogUtil { |
| 56 | + static Future menuMagageAlertDialog(BuildContext context, | ||
| 57 | + {GestureTapCallback onTap, double fontSize = 32}) async { | ||
| 58 | + final action = await showDialog( | ||
| 59 | + context: context, | ||
| 60 | + barrierDismissible: true, | ||
| 61 | + builder: (BuildContext context) { | ||
| 62 | + return Center( | ||
| 63 | + child: Container( | ||
| 64 | + padding: | ||
| 65 | + EdgeInsets.symmetric(horizontal: ScreenUtil().setWidth(20)), | ||
| 66 | + decoration: BoxDecoration( | ||
| 67 | + borderRadius: BorderRadius.circular(ScreenUtil().setWidth(30))), | ||
| 68 | + child: Card( | ||
| 69 | + shape: RoundedRectangleBorder( | ||
| 70 | + borderRadius: BorderRadius.all( | ||
| 71 | + Radius.circular(ScreenUtil().setWidth(30)))), //设置圆角 | ||
| 72 | + child: Column(mainAxisSize: MainAxisSize.min, children: [ | ||
| 73 | + VEmptyView(92), | ||
| 74 | + Container( | ||
| 75 | + height: ScreenUtil().setWidth(96), | ||
| 76 | + alignment: Alignment.center, | ||
| 77 | + child: Text('菜品名称(味型/烹调)及价格在顶部左侧', | ||
| 78 | + style: TextStyle( | ||
| 79 | + fontSize: ScreenUtil().setSp(fontSize), | ||
| 80 | + color: MyColours.color_515151)), | ||
| 81 | + ), | ||
| 82 | + Container( | ||
| 83 | + height: ScreenUtil().setWidth(96), | ||
| 84 | + alignment: Alignment.center, | ||
| 85 | + child: Text('菜品名称(味型/烹调)及价格在顶部右侧', | ||
| 86 | + style: TextStyle( | ||
| 87 | + fontSize: ScreenUtil().setSp(fontSize), | ||
| 88 | + color: MyColours.color_515151)), | ||
| 89 | + ), | ||
| 90 | + Container( | ||
| 91 | + height: ScreenUtil().setWidth(96), | ||
| 92 | + alignment: Alignment.center, | ||
| 93 | + child: Text('菜品名称(味型/烹调)及价格在顶部分开', | ||
| 94 | + style: TextStyle( | ||
| 95 | + fontSize: ScreenUtil().setSp(fontSize), | ||
| 96 | + color: MyColours.color_515151)), | ||
| 97 | + ), | ||
| 98 | + MyDivider( | ||
| 99 | + ScreenUtil().setWidth(280 * 2), ScreenUtil().setWidth(2), | ||
| 100 | + color: MyColours.color_efefef), | ||
| 101 | + Container( | ||
| 102 | + height: ScreenUtil().setWidth(96), | ||
| 103 | + alignment: Alignment.center, | ||
| 104 | + child: Text('大图展示菜品', | ||
| 105 | + style: TextStyle( | ||
| 106 | + fontSize: ScreenUtil().setSp(fontSize), | ||
| 107 | + color: MyColours.color_515151)), | ||
| 108 | + ), | ||
| 109 | + Container( | ||
| 110 | + height: ScreenUtil().setWidth(96), | ||
| 111 | + alignment: Alignment.center, | ||
| 112 | + child: Text('小图展示菜品', | ||
| 113 | + style: TextStyle( | ||
| 114 | + fontSize: ScreenUtil().setSp(fontSize), | ||
| 115 | + color: MyColours.color_515151)), | ||
| 116 | + ), | ||
| 117 | + MyDivider( | ||
| 118 | + ScreenUtil().setWidth(280 * 2), ScreenUtil().setWidth(2), | ||
| 119 | + color: MyColours.color_efefef), | ||
| 120 | + Container( | ||
| 121 | + height: ScreenUtil().setWidth(96), | ||
| 122 | + alignment: Alignment.center, | ||
| 123 | + child: Text('菜品向上移动一个', | ||
| 124 | + style: TextStyle( | ||
| 125 | + fontSize: ScreenUtil().setSp(fontSize), | ||
| 126 | + color: MyColours.color_515151)), | ||
| 127 | + ), | ||
| 128 | + Container( | ||
| 129 | + height: ScreenUtil().setWidth(96), | ||
| 130 | + alignment: Alignment.center, | ||
| 131 | + child: Text('菜品向下移动一个', | ||
| 132 | + style: TextStyle( | ||
| 133 | + fontSize: ScreenUtil().setSp(fontSize), | ||
| 134 | + color: MyColours.color_515151)), | ||
| 135 | + ), | ||
| 136 | + VEmptyView(60), | ||
| 137 | + MyDivider(double.infinity, ScreenUtil().setWidth(2), | ||
| 138 | + color: MyColours.color_f3f3f3), | ||
| 139 | + Row( | ||
| 140 | + // mainAxisAlignment: MainAxisAlignment.spaceBetween, | ||
| 141 | + children: [ | ||
| 142 | + RoundButton( | ||
| 143 | + text: '取消', | ||
| 144 | + width: (ScreenUtil().screenWidth - | ||
| 145 | + ScreenUtil().setWidth(62) * 2) / | ||
| 146 | + 2, | ||
| 147 | + height: ScreenUtil().setWidth(112), | ||
| 148 | + // radius: ScreenUtil().setWidth(10), | ||
| 149 | + gradientStart: Colors.transparent, | ||
| 150 | + gradientEnd: Colors.transparent, | ||
| 151 | + textColor: MyColours.color_000000, | ||
| 152 | + isBold: false, | ||
| 153 | + fontSize: 34, | ||
| 154 | + onPressed: () { | ||
| 155 | + Navigator.pop(context); | ||
| 156 | + }), | ||
| 157 | + MyDivider( | ||
| 158 | + ScreenUtil().setWidth(2), ScreenUtil().setWidth(112), | ||
| 159 | + color: MyColours.color_f3f3f3), | ||
| 160 | + RoundButton( | ||
| 161 | + text: '确定', | ||
| 162 | + width: (ScreenUtil().screenWidth - | ||
| 163 | + ScreenUtil().setWidth(62) * 2) / | ||
| 164 | + 2, | ||
| 165 | + height: ScreenUtil().setWidth(112), | ||
| 166 | + // radius: ScreenUtil().setWidth(10), | ||
| 167 | + gradientStart: Colors.transparent, | ||
| 168 | + gradientEnd: Colors.transparent, | ||
| 169 | + textColor: MyColours.color_438E93, | ||
| 170 | + fontSize: 34, | ||
| 171 | + onPressed: () { | ||
| 172 | + // if (!isRed) { | ||
| 173 | + // if (controller.text.trim() == '') { | ||
| 174 | + // Utils.showToast('请输入区域名称!'); | ||
| 175 | + // return; | ||
| 176 | + // } | ||
| 177 | + // onTap(controller.text); | ||
| 178 | + Navigator.pop(context, { | ||
| 179 | + 'name_type': '1', | ||
| 180 | + 'image_type': '1', | ||
| 181 | + 'move': '1' | ||
| 182 | + }); | ||
| 183 | + // } | ||
| 184 | + }), | ||
| 185 | + ], | ||
| 186 | + ), | ||
| 187 | + ])), | ||
| 188 | + ), | ||
| 189 | + ); | ||
| 190 | + }, | ||
| 191 | + ); | ||
| 192 | + return action; | ||
| 193 | + } | ||
| 194 | + | ||
| 56 | static Future removePersonnalDialog( | 195 | static Future removePersonnalDialog( |
| 57 | BuildContext context, List<FilterBtnModel> managerList, | 196 | BuildContext context, List<FilterBtnModel> managerList, |
| 58 | {CustomCallBackMap onTap}) async { | 197 | {CustomCallBackMap onTap}) async { |
| @@ -6075,7 +6214,7 @@ class DialogUtil { | @@ -6075,7 +6214,7 @@ class DialogUtil { | ||
| 6075 | color: MyColours.color_E6000000)) | 6214 | color: MyColours.color_E6000000)) |
| 6076 | : SizedBox(), | 6215 | : SizedBox(), |
| 6077 | content: Text(content, | 6216 | content: Text(content, |
| 6078 | - textAlign:textAlign, | 6217 | + textAlign: textAlign, |
| 6079 | style: TextStyle( | 6218 | style: TextStyle( |
| 6080 | fontWeight: | 6219 | fontWeight: |
| 6081 | isBoldContent ? FontWeight.bold : FontWeight.normal, | 6220 | isBoldContent ? FontWeight.bold : FontWeight.normal, |
| @@ -34,11 +34,23 @@ import 'dart:ui' as ui; | @@ -34,11 +34,23 @@ import 'dart:ui' as ui; | ||
| 34 | import 'package:permission_handler/permission_handler.dart'; | 34 | import 'package:permission_handler/permission_handler.dart'; |
| 35 | import 'package:path_provider/path_provider.dart'; | 35 | import 'package:path_provider/path_provider.dart'; |
| 36 | import 'package:image_cropper/image_cropper.dart'; | 36 | import 'package:image_cropper/image_cropper.dart'; |
| 37 | +import 'dart:math'; | ||
| 37 | // import 'dart:typed_data'; | 38 | // import 'dart:typed_data'; |
| 38 | 39 | ||
| 39 | typedef BookTimeSetCallback = void Function(bool needChange); | 40 | typedef BookTimeSetCallback = void Function(bool needChange); |
| 40 | 41 | ||
| 41 | class Utils { | 42 | class Utils { |
| 43 | + static randomGet(int min, int max) { | ||
| 44 | + //实例化 Random类 并赋值给 私有变量 _random | ||
| 45 | + final _random = new Random(); | ||
| 46 | +//定义 指定返回值为 int 的函数方法,传入参数为 min 和 max | ||
| 47 | + | ||
| 48 | +//变量c等于 (0+4)+随机数(9-4);实现了最小值不小于4,最大值不大于8的结果 | ||
| 49 | + var c = min + _random.nextInt(max - min); | ||
| 50 | +//打印变量 c | ||
| 51 | + print(c); //4~8 | ||
| 52 | + } | ||
| 53 | + | ||
| 42 | static bool cnIsNumber(String str) { | 54 | static bool cnIsNumber(String str) { |
| 43 | final reg = RegExp(r'^-?[0-9.]+$'); | 55 | final reg = RegExp(r'^-?[0-9.]+$'); |
| 44 | return reg.hasMatch(str); | 56 | return reg.hasMatch(str); |
| @@ -14,17 +14,19 @@ class ExceptionPage extends StatefulWidget { | @@ -14,17 +14,19 @@ class ExceptionPage extends StatefulWidget { | ||
| 14 | final String showMsg; | 14 | final String showMsg; |
| 15 | final Color defalutColor; | 15 | final Color defalutColor; |
| 16 | final String showText; | 16 | final String showText; |
| 17 | + final Color bgColor; | ||
| 17 | 18 | ||
| 18 | - const ExceptionPage( | ||
| 19 | - {Key key, | ||
| 20 | - this.pageState = PageState.Loading, | ||
| 21 | - this.callback, | ||
| 22 | - this.emptyMsg = "数据为空", | ||
| 23 | - this.emptyImg = 'bg_error', | ||
| 24 | - this.showMsg = '', | ||
| 25 | - this.defalutColor = MyColours.color_ffffff, | ||
| 26 | - this.showText}) | ||
| 27 | - : super(key: key); | 19 | + const ExceptionPage({ |
| 20 | + Key key, | ||
| 21 | + this.pageState = PageState.Loading, | ||
| 22 | + this.callback, | ||
| 23 | + this.emptyMsg = "数据为空", | ||
| 24 | + this.emptyImg = 'bg_error', | ||
| 25 | + this.showMsg = '', | ||
| 26 | + this.defalutColor = MyColours.color_ffffff, | ||
| 27 | + this.showText, | ||
| 28 | + this.bgColor = MyColours.color_ffffff, | ||
| 29 | + }) : super(key: key); | ||
| 28 | 30 | ||
| 29 | @override | 31 | @override |
| 30 | State<StatefulWidget> createState() { | 32 | State<StatefulWidget> createState() { |
| @@ -60,6 +62,7 @@ class ExceptionPageState extends State<ExceptionPage> { | @@ -60,6 +62,7 @@ class ExceptionPageState extends State<ExceptionPage> { | ||
| 60 | break; | 62 | break; |
| 61 | case PageState.Empty: | 63 | case PageState.Empty: |
| 62 | page = EmptyPage( | 64 | page = EmptyPage( |
| 65 | + bgcolor: widget.bgColor, | ||
| 63 | content: widget.emptyMsg, | 66 | content: widget.emptyMsg, |
| 64 | imgname: widget.emptyImg, | 67 | imgname: widget.emptyImg, |
| 65 | showText: widget.showText, | 68 | showText: widget.showText, |
-
Please register or login to post a comment