Showing
3 changed files
with
218 additions
and
337 deletions
| @@ -24,8 +24,9 @@ import 'package:provider/provider.dart'; | @@ -24,8 +24,9 @@ import 'package:provider/provider.dart'; | ||
| 24 | class NoteBookItemF extends StatefulWidget { | 24 | class NoteBookItemF extends StatefulWidget { |
| 25 | final num index; | 25 | final num index; |
| 26 | final Notebook notebook; | 26 | final Notebook notebook; |
| 27 | + final GestureTapCallback onTap; | ||
| 27 | 28 | ||
| 28 | - NoteBookItemF(this.notebook, this.index); | 29 | + NoteBookItemF(this.notebook, this.index, this.onTap); |
| 29 | 30 | ||
| 30 | @override | 31 | @override |
| 31 | State<StatefulWidget> createState() { | 32 | State<StatefulWidget> createState() { |
| @@ -420,12 +421,7 @@ class NoteBookItemFState extends State<NoteBookItemF> | @@ -420,12 +421,7 @@ class NoteBookItemFState extends State<NoteBookItemF> | ||
| 420 | } | 421 | } |
| 421 | } | 422 | } |
| 422 | 423 | ||
| 423 | - Color bgColor = notebook.status == '0' || | ||
| 424 | - notebook.status == "2" || | ||
| 425 | - notebook.status == "1" || | ||
| 426 | - notebook.status == '5' | ||
| 427 | - ? MyColours.color_438E93 | ||
| 428 | - : MyColours.color_BFC4D4; | 424 | + Color bgColor = canDo ? MyColours.color_438E93 : MyColours.color_BFC4D4; |
| 429 | 425 | ||
| 430 | String detail = ''; | 426 | String detail = ''; |
| 431 | if (notebook.tid.split(",").length >= 2) { | 427 | if (notebook.tid.split(",").length >= 2) { |
| @@ -468,72 +464,90 @@ class NoteBookItemFState extends State<NoteBookItemF> | @@ -468,72 +464,90 @@ class NoteBookItemFState extends State<NoteBookItemF> | ||
| 468 | ), | 464 | ), |
| 469 | child: Row( | 465 | child: Row( |
| 470 | children: [ | 466 | children: [ |
| 471 | - Column( | ||
| 472 | - crossAxisAlignment: CrossAxisAlignment.center, | ||
| 473 | - children: [ | ||
| 474 | - Container( | ||
| 475 | - width: ScreenUtil().setWidth(82 * 2), | ||
| 476 | - margin: | ||
| 477 | - EdgeInsets.only(bottom: ScreenUtil().setWidth(9 * 2)), | ||
| 478 | - alignment: Alignment.center, | ||
| 479 | - child: Text( | ||
| 480 | - notebook.name, | ||
| 481 | - maxLines: 1, | ||
| 482 | - overflow: TextOverflow.ellipsis, | ||
| 483 | - style: TextStyle( | ||
| 484 | - color: bgColor, | ||
| 485 | - fontWeight: FontWeight.bold, | ||
| 486 | - fontSize: ScreenUtil().setSp(32)), | ||
| 487 | - ), | ||
| 488 | - ), | ||
| 489 | - Padding( | ||
| 490 | - padding: EdgeInsets.only( | ||
| 491 | - bottom: ScreenUtil().setWidth(9 * 2)), | ||
| 492 | - child: Row( | ||
| 493 | - mainAxisAlignment: MainAxisAlignment.spaceEvenly, | ||
| 494 | - children: [ | ||
| 495 | - Offstage( | ||
| 496 | - offstage: notebook.tid.split(",").length < 2, | ||
| 497 | - child: Image.asset( | ||
| 498 | - Utils.getImgPath('ordered_lian'), | ||
| 499 | - width: ScreenUtil().setWidth(18 * 2), | ||
| 500 | - ), | ||
| 501 | - ), | ||
| 502 | - notebook.cusdem == null || notebook.cusdem == '' | ||
| 503 | - ? SizedBox() | ||
| 504 | - : HEmptyView(8), | ||
| 505 | - Offstage( | ||
| 506 | - offstage: notebook.cusdem == null || | ||
| 507 | - notebook.cusdem == '', | ||
| 508 | - child: Image.asset( | ||
| 509 | - Utils.getImgPath('ordered_bei'), | ||
| 510 | - width: ScreenUtil().setWidth(18 * 2), | ||
| 511 | - ), | ||
| 512 | - ), | ||
| 513 | - false ? SizedBox() : HEmptyView(8), | ||
| 514 | - Offstage( | ||
| 515 | - offstage: notebook.aname == null, | ||
| 516 | - child: Image.asset( | ||
| 517 | - Utils.getImgPath('ordered_hui'), | ||
| 518 | - width: ScreenUtil().setWidth(18 * 2), | ||
| 519 | - ), | ||
| 520 | - ) | ||
| 521 | - ], | ||
| 522 | - )), | ||
| 523 | - widget.notebook.operationText == '' | ||
| 524 | - ? SizedBox() | ||
| 525 | - : RoundButton( | ||
| 526 | - text: widget.notebook.operationText, | ||
| 527 | - gradientStart: bgColor, | ||
| 528 | - gradientEnd: bgColor, | ||
| 529 | - textColor: MyColours.color_ffffff, | ||
| 530 | - radius: ScreenUtil().setWidth(6), | ||
| 531 | - fontSize: 24, | ||
| 532 | - width: ScreenUtil().setWidth(42 * 2), | ||
| 533 | - height: ScreenUtil().setWidth(17 * 2), | ||
| 534 | - ) | ||
| 535 | - ], | ||
| 536 | - ), | 467 | + InkWell( |
| 468 | + onTap: widget.onTap, | ||
| 469 | + child: Column( | ||
| 470 | + crossAxisAlignment: CrossAxisAlignment.center, | ||
| 471 | + children: [ | ||
| 472 | + Container( | ||
| 473 | + width: ScreenUtil().setWidth(82 * 2), | ||
| 474 | + alignment: Alignment.center, | ||
| 475 | + child: Text( | ||
| 476 | + notebook.name, | ||
| 477 | + maxLines: 1, | ||
| 478 | + overflow: TextOverflow.ellipsis, | ||
| 479 | + style: TextStyle( | ||
| 480 | + color: bgColor, | ||
| 481 | + fontWeight: FontWeight.bold, | ||
| 482 | + fontSize: ScreenUtil().setSp(32)), | ||
| 483 | + ), | ||
| 484 | + ), | ||
| 485 | + canDo && | ||
| 486 | + (notebook.tid.split(",").length >= 2 || | ||
| 487 | + (notebook.cusdem != null && | ||
| 488 | + notebook.cusdem != '') || | ||
| 489 | + notebook.aname != null) | ||
| 490 | + ? VEmptyView(18) | ||
| 491 | + : SizedBox(), | ||
| 492 | + canDo && | ||
| 493 | + (notebook.tid.split(",").length >= 2 || | ||
| 494 | + (notebook.cusdem != null && | ||
| 495 | + notebook.cusdem != '') || | ||
| 496 | + notebook.aname != null) | ||
| 497 | + ? Row( | ||
| 498 | + mainAxisAlignment: | ||
| 499 | + MainAxisAlignment.spaceEvenly, | ||
| 500 | + children: [ | ||
| 501 | + Offstage( | ||
| 502 | + offstage: | ||
| 503 | + notebook.tid.split(",").length < 2, | ||
| 504 | + child: Image.asset( | ||
| 505 | + Utils.getImgPath('ordered_lian'), | ||
| 506 | + width: ScreenUtil().setWidth(18 * 2), | ||
| 507 | + ), | ||
| 508 | + ), | ||
| 509 | + notebook.cusdem == null || | ||
| 510 | + notebook.cusdem == '' | ||
| 511 | + ? SizedBox() | ||
| 512 | + : HEmptyView(8), | ||
| 513 | + Offstage( | ||
| 514 | + offstage: notebook.cusdem == null || | ||
| 515 | + notebook.cusdem == '', | ||
| 516 | + child: Image.asset( | ||
| 517 | + Utils.getImgPath('ordered_bei'), | ||
| 518 | + width: ScreenUtil().setWidth(18 * 2), | ||
| 519 | + ), | ||
| 520 | + ), | ||
| 521 | + notebook.aname == null | ||
| 522 | + ? SizedBox() | ||
| 523 | + : HEmptyView(8), | ||
| 524 | + Offstage( | ||
| 525 | + offstage: notebook.aname == null, | ||
| 526 | + child: Image.asset( | ||
| 527 | + Utils.getImgPath('ordered_hui'), | ||
| 528 | + width: ScreenUtil().setWidth(18 * 2), | ||
| 529 | + ), | ||
| 530 | + ) | ||
| 531 | + ], | ||
| 532 | + ) | ||
| 533 | + : SizedBox(), | ||
| 534 | + widget.notebook.operationText == '' | ||
| 535 | + ? SizedBox() | ||
| 536 | + : VEmptyView(18), | ||
| 537 | + widget.notebook.operationText == '' | ||
| 538 | + ? SizedBox() | ||
| 539 | + : RoundButton( | ||
| 540 | + text: widget.notebook.operationText, | ||
| 541 | + gradientStart: bgColor, | ||
| 542 | + gradientEnd: bgColor, | ||
| 543 | + textColor: MyColours.color_ffffff, | ||
| 544 | + radius: ScreenUtil().setWidth(6), | ||
| 545 | + fontSize: 24, | ||
| 546 | + width: ScreenUtil().setWidth(42 * 2), | ||
| 547 | + height: ScreenUtil().setWidth(17 * 2), | ||
| 548 | + ) | ||
| 549 | + ], | ||
| 550 | + )), | ||
| 537 | HEmptyView(24), | 551 | HEmptyView(24), |
| 538 | MyDivider( | 552 | MyDivider( |
| 539 | ScreenUtil().setWidth(2), | 553 | ScreenUtil().setWidth(2), |
| @@ -36,8 +36,9 @@ import 'package:provider/provider.dart'; | @@ -36,8 +36,9 @@ import 'package:provider/provider.dart'; | ||
| 36 | class NoteBookItemSimple extends StatefulWidget { | 36 | class NoteBookItemSimple extends StatefulWidget { |
| 37 | final num index; | 37 | final num index; |
| 38 | final Notebook notebook; | 38 | final Notebook notebook; |
| 39 | + final GestureTapCallback onTap; | ||
| 39 | 40 | ||
| 40 | - NoteBookItemSimple(this.notebook, this.index); | 41 | + NoteBookItemSimple(this.notebook, this.index, this.onTap); |
| 41 | 42 | ||
| 42 | @override | 43 | @override |
| 43 | State<StatefulWidget> createState() { | 44 | State<StatefulWidget> createState() { |
| @@ -432,12 +433,7 @@ class NoteBookItemSimpleState extends State<NoteBookItemSimple> | @@ -432,12 +433,7 @@ class NoteBookItemSimpleState extends State<NoteBookItemSimple> | ||
| 432 | } | 433 | } |
| 433 | } | 434 | } |
| 434 | 435 | ||
| 435 | - Color bgColor = notebook.status == '0' || | ||
| 436 | - notebook.status == "2" || | ||
| 437 | - notebook.status == "1" || | ||
| 438 | - notebook.status == '5' | ||
| 439 | - ? MyColours.color_438E93 | ||
| 440 | - : MyColours.color_BFC4D4; | 436 | + Color bgColor = canDo ? MyColours.color_438E93 : MyColours.color_BFC4D4; |
| 441 | 437 | ||
| 442 | String detail = ''; | 438 | String detail = ''; |
| 443 | if (notebook.tid.split(",").length >= 2) { | 439 | if (notebook.tid.split(",").length >= 2) { |
| @@ -480,38 +476,41 @@ class NoteBookItemSimpleState extends State<NoteBookItemSimple> | @@ -480,38 +476,41 @@ class NoteBookItemSimpleState extends State<NoteBookItemSimple> | ||
| 480 | ), | 476 | ), |
| 481 | child: Row( | 477 | child: Row( |
| 482 | children: [ | 478 | children: [ |
| 483 | - Column( | ||
| 484 | - crossAxisAlignment: CrossAxisAlignment.center, | ||
| 485 | - children: [ | ||
| 486 | - Container( | ||
| 487 | - width: ScreenUtil().setWidth(82 * 2), | ||
| 488 | - margin: | ||
| 489 | - EdgeInsets.only(bottom: ScreenUtil().setWidth(9 * 2)), | ||
| 490 | - alignment: Alignment.center, | ||
| 491 | - child: Text( | ||
| 492 | - notebook.name, | ||
| 493 | - maxLines: 1, | ||
| 494 | - overflow: TextOverflow.ellipsis, | ||
| 495 | - style: TextStyle( | ||
| 496 | - color: bgColor, | ||
| 497 | - fontWeight: FontWeight.bold, | ||
| 498 | - fontSize: ScreenUtil().setSp(32)), | ||
| 499 | - ), | ||
| 500 | - ), | ||
| 501 | - widget.notebook.operationText == '' | ||
| 502 | - ? SizedBox() | ||
| 503 | - : RoundButton( | ||
| 504 | - text: widget.notebook.operationText, | ||
| 505 | - gradientStart: bgColor, | ||
| 506 | - gradientEnd: bgColor, | ||
| 507 | - textColor: MyColours.color_ffffff, | ||
| 508 | - radius: ScreenUtil().setWidth(6), | ||
| 509 | - fontSize: 24, | ||
| 510 | - width: ScreenUtil().setWidth(42 * 2), | ||
| 511 | - height: ScreenUtil().setWidth(17 * 2), | ||
| 512 | - ) | ||
| 513 | - ], | ||
| 514 | - ), | 479 | + InkWell( |
| 480 | + onTap: widget.onTap, | ||
| 481 | + child: Column( | ||
| 482 | + crossAxisAlignment: CrossAxisAlignment.center, | ||
| 483 | + children: [ | ||
| 484 | + Container( | ||
| 485 | + width: ScreenUtil().setWidth(82 * 2), | ||
| 486 | + alignment: Alignment.center, | ||
| 487 | + child: Text( | ||
| 488 | + notebook.name, | ||
| 489 | + maxLines: 1, | ||
| 490 | + overflow: TextOverflow.ellipsis, | ||
| 491 | + style: TextStyle( | ||
| 492 | + color: bgColor, | ||
| 493 | + fontWeight: FontWeight.bold, | ||
| 494 | + fontSize: ScreenUtil().setSp(32)), | ||
| 495 | + ), | ||
| 496 | + ), | ||
| 497 | + widget.notebook.operationText == '' | ||
| 498 | + ? SizedBox() | ||
| 499 | + : VEmptyView(18), | ||
| 500 | + widget.notebook.operationText == '' | ||
| 501 | + ? SizedBox() | ||
| 502 | + : RoundButton( | ||
| 503 | + text: widget.notebook.operationText, | ||
| 504 | + gradientStart: bgColor, | ||
| 505 | + gradientEnd: bgColor, | ||
| 506 | + textColor: MyColours.color_ffffff, | ||
| 507 | + radius: ScreenUtil().setWidth(6), | ||
| 508 | + fontSize: 24, | ||
| 509 | + width: ScreenUtil().setWidth(42 * 2), | ||
| 510 | + height: ScreenUtil().setWidth(17 * 2), | ||
| 511 | + ) | ||
| 512 | + ], | ||
| 513 | + )), | ||
| 515 | HEmptyView(24), | 514 | HEmptyView(24), |
| 516 | MyDivider( | 515 | MyDivider( |
| 517 | ScreenUtil().setWidth(2), | 516 | ScreenUtil().setWidth(2), |
| @@ -589,61 +588,68 @@ class NoteBookItemSimpleState extends State<NoteBookItemSimple> | @@ -589,61 +588,68 @@ class NoteBookItemSimpleState extends State<NoteBookItemSimple> | ||
| 589 | children: [ | 588 | children: [ |
| 590 | notebook.nick_name == null | 589 | notebook.nick_name == null |
| 591 | ? SizedBox() | 590 | ? SizedBox() |
| 592 | - : Text( | ||
| 593 | - notebook.nick_name + '订', | ||
| 594 | - maxLines: 1, | ||
| 595 | - overflow: TextOverflow.ellipsis, | ||
| 596 | - style: TextStyle( | ||
| 597 | - color: MyColours.color_999999, | ||
| 598 | - fontSize: | ||
| 599 | - ScreenUtil().setSp(24)), | ||
| 600 | - ), | ||
| 601 | - Row( | ||
| 602 | - mainAxisAlignment: | ||
| 603 | - MainAxisAlignment.spaceEvenly, | ||
| 604 | - children: [ | ||
| 605 | - Offstage( | ||
| 606 | - offstage: notebook.tid | ||
| 607 | - .split(",") | ||
| 608 | - .length < | ||
| 609 | - 2, | ||
| 610 | - child: Image.asset( | ||
| 611 | - Utils.getImgPath( | ||
| 612 | - 'ordered_lian'), | ||
| 613 | - width: ScreenUtil() | ||
| 614 | - .setWidth(18 * 2), | ||
| 615 | - ), | ||
| 616 | - ), | ||
| 617 | - notebook.cusdem == null || | ||
| 618 | - notebook.cusdem == '' | ||
| 619 | - ? SizedBox() | ||
| 620 | - : HEmptyView(8), | ||
| 621 | - Offstage( | ||
| 622 | - offstage: | ||
| 623 | - notebook.cusdem == null || | ||
| 624 | - notebook.cusdem == '', | ||
| 625 | - child: Image.asset( | ||
| 626 | - Utils.getImgPath( | ||
| 627 | - 'ordered_bei'), | ||
| 628 | - width: ScreenUtil() | ||
| 629 | - .setWidth(18 * 2), | 591 | + : Padding( |
| 592 | + padding: EdgeInsets.only( | ||
| 593 | + right: | ||
| 594 | + ScreenUtil().setWidth(6)), | ||
| 595 | + child: Text( | ||
| 596 | + notebook.nick_name + '订', | ||
| 597 | + maxLines: 1, | ||
| 598 | + overflow: TextOverflow.ellipsis, | ||
| 599 | + style: TextStyle( | ||
| 600 | + color: | ||
| 601 | + MyColours.color_999999, | ||
| 602 | + fontSize: | ||
| 603 | + ScreenUtil().setSp(24)), | ||
| 604 | + )), | ||
| 605 | + canDo | ||
| 606 | + ? Row( | ||
| 607 | + mainAxisAlignment: | ||
| 608 | + MainAxisAlignment.spaceEvenly, | ||
| 609 | + children: [ | ||
| 610 | + Offstage( | ||
| 611 | + offstage: notebook.tid | ||
| 612 | + .split(",") | ||
| 613 | + .length < | ||
| 614 | + 2, | ||
| 615 | + child: Image.asset( | ||
| 616 | + Utils.getImgPath( | ||
| 617 | + 'ordered_lian'), | ||
| 618 | + width: ScreenUtil() | ||
| 619 | + .setWidth(18 * 2), | ||
| 620 | + ), | ||
| 630 | ), | 621 | ), |
| 631 | - ), | ||
| 632 | - false | ||
| 633 | - ? SizedBox() | ||
| 634 | - : HEmptyView(8), | ||
| 635 | - Offstage( | ||
| 636 | - offstage: | ||
| 637 | - notebook.aname == null, | ||
| 638 | - child: Image.asset( | ||
| 639 | - Utils.getImgPath( | ||
| 640 | - 'ordered_hui'), | ||
| 641 | - width: ScreenUtil() | ||
| 642 | - .setWidth(18 * 2), | 622 | + notebook.cusdem == null || |
| 623 | + notebook.cusdem == '' | ||
| 624 | + ? SizedBox() | ||
| 625 | + : HEmptyView(8), | ||
| 626 | + Offstage( | ||
| 627 | + offstage: | ||
| 628 | + notebook.cusdem == null || | ||
| 629 | + notebook.cusdem == '', | ||
| 630 | + child: Image.asset( | ||
| 631 | + Utils.getImgPath( | ||
| 632 | + 'ordered_bei'), | ||
| 633 | + width: ScreenUtil() | ||
| 634 | + .setWidth(18 * 2), | ||
| 635 | + ), | ||
| 643 | ), | 636 | ), |
| 644 | - ) | ||
| 645 | - ], | ||
| 646 | - ), | 637 | + notebook.aname == null |
| 638 | + ? SizedBox() | ||
| 639 | + : HEmptyView(8), | ||
| 640 | + Offstage( | ||
| 641 | + offstage: | ||
| 642 | + notebook.aname == null, | ||
| 643 | + child: Image.asset( | ||
| 644 | + Utils.getImgPath( | ||
| 645 | + 'ordered_hui'), | ||
| 646 | + width: ScreenUtil() | ||
| 647 | + .setWidth(18 * 2), | ||
| 648 | + ), | ||
| 649 | + ) | ||
| 650 | + ], | ||
| 651 | + ) | ||
| 652 | + : SizedBox(), | ||
| 647 | ], | 653 | ], |
| 648 | ) | 654 | ) |
| 649 | ], | 655 | ], |
| @@ -3,6 +3,7 @@ import 'package:dio/dio.dart'; | @@ -3,6 +3,7 @@ import 'package:dio/dio.dart'; | ||
| 3 | import 'package:flutter/material.dart'; | 3 | import 'package:flutter/material.dart'; |
| 4 | import 'package:flutter_easyrefresh/easy_refresh.dart'; | 4 | import 'package:flutter_easyrefresh/easy_refresh.dart'; |
| 5 | import 'package:flutter_screenutil/flutter_screenutil.dart'; | 5 | import 'package:flutter_screenutil/flutter_screenutil.dart'; |
| 6 | +import 'package:one_key/app.dart'; | ||
| 6 | import 'package:one_key/constant/state.dart'; | 7 | import 'package:one_key/constant/state.dart'; |
| 7 | import 'package:one_key/models/notebook.dart'; | 8 | import 'package:one_key/models/notebook.dart'; |
| 8 | import 'package:one_key/pages/notebook/notebook_item_f.dart'; | 9 | import 'package:one_key/pages/notebook/notebook_item_f.dart'; |
| @@ -68,6 +69,7 @@ class NoteBookPageState extends State<NoteBookPage> { | @@ -68,6 +69,7 @@ class NoteBookPageState extends State<NoteBookPage> { | ||
| 68 | void initState() { | 69 | void initState() { |
| 69 | // TODO: implement initState | 70 | // TODO: implement initState |
| 70 | super.initState(); | 71 | super.initState(); |
| 72 | + isSimple = App.sp.getBool("isSimple") ?? true; | ||
| 71 | tabIndex = widget.tabIndex; | 73 | tabIndex = widget.tabIndex; |
| 72 | LogUtil.v("notebook_page initState"); | 74 | LogUtil.v("notebook_page initState"); |
| 73 | 75 | ||
| @@ -521,6 +523,26 @@ class NoteBookPageState extends State<NoteBookPage> { | @@ -521,6 +523,26 @@ class NoteBookPageState extends State<NoteBookPage> { | ||
| 521 | } | 523 | } |
| 522 | } | 524 | } |
| 523 | 525 | ||
| 526 | + //获取全选按钮的状态 true or false | ||
| 527 | + getCheckValue() { | ||
| 528 | + bool temp = noteBookModel.notebooks.any((value) { | ||
| 529 | + return value.issimple == false; | ||
| 530 | + }); | ||
| 531 | + if (temp == true) { | ||
| 532 | + isSimple = false; | ||
| 533 | + } else { | ||
| 534 | + isSimple = true; | ||
| 535 | + } | ||
| 536 | + setState(() {}); | ||
| 537 | + App.sp.setBool("isSimple", isSimple); | ||
| 538 | + } | ||
| 539 | + | ||
| 540 | + ///单个item切换模式 | ||
| 541 | + _itemChangeSimple(Notebook notebook) { | ||
| 542 | + notebook.issimple = !notebook.issimple; | ||
| 543 | + getCheckValue(); | ||
| 544 | + } | ||
| 545 | + | ||
| 524 | @override | 546 | @override |
| 525 | Widget build(BuildContext context) { | 547 | Widget build(BuildContext context) { |
| 526 | // TODO: implement build | 548 | // TODO: implement build |
| @@ -570,8 +592,8 @@ class NoteBookPageState extends State<NoteBookPage> { | @@ -570,8 +592,8 @@ class NoteBookPageState extends State<NoteBookPage> { | ||
| 570 | dateText = '更多\n日期'; | 592 | dateText = '更多\n日期'; |
| 571 | }); | 593 | }); |
| 572 | 594 | ||
| 573 | - // _currTimeIndex(); | ||
| 574 | - // _getSellerTableClass(); | 595 | + _getReserveList(); |
| 596 | + _reserveCountDay(); | ||
| 575 | } | 597 | } |
| 576 | }, | 598 | }, |
| 577 | availableGestures: AvailableGestures.none, | 599 | availableGestures: AvailableGestures.none, |
| @@ -942,6 +964,7 @@ class NoteBookPageState extends State<NoteBookPage> { | @@ -942,6 +964,7 @@ class NoteBookPageState extends State<NoteBookPage> { | ||
| 942 | isSimple = !isSimple; | 964 | isSimple = !isSimple; |
| 943 | }); | 965 | }); |
| 944 | _simpleState(); | 966 | _simpleState(); |
| 967 | + App.sp.setBool("isSimple", isSimple); | ||
| 945 | }, | 968 | }, |
| 946 | child: Column( | 969 | child: Column( |
| 947 | children: [ | 970 | children: [ |
| @@ -991,9 +1014,15 @@ class NoteBookPageState extends State<NoteBookPage> { | @@ -991,9 +1014,15 @@ class NoteBookPageState extends State<NoteBookPage> { | ||
| 991 | bottom: ScreenUtil().setWidth(24)), | 1014 | bottom: ScreenUtil().setWidth(24)), |
| 992 | child: model.notebooks[index].issimple | 1015 | child: model.notebooks[index].issimple |
| 993 | ? NoteBookItemSimple( | 1016 | ? NoteBookItemSimple( |
| 994 | - model.notebooks[index], index) | 1017 | + model.notebooks[index], index, () { |
| 1018 | + _itemChangeSimple( | ||
| 1019 | + model.notebooks[index]); | ||
| 1020 | + }) | ||
| 995 | : NoteBookItemF( | 1021 | : NoteBookItemF( |
| 996 | - model.notebooks[index], index), | 1022 | + model.notebooks[index], index, () { |
| 1023 | + _itemChangeSimple( | ||
| 1024 | + model.notebooks[index]); | ||
| 1025 | + }), | ||
| 997 | ); | 1026 | ); |
| 998 | }, childCount: model.notebooks.length), | 1027 | }, childCount: model.notebooks.length), |
| 999 | // itemExtent: ScreenUtil().setWidth(112), | 1028 | // itemExtent: ScreenUtil().setWidth(112), |
| @@ -1009,173 +1038,5 @@ class NoteBookPageState extends State<NoteBookPage> { | @@ -1009,173 +1038,5 @@ class NoteBookPageState extends State<NoteBookPage> { | ||
| 1009 | ], | 1038 | ], |
| 1010 | )), | 1039 | )), |
| 1011 | ); | 1040 | ); |
| 1012 | - return Container( | ||
| 1013 | - width: double.infinity, | ||
| 1014 | - height: double.infinity, | ||
| 1015 | - color: MyColours.color_f5f5f5, | ||
| 1016 | - child: Column( | ||
| 1017 | - children: <Widget>[ | ||
| 1018 | - _buildTabbar(), | ||
| 1019 | - Container( | ||
| 1020 | - color: MyColours.color_ffffff, | ||
| 1021 | - width: double.infinity, | ||
| 1022 | - padding: EdgeInsets.only(bottom: ScreenUtil().setWidth(16)), | ||
| 1023 | - child: Row( | ||
| 1024 | - crossAxisAlignment: CrossAxisAlignment.center, | ||
| 1025 | - children: <Widget>[ | ||
| 1026 | - Expanded( | ||
| 1027 | - child: Center( | ||
| 1028 | - child: GestureDetector( | ||
| 1029 | - onTap: () { | ||
| 1030 | - DialogUtil.showCalendarDialog(context, dateTimeNow) | ||
| 1031 | - .then((day) { | ||
| 1032 | - if (day != null) { | ||
| 1033 | - _createDateText(day); | ||
| 1034 | - } | ||
| 1035 | - }); | ||
| 1036 | - }, | ||
| 1037 | - child: Container( | ||
| 1038 | - child: Text( | ||
| 1039 | - dateText, | ||
| 1040 | - style: TextStyle( | ||
| 1041 | - color: MyColours.color_199095, | ||
| 1042 | - fontSize: ScreenUtil().setSp(34)), | ||
| 1043 | - ), | ||
| 1044 | - ), | ||
| 1045 | - ), | ||
| 1046 | - ), | ||
| 1047 | - ), | ||
| 1048 | - MyDivider( | ||
| 1049 | - ScreenUtil().setWidth(2), | ||
| 1050 | - ScreenUtil().setHeight(68), | ||
| 1051 | - color: MyColours.color_E0E0E0, | ||
| 1052 | - ), | ||
| 1053 | - Expanded( | ||
| 1054 | - child: Padding( | ||
| 1055 | - padding: EdgeInsets.symmetric( | ||
| 1056 | - horizontal: ScreenUtil().setWidth(30)), | ||
| 1057 | - child: Row( | ||
| 1058 | - mainAxisAlignment: MainAxisAlignment.center, | ||
| 1059 | - crossAxisAlignment: CrossAxisAlignment.center, | ||
| 1060 | - children: <Widget>[ | ||
| 1061 | - Offstage( | ||
| 1062 | - offstage: morning == "00:00-00:00" ? true : false, | ||
| 1063 | - child: Padding( | ||
| 1064 | - padding: EdgeInsets.only( | ||
| 1065 | - right: ScreenUtil().setWidth(18)), | ||
| 1066 | - child: CommonButton( | ||
| 1067 | - content: "早市", | ||
| 1068 | - state: currTimeIndex == 1 ? 1 : 0, | ||
| 1069 | - width: 92, | ||
| 1070 | - height: 48, | ||
| 1071 | - fontSize: 32, | ||
| 1072 | - onPress: () { | ||
| 1073 | - if (currTimeIndex == 1) return; | ||
| 1074 | - setState(() { | ||
| 1075 | - currTimeIndex = 1; | ||
| 1076 | - }); | ||
| 1077 | - _getReserveList(); | ||
| 1078 | - }, | ||
| 1079 | - ))), | ||
| 1080 | - Offstage( | ||
| 1081 | - offstage: noon == "00:00-00:00" ? true : false, | ||
| 1082 | - child: Padding( | ||
| 1083 | - padding: EdgeInsets.only( | ||
| 1084 | - right: ScreenUtil().setWidth(18)), | ||
| 1085 | - child: CommonButton( | ||
| 1086 | - content: "午市", | ||
| 1087 | - state: currTimeIndex == 2 ? 1 : 0, | ||
| 1088 | - width: 92, | ||
| 1089 | - height: 48, | ||
| 1090 | - fontSize: 32, | ||
| 1091 | - onPress: () { | ||
| 1092 | - if (currTimeIndex == 2) return; | ||
| 1093 | - setState(() { | ||
| 1094 | - currTimeIndex = 2; | ||
| 1095 | - }); | ||
| 1096 | - _getReserveList(); | ||
| 1097 | - }, | ||
| 1098 | - ))), | ||
| 1099 | - Offstage( | ||
| 1100 | - offstage: night == "00:00-00:00" ? true : false, | ||
| 1101 | - child: Container( | ||
| 1102 | - // padding: EdgeInsets.symmetric( | ||
| 1103 | - // horizontal: ScreenUtil().setWidth(10)), | ||
| 1104 | - child: CommonButton( | ||
| 1105 | - content: "晚市", | ||
| 1106 | - state: currTimeIndex == 3 ? 1 : 0, | ||
| 1107 | - width: 92, | ||
| 1108 | - height: 48, | ||
| 1109 | - fontSize: 32, | ||
| 1110 | - onPress: () { | ||
| 1111 | - if (currTimeIndex == 3) return; | ||
| 1112 | - setState(() { | ||
| 1113 | - currTimeIndex = 3; | ||
| 1114 | - }); | ||
| 1115 | - _getReserveList(); | ||
| 1116 | - }, | ||
| 1117 | - )), | ||
| 1118 | - ), | ||
| 1119 | - ], | ||
| 1120 | - ), | ||
| 1121 | - ), | ||
| 1122 | - ) | ||
| 1123 | - ], | ||
| 1124 | - ), | ||
| 1125 | - ), | ||
| 1126 | - // Selector<NoteBookModel, String>( | ||
| 1127 | - // selector: (context, model) => model.total, | ||
| 1128 | - // builder: (context, total, child) { | ||
| 1129 | - // return Container( | ||
| 1130 | - // width: double.infinity, | ||
| 1131 | - // alignment: Alignment.centerLeft, | ||
| 1132 | - // padding: EdgeInsets.only(left: ScreenUtil().setWidth(38)), | ||
| 1133 | - // height: ScreenUtil().setHeight(72), | ||
| 1134 | - // color: MyColours.color_f5f5f5, | ||
| 1135 | - // child: Text( | ||
| 1136 | - // total, | ||
| 1137 | - // style: TextStyle( | ||
| 1138 | - // color: MyColours.color_353535, | ||
| 1139 | - // fontSize: ScreenUtil().setSp(26)), | ||
| 1140 | - // ), | ||
| 1141 | - // ); | ||
| 1142 | - // }, | ||
| 1143 | - // ), | ||
| 1144 | - _buildListTitle(), | ||
| 1145 | - Expanded(child: Consumer<NoteBookModel>( | ||
| 1146 | - builder: (context, model, _) { | ||
| 1147 | - if (model.pageState != PageState.Success) { | ||
| 1148 | - return ExceptionPage( | ||
| 1149 | - pageState: model.pageState, | ||
| 1150 | - callback: () { | ||
| 1151 | - _getReserveList(); | ||
| 1152 | - _reserveCountDay(); | ||
| 1153 | - }, | ||
| 1154 | - emptyMsg: "暂时没有预订哦", | ||
| 1155 | - emptyImg: "empty_search", | ||
| 1156 | - showMsg: "加载中,请稍后...", | ||
| 1157 | - ); | ||
| 1158 | - } else { | ||
| 1159 | - return EasyRefresh.custom( | ||
| 1160 | - controller: _controller, | ||
| 1161 | - slivers: [ | ||
| 1162 | - SliverList( | ||
| 1163 | - delegate: SliverChildBuilderDelegate( | ||
| 1164 | - (BuildContext context, int index) { | ||
| 1165 | - return NoteBookItem(model.notebooks[index], index); | ||
| 1166 | - }, childCount: model.notebooks.length), | ||
| 1167 | - // itemExtent: ScreenUtil().setWidth(112), | ||
| 1168 | - ) | ||
| 1169 | - ], | ||
| 1170 | - onRefresh: () async { | ||
| 1171 | - _getReserveList(); | ||
| 1172 | - }, | ||
| 1173 | - ); | ||
| 1174 | - } | ||
| 1175 | - }, | ||
| 1176 | - )) | ||
| 1177 | - ], | ||
| 1178 | - ), | ||
| 1179 | - ); | ||
| 1180 | } | 1041 | } |
| 1181 | } | 1042 | } |
-
Please register or login to post a comment