Showing
5 changed files
with
951 additions
and
31 deletions
assets/ordered_bei.png
0 → 100755
1.42 KB
assets/ordered_hui.png
0 → 100755
1.62 KB
assets/ordered_lian.png
0 → 100755
1.48 KB
| @@ -16,9 +16,12 @@ import 'package:one_key/utils/utils.dart'; | @@ -16,9 +16,12 @@ import 'package:one_key/utils/utils.dart'; | ||
| 16 | import 'package:one_key/widgets/MyDivider.dart'; | 16 | import 'package:one_key/widgets/MyDivider.dart'; |
| 17 | import 'package:one_key/widgets/app_bar.dart'; | 17 | import 'package:one_key/widgets/app_bar.dart'; |
| 18 | import 'package:one_key/widgets/common_button.dart'; | 18 | import 'package:one_key/widgets/common_button.dart'; |
| 19 | +import 'package:one_key/widgets/h_empty_view.dart'; | ||
| 19 | import 'package:one_key/widgets/page_error.dart'; | 20 | import 'package:one_key/widgets/page_error.dart'; |
| 20 | import 'package:one_key/widgets/page_exception.dart'; | 21 | import 'package:one_key/widgets/page_exception.dart'; |
| 22 | +import 'package:one_key/widgets/round_button.dart'; | ||
| 21 | import 'package:provider/provider.dart'; | 23 | import 'package:provider/provider.dart'; |
| 24 | +import 'package:table_calendar/table_calendar.dart'; | ||
| 22 | 25 | ||
| 23 | class NoteBookPage extends StatefulWidget { | 26 | class NoteBookPage extends StatefulWidget { |
| 24 | final int tabIndex; | 27 | final int tabIndex; |
| @@ -38,7 +41,7 @@ class NoteBookPage extends StatefulWidget { | @@ -38,7 +41,7 @@ class NoteBookPage extends StatefulWidget { | ||
| 38 | class NoteBookPageState extends State<NoteBookPage> { | 41 | class NoteBookPageState extends State<NoteBookPage> { |
| 39 | EasyRefreshController _controller; | 42 | EasyRefreshController _controller; |
| 40 | 43 | ||
| 41 | - String dateText = ""; //当前显示日期时间 | 44 | + String dateText = "更多\n日期"; //当前显示日期时间 |
| 42 | int currTimeIndex = 1; //当前选中时间段 | 45 | int currTimeIndex = 1; //当前选中时间段 |
| 43 | String morning; //早市时间段 | 46 | String morning; //早市时间段 |
| 44 | String noon; //午市时间段 | 47 | String noon; //午市时间段 |
| @@ -49,6 +52,9 @@ class NoteBookPageState extends State<NoteBookPage> { | @@ -49,6 +52,9 @@ class NoteBookPageState extends State<NoteBookPage> { | ||
| 49 | UserModel userModel; | 52 | UserModel userModel; |
| 50 | 53 | ||
| 51 | int tabIndex = 0; //当前选中的tab 标签 | 54 | int tabIndex = 0; //当前选中的tab 标签 |
| 55 | + CalendarController _calendarController = CalendarController(); | ||
| 56 | + StartingDayOfWeek startingDayOfWeek; | ||
| 57 | + bool clearSel = false; | ||
| 52 | 58 | ||
| 53 | @override | 59 | @override |
| 54 | void initState() { | 60 | void initState() { |
| @@ -62,7 +68,8 @@ class NoteBookPageState extends State<NoteBookPage> { | @@ -62,7 +68,8 @@ class NoteBookPageState extends State<NoteBookPage> { | ||
| 62 | bus.on("refresh_book_list", (args) { | 68 | bus.on("refresh_book_list", (args) { |
| 63 | _getReserveList(); | 69 | _getReserveList(); |
| 64 | }); | 70 | }); |
| 65 | - | 71 | + startingDayOfWeek = _initStartingDayOfWeek(); |
| 72 | + dateTimeNow = DateTime.now(); | ||
| 66 | WidgetsBinding.instance.addPostFrameCallback((_) { | 73 | WidgetsBinding.instance.addPostFrameCallback((_) { |
| 67 | _initTime(); | 74 | _initTime(); |
| 68 | setState(() {}); | 75 | setState(() {}); |
| @@ -71,31 +78,54 @@ class NoteBookPageState extends State<NoteBookPage> { | @@ -71,31 +78,54 @@ class NoteBookPageState extends State<NoteBookPage> { | ||
| 71 | }); | 78 | }); |
| 72 | } | 79 | } |
| 73 | 80 | ||
| 81 | + /// 第一个显示今天 | ||
| 82 | + _initStartingDayOfWeek() { | ||
| 83 | + switch (DateTime.now().weekday.toString()) { | ||
| 84 | + case "1": | ||
| 85 | + return StartingDayOfWeek.monday; | ||
| 86 | + case "2": | ||
| 87 | + return StartingDayOfWeek.tuesday; | ||
| 88 | + case "3": | ||
| 89 | + return StartingDayOfWeek.wednesday; | ||
| 90 | + case "4": | ||
| 91 | + return StartingDayOfWeek.thursday; | ||
| 92 | + case "5": | ||
| 93 | + return StartingDayOfWeek.friday; | ||
| 94 | + case "6": | ||
| 95 | + return StartingDayOfWeek.saturday; | ||
| 96 | + case "7": | ||
| 97 | + return StartingDayOfWeek.sunday; | ||
| 98 | + default: | ||
| 99 | + return StartingDayOfWeek.sunday; | ||
| 100 | + } | ||
| 101 | + } | ||
| 102 | + | ||
| 74 | @override | 103 | @override |
| 75 | void dispose() { | 104 | void dispose() { |
| 76 | super.dispose(); | 105 | super.dispose(); |
| 77 | bus.off("refresh_book_list"); | 106 | bus.off("refresh_book_list"); |
| 107 | + _calendarController.dispose(); | ||
| 78 | } | 108 | } |
| 79 | 109 | ||
| 80 | //初始化时间 | 110 | //初始化时间 |
| 81 | _initTime() { | 111 | _initTime() { |
| 82 | dateTimeNow = widget.date != null ? widget.date : DateTime.now(); | 112 | dateTimeNow = widget.date != null ? widget.date : DateTime.now(); |
| 83 | - dateText = "${dateTimeNow.year}年 " + | ||
| 84 | - Utils.addZeroNumber(dateTimeNow.month) + | ||
| 85 | - "月" + | ||
| 86 | - Utils.addZeroNumber(dateTimeNow.day) + | ||
| 87 | - "日"; | ||
| 88 | - DateTime dateNow = DateTime.now(); | 113 | + // dateText = "${dateTimeNow.year}年 " + |
| 114 | + // Utils.addZeroNumber(dateTimeNow.month) + | ||
| 115 | + // "月" + | ||
| 116 | + // Utils.addZeroNumber(dateTimeNow.day) + | ||
| 117 | + // "日"; | ||
| 118 | + // DateTime dateNow = DateTime.now(); | ||
| 89 | 119 | ||
| 90 | - if (Utils.isOneDay(dateTimeNow, dateNow)) { | ||
| 91 | - dateText += " 今天"; | ||
| 92 | - } else if (Utils.isOneDay(dateTimeNow, dateNow.add(Duration(days: 1)))) { | ||
| 93 | - dateText += " 明天"; | ||
| 94 | - } else if (Utils.isOneDay(dateTimeNow, dateNow.add(Duration(days: 2)))) { | ||
| 95 | - dateText += " 后天"; | ||
| 96 | - } else { | ||
| 97 | - dateText += " 周${Utils.formatWeekDayNum(dateTimeNow.weekday)}"; | ||
| 98 | - } | 120 | + // if (Utils.isOneDay(dateTimeNow, dateNow)) { |
| 121 | + // dateText += " 今天"; | ||
| 122 | + // } else if (Utils.isOneDay(dateTimeNow, dateNow.add(Duration(days: 1)))) { | ||
| 123 | + // dateText += " 明天"; | ||
| 124 | + // } else if (Utils.isOneDay(dateTimeNow, dateNow.add(Duration(days: 2)))) { | ||
| 125 | + // dateText += " 后天"; | ||
| 126 | + // } else { | ||
| 127 | + // dateText += " 周${Utils.formatWeekDayNum(dateTimeNow.weekday)}"; | ||
| 128 | + // } | ||
| 99 | 129 | ||
| 100 | morning = | 130 | morning = |
| 101 | userModel.user.morning.isEmpty ? "00:00-00:00" : userModel.user.morning; | 131 | userModel.user.morning.isEmpty ? "00:00-00:00" : userModel.user.morning; |
| @@ -179,6 +209,20 @@ class NoteBookPageState extends State<NoteBookPage> { | @@ -179,6 +209,20 @@ class NoteBookPageState extends State<NoteBookPage> { | ||
| 179 | model.getReserveList(context, params); | 209 | model.getReserveList(context, params); |
| 180 | } | 210 | } |
| 181 | 211 | ||
| 212 | + //解析返回显示的日期 | ||
| 213 | + _parseDateDay(DateTime dateTime) { | ||
| 214 | + DateTime now = DateTime.now(); | ||
| 215 | + if (Utils.isOneDay(dateTime, now)) { | ||
| 216 | + return "今"; | ||
| 217 | + } else if (Utils.isOneDay(dateTime, now.add(Duration(days: 1)))) { | ||
| 218 | + return "明"; | ||
| 219 | + } else if (Utils.isOneDay(dateTime, now.add(Duration(days: 2)))) { | ||
| 220 | + return "后"; | ||
| 221 | + } else { | ||
| 222 | + return dateTime.day.toString(); | ||
| 223 | + } | ||
| 224 | + } | ||
| 225 | + | ||
| 182 | //获取一天开始-结束时间字符串 | 226 | //获取一天开始-结束时间字符串 |
| 183 | String _getRdate() { | 227 | String _getRdate() { |
| 184 | //一天开始时间 | 228 | //一天开始时间 |
| @@ -293,22 +337,34 @@ class NoteBookPageState extends State<NoteBookPage> { | @@ -293,22 +337,34 @@ class NoteBookPageState extends State<NoteBookPage> { | ||
| 293 | _createDateText(DateTime day) { | 337 | _createDateText(DateTime day) { |
| 294 | if (Utils.isOneDay(day, dateTimeNow)) return; //日期没变 | 338 | if (Utils.isOneDay(day, dateTimeNow)) return; //日期没变 |
| 295 | setState(() { | 339 | setState(() { |
| 296 | - DateTime dateNow = DateTime.now(); | ||
| 297 | - dateText = "${day.year}年 " + | ||
| 298 | - Utils.addZeroNumber(day.month) + | ||
| 299 | - "月" + | ||
| 300 | - Utils.addZeroNumber(day.day) + | ||
| 301 | - "日"; | ||
| 302 | - if (Utils.isOneDay(day, dateNow)) { | ||
| 303 | - dateText += " 今天"; | ||
| 304 | - } else if (Utils.isOneDay(day, dateNow.add(Duration(days: 1)))) { | ||
| 305 | - dateText += " 明天"; | ||
| 306 | - } else if (Utils.isOneDay(day, dateNow.add(Duration(days: 2)))) { | ||
| 307 | - dateText += " 后天"; | 340 | + // DateTime dateNow = DateTime.now(); |
| 341 | + // dateText = "${day.year}年 " + | ||
| 342 | + // Utils.addZeroNumber(day.month) + | ||
| 343 | + // "月" + | ||
| 344 | + // Utils.addZeroNumber(day.day) + | ||
| 345 | + // "日"; | ||
| 346 | + // if (Utils.isOneDay(day, dateNow)) { | ||
| 347 | + // dateText += " 今天"; | ||
| 348 | + // } else if (Utils.isOneDay(day, dateNow.add(Duration(days: 1)))) { | ||
| 349 | + // dateText += " 明天"; | ||
| 350 | + // } else if (Utils.isOneDay(day, dateNow.add(Duration(days: 2)))) { | ||
| 351 | + // dateText += " 后天"; | ||
| 352 | + // } else { | ||
| 353 | + // dateText += " 周${Utils.formatWeekDayNum(day.weekday)}"; | ||
| 354 | + // } | ||
| 355 | + | ||
| 356 | + dateTimeNow = day; | ||
| 357 | + Duration days = day.difference(DateTime.now()); | ||
| 358 | + print(days); | ||
| 359 | + if ((days.inDays == 0 && days.inHours >= 0) || | ||
| 360 | + (days.inDays > 0 && days.inDays < 7)) { | ||
| 361 | + _calendarController.setSelectedDay(day); | ||
| 362 | + dateText = '更多\n日期'; | ||
| 363 | + clearSel = false; | ||
| 308 | } else { | 364 | } else { |
| 309 | - dateText += " 周${Utils.formatWeekDayNum(day.weekday)}"; | 365 | + clearSel = true; |
| 366 | + dateText = '${day.month}月\n${day.day}日'; | ||
| 310 | } | 367 | } |
| 311 | - dateTimeNow = day; | ||
| 312 | }); | 368 | }); |
| 313 | _getReserveList(); | 369 | _getReserveList(); |
| 314 | _reserveCountDay(); | 370 | _reserveCountDay(); |
| @@ -447,6 +503,251 @@ class NoteBookPageState extends State<NoteBookPage> { | @@ -447,6 +503,251 @@ class NoteBookPageState extends State<NoteBookPage> { | ||
| 447 | Widget build(BuildContext context) { | 503 | Widget build(BuildContext context) { |
| 448 | // TODO: implement build | 504 | // TODO: implement build |
| 449 | userModel = Provider.of<UserModel>(context, listen: false); | 505 | userModel = Provider.of<UserModel>(context, listen: false); |
| 506 | + return Scaffold( | ||
| 507 | + body: Container( | ||
| 508 | + color: MyColours.color_ffffff, | ||
| 509 | + padding: EdgeInsets.symmetric( | ||
| 510 | + horizontal: ScreenUtil().setWidth(24), | ||
| 511 | + vertical: ScreenUtil().setWidth(32)), | ||
| 512 | + child: Column( | ||
| 513 | + children: [ | ||
| 514 | + Container( | ||
| 515 | + color: MyColours.color_ffffff, | ||
| 516 | + child: Row( | ||
| 517 | + children: [ | ||
| 518 | + Expanded( | ||
| 519 | + child: TableCalendar( | ||
| 520 | + rowHeight: ScreenUtil().setWidth(38 * 2), | ||
| 521 | + calendarController: _calendarController, | ||
| 522 | + initialSelectedDay: dateTimeNow, | ||
| 523 | + headerVisible: false, | ||
| 524 | + startingDayOfWeek: startingDayOfWeek, | ||
| 525 | + startDay: DateTime.now(), | ||
| 526 | + // endDay: DateTime.now().add(Duration(days: 5)), | ||
| 527 | + onDaySelected: (day, _, holidays) { | ||
| 528 | + if (!Utils.isOneDay(day, dateTimeNow)) { | ||
| 529 | + //不是一天 | ||
| 530 | + dateTimeNow = day; | ||
| 531 | + clearSel = false; | ||
| 532 | + setState(() { | ||
| 533 | + dateText = '更多\n日期'; | ||
| 534 | + }); | ||
| 535 | + | ||
| 536 | + // _currTimeIndex(); | ||
| 537 | + // _getSellerTableClass(); | ||
| 538 | + } | ||
| 539 | + }, | ||
| 540 | + availableGestures: AvailableGestures.none, | ||
| 541 | + locale: "zh_CN", | ||
| 542 | + initialCalendarFormat: CalendarFormat.week, | ||
| 543 | + calendarStyle: CalendarStyle( | ||
| 544 | + weekdayStyle: TextStyle( | ||
| 545 | + color: MyColours.color_515151, | ||
| 546 | + fontWeight: FontWeight.bold, | ||
| 547 | + fontSize: ScreenUtil().setSp(28)), | ||
| 548 | + weekendStyle: TextStyle( | ||
| 549 | + color: MyColours.color_BFC4D4, | ||
| 550 | + fontSize: ScreenUtil().setSp(28)), | ||
| 551 | + selectedColor: MyColours.color_438E93, | ||
| 552 | + ), | ||
| 553 | + headerStyle: HeaderStyle( | ||
| 554 | + decoration: BoxDecoration( | ||
| 555 | + color: MyColours.color_ffffff), | ||
| 556 | + headerPadding: EdgeInsets.zero, | ||
| 557 | + formatButtonVisible: false, | ||
| 558 | + centerHeaderTitle: false, | ||
| 559 | + titleTextBuilder: (dateTime, _) { | ||
| 560 | + return ''; | ||
| 561 | + }, | ||
| 562 | + // titleTextStyle: TextStyle( | ||
| 563 | + // color: MyColours.font_color_333333, | ||
| 564 | + // fontSize: ScreenUtil().setSp(32)), | ||
| 565 | + // leftChevronIcon: Image( | ||
| 566 | + // image: AssetImage( | ||
| 567 | + // Utils.getImgPath('left_arrow')), | ||
| 568 | + // alignment: Alignment.center, | ||
| 569 | + // ), | ||
| 570 | + // rightChevronIcon: const Icon( | ||
| 571 | + // Icons.keyboard_arrow_right, | ||
| 572 | + // color: MyColours.font_color_333333), | ||
| 573 | + ), | ||
| 574 | + builders: CalendarBuilders( | ||
| 575 | + dayBuilder: (context, dateTime, events) { | ||
| 576 | + return Container( | ||
| 577 | + decoration: BoxDecoration( | ||
| 578 | + shape: BoxShape.circle, | ||
| 579 | + ), | ||
| 580 | + alignment: Alignment.center, | ||
| 581 | + padding: EdgeInsets.zero, | ||
| 582 | + margin: EdgeInsets.all( | ||
| 583 | + ScreenUtil().setWidth(8)), | ||
| 584 | + child: Text( | ||
| 585 | + dateTime.day.toString(), | ||
| 586 | + style: TextStyle().copyWith( | ||
| 587 | + fontSize: ScreenUtil().setSp(28), | ||
| 588 | + color: MyColours.color_515151, | ||
| 589 | + fontWeight: FontWeight.bold), | ||
| 590 | + ), | ||
| 591 | + ); | ||
| 592 | + }, | ||
| 593 | + unavailableDayBuilder: | ||
| 594 | + (context, dateTime, events) { | ||
| 595 | + return Container( | ||
| 596 | + decoration: BoxDecoration( | ||
| 597 | + shape: BoxShape.circle, | ||
| 598 | + ), | ||
| 599 | + alignment: Alignment.center, | ||
| 600 | + margin: EdgeInsets.all( | ||
| 601 | + ScreenUtil().setWidth(8)), | ||
| 602 | + padding: EdgeInsets.all( | ||
| 603 | + ScreenUtil().setWidth(4), | ||
| 604 | + ), | ||
| 605 | + child: Text( | ||
| 606 | + dateTime.day.toString(), | ||
| 607 | + style: TextStyle().copyWith( | ||
| 608 | + fontSize: ScreenUtil().setSp(28), | ||
| 609 | + color: MyColours.color_999999), | ||
| 610 | + ), | ||
| 611 | + ); | ||
| 612 | + }, | ||
| 613 | + dowWeekdayBuilder: (context, weekday) { | ||
| 614 | + return Container( | ||
| 615 | + color: MyColours.color_ffffff, | ||
| 616 | + alignment: Alignment.center, | ||
| 617 | + padding: EdgeInsets.symmetric( | ||
| 618 | + vertical: ScreenUtil().setWidth(16)), | ||
| 619 | + child: Text( | ||
| 620 | + "周${Utils.formatWeekDayNum(DateTime.now().weekday)}" == | ||
| 621 | + weekday | ||
| 622 | + ? '今日' | ||
| 623 | + : weekday.replaceAll('周', ''), | ||
| 624 | + style: TextStyle( | ||
| 625 | + color: | ||
| 626 | + "周${Utils.formatWeekDayNum(dateTimeNow.weekday)}" == | ||
| 627 | + weekday && | ||
| 628 | + !clearSel | ||
| 629 | + ? MyColours.color_438E93 | ||
| 630 | + : MyColours.color_BFC4D4, | ||
| 631 | + fontSize: ScreenUtil().setSp(28)), | ||
| 632 | + ), | ||
| 633 | + ); | ||
| 634 | + }, | ||
| 635 | + | ||
| 636 | + selectedDayBuilder: (context, date, _) { | ||
| 637 | + return clearSel | ||
| 638 | + ? Container( | ||
| 639 | + decoration: BoxDecoration( | ||
| 640 | + shape: BoxShape.circle, | ||
| 641 | + ), | ||
| 642 | + alignment: Alignment.center, | ||
| 643 | + padding: EdgeInsets.zero, | ||
| 644 | + margin: EdgeInsets.all( | ||
| 645 | + ScreenUtil().setWidth(8)), | ||
| 646 | + child: Text( | ||
| 647 | + date.day.toString(), | ||
| 648 | + style: TextStyle().copyWith( | ||
| 649 | + fontSize: | ||
| 650 | + ScreenUtil().setSp(28), | ||
| 651 | + color: MyColours.color_515151, | ||
| 652 | + fontWeight: FontWeight.bold), | ||
| 653 | + ), | ||
| 654 | + ) | ||
| 655 | + : Container( | ||
| 656 | + decoration: BoxDecoration( | ||
| 657 | + shape: BoxShape.circle, | ||
| 658 | + gradient: LinearGradient( | ||
| 659 | + colors: [ | ||
| 660 | + MyColours.color_438E93, | ||
| 661 | + MyColours.color_438E93 | ||
| 662 | + ], | ||
| 663 | + begin: Alignment.topCenter, | ||
| 664 | + end: Alignment.bottomCenter), | ||
| 665 | +// border: Border.all(color: MyColours.color_FFB116) | ||
| 666 | + ), | ||
| 667 | + alignment: Alignment.center, | ||
| 668 | + margin: EdgeInsets.all( | ||
| 669 | + ScreenUtil().setWidth(8)), | ||
| 670 | + padding: EdgeInsets.all( | ||
| 671 | + ScreenUtil().setWidth(4), | ||
| 672 | + ), | ||
| 673 | + child: Text( | ||
| 674 | + date.day.toString(), | ||
| 675 | + style: TextStyle().copyWith( | ||
| 676 | + fontSize: | ||
| 677 | + ScreenUtil().setSp(28), | ||
| 678 | + color: MyColours.color_ffffff, | ||
| 679 | + fontWeight: FontWeight.bold), | ||
| 680 | + ), | ||
| 681 | + ); | ||
| 682 | + }, | ||
| 683 | + // todayDayBuilder: (context, date, _) { | ||
| 684 | + // return Container( | ||
| 685 | + // decoration: BoxDecoration( | ||
| 686 | + // shape: BoxShape.circle, | ||
| 687 | + // border: Border.all( | ||
| 688 | + // color: MyColours.color_24A4A8, width: 1)), | ||
| 689 | + // alignment: Alignment.center, | ||
| 690 | + // margin: const EdgeInsets.all(6.0), | ||
| 691 | + // padding: const EdgeInsets.only( | ||
| 692 | + // bottom: 4.0, left: 8.0, right: 8.0, top: 4.0), | ||
| 693 | + // child: Text( | ||
| 694 | + // '今', | ||
| 695 | + // style: TextStyle().copyWith( | ||
| 696 | + // fontSize: ScreenUtil().setSp(32), | ||
| 697 | + // color: MyColours.color_438E93, | ||
| 698 | + // fontWeight: FontWeight.bold), | ||
| 699 | + // ), | ||
| 700 | + // ); | ||
| 701 | + // }, | ||
| 702 | + singleMarkerBuilder: | ||
| 703 | + (context, dateTime, event) { | ||
| 704 | + return Container( | ||
| 705 | + width: ScreenUtil().setWidth(6), | ||
| 706 | + height: ScreenUtil().setWidth(6), | ||
| 707 | + margin: const EdgeInsets.symmetric( | ||
| 708 | + horizontal: 0.3), | ||
| 709 | + decoration: BoxDecoration( | ||
| 710 | + shape: BoxShape.circle, | ||
| 711 | + color: MyColours.color_ff0000, | ||
| 712 | + ), | ||
| 713 | + ); | ||
| 714 | + }, | ||
| 715 | + ))), | ||
| 716 | + InkWell( | ||
| 717 | + onTap: () { | ||
| 718 | + DialogUtil.showCalendarDialog(context, dateTimeNow) | ||
| 719 | + .then((day) { | ||
| 720 | + if (day != null) { | ||
| 721 | + _createDateText(day); | ||
| 722 | + } | ||
| 723 | + }); | ||
| 724 | + }, | ||
| 725 | + child: Container( | ||
| 726 | + alignment: Alignment.center, | ||
| 727 | + width: ScreenUtil().setWidth(42 * 2), | ||
| 728 | + height: ScreenUtil().setWidth(42 * 2), | ||
| 729 | + decoration: BoxDecoration( | ||
| 730 | + color: MyColours.color_438E93, | ||
| 731 | + borderRadius: BorderRadius.circular( | ||
| 732 | + ScreenUtil().setWidth(10))), | ||
| 733 | + child: Text( | ||
| 734 | + dateText, | ||
| 735 | + style: TextStyle( | ||
| 736 | + fontWeight: FontWeight.bold, | ||
| 737 | + color: MyColours.color_ffffff, | ||
| 738 | + fontSize: ScreenUtil().setSp(24), | ||
| 739 | + ), | ||
| 740 | + strutStyle: StrutStyle( | ||
| 741 | + forceStrutHeight: true, | ||
| 742 | + height: 1, | ||
| 743 | + leading: 0.1), | ||
| 744 | + ), | ||
| 745 | + )), | ||
| 746 | + ], | ||
| 747 | + )), | ||
| 748 | + ], | ||
| 749 | + )), | ||
| 750 | + ); | ||
| 450 | return Container( | 751 | return Container( |
| 451 | width: double.infinity, | 752 | width: double.infinity, |
| 452 | height: double.infinity, | 753 | height: double.infinity, |
lib/pages/notebook/notebook_page_old.dart
0 → 100644
| 1 | +// import 'package:common_utils/common_utils.dart'; | ||
| 2 | +// import 'package:dio/dio.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/pages/notebook/notebook_item_widget.dart'; | ||
| 8 | +// import 'package:one_key/provider/notebook_model.dart'; | ||
| 9 | +// import 'package:one_key/provider/update_model.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/dialog_util.dart'; | ||
| 14 | +// import 'package:one_key/utils/event_bus.dart'; | ||
| 15 | +// import 'package:one_key/utils/utils.dart'; | ||
| 16 | +// import 'package:one_key/widgets/MyDivider.dart'; | ||
| 17 | +// import 'package:one_key/widgets/app_bar.dart'; | ||
| 18 | +// import 'package:one_key/widgets/common_button.dart'; | ||
| 19 | +// import 'package:one_key/widgets/page_error.dart'; | ||
| 20 | +// import 'package:one_key/widgets/page_exception.dart'; | ||
| 21 | +// import 'package:provider/provider.dart'; | ||
| 22 | + | ||
| 23 | +// class NoteBookPage extends StatefulWidget { | ||
| 24 | +// final int tabIndex; | ||
| 25 | + | ||
| 26 | +// final DateTime date; | ||
| 27 | +// final String solt; | ||
| 28 | + | ||
| 29 | +// const NoteBookPage({Key key, this.tabIndex = 0, this.date, this.solt}) | ||
| 30 | +// : super(key: key); | ||
| 31 | +// @override | ||
| 32 | +// State<StatefulWidget> createState() { | ||
| 33 | +// // TODO: implement createState | ||
| 34 | +// return new NoteBookPageState(); | ||
| 35 | +// } | ||
| 36 | +// } | ||
| 37 | + | ||
| 38 | +// class NoteBookPageState extends State<NoteBookPage> { | ||
| 39 | +// EasyRefreshController _controller; | ||
| 40 | + | ||
| 41 | +// String dateText = ""; //当前显示日期时间 | ||
| 42 | +// int currTimeIndex = 1; //当前选中时间段 | ||
| 43 | +// String morning; //早市时间段 | ||
| 44 | +// String noon; //午市时间段 | ||
| 45 | +// String night; //晚市时间段 | ||
| 46 | + | ||
| 47 | +// DateTime dateTimeNow; //当前日期 | ||
| 48 | + | ||
| 49 | +// UserModel userModel; | ||
| 50 | + | ||
| 51 | +// int tabIndex = 0; //当前选中的tab 标签 | ||
| 52 | + | ||
| 53 | +// @override | ||
| 54 | +// void initState() { | ||
| 55 | +// // TODO: implement initState | ||
| 56 | +// super.initState(); | ||
| 57 | +// tabIndex = widget.tabIndex; | ||
| 58 | +// LogUtil.v("notebook_page initState"); | ||
| 59 | + | ||
| 60 | +// _controller = EasyRefreshController(); | ||
| 61 | +// // _initTime(); | ||
| 62 | +// bus.on("refresh_book_list", (args) { | ||
| 63 | +// _getReserveList(); | ||
| 64 | +// }); | ||
| 65 | + | ||
| 66 | +// WidgetsBinding.instance.addPostFrameCallback((_) { | ||
| 67 | +// _initTime(); | ||
| 68 | +// setState(() {}); | ||
| 69 | +// _getReserveList(); | ||
| 70 | +// _reserveCountDay(); | ||
| 71 | +// }); | ||
| 72 | +// } | ||
| 73 | + | ||
| 74 | +// @override | ||
| 75 | +// void dispose() { | ||
| 76 | +// super.dispose(); | ||
| 77 | +// bus.off("refresh_book_list"); | ||
| 78 | +// } | ||
| 79 | + | ||
| 80 | +// //初始化时间 | ||
| 81 | +// _initTime() { | ||
| 82 | +// dateTimeNow = widget.date != null ? widget.date : DateTime.now(); | ||
| 83 | +// dateText = "${dateTimeNow.year}年 " + | ||
| 84 | +// Utils.addZeroNumber(dateTimeNow.month) + | ||
| 85 | +// "月" + | ||
| 86 | +// Utils.addZeroNumber(dateTimeNow.day) + | ||
| 87 | +// "日"; | ||
| 88 | +// DateTime dateNow = DateTime.now(); | ||
| 89 | + | ||
| 90 | +// if (Utils.isOneDay(dateTimeNow, dateNow)) { | ||
| 91 | +// dateText += " 今天"; | ||
| 92 | +// } else if (Utils.isOneDay(dateTimeNow, dateNow.add(Duration(days: 1)))) { | ||
| 93 | +// dateText += " 明天"; | ||
| 94 | +// } else if (Utils.isOneDay(dateTimeNow, dateNow.add(Duration(days: 2)))) { | ||
| 95 | +// dateText += " 后天"; | ||
| 96 | +// } else { | ||
| 97 | +// dateText += " 周${Utils.formatWeekDayNum(dateTimeNow.weekday)}"; | ||
| 98 | +// } | ||
| 99 | + | ||
| 100 | +// morning = | ||
| 101 | +// userModel.user.morning.isEmpty ? "00:00-00:00" : userModel.user.morning; | ||
| 102 | +// noon = userModel.user.noon.isEmpty ? "00:00-00:00" : userModel.user.noon; | ||
| 103 | +// night = userModel.user.night.isEmpty ? "00:00-00:00" : userModel.user.night; | ||
| 104 | +// if (widget.solt == null || widget.solt == "null") { | ||
| 105 | +// if (morning != '' && | ||
| 106 | +// dateTimeNow.isBefore(DateTime.parse(dateTimeNow.year.toString() + | ||
| 107 | +// "-" + | ||
| 108 | +// Utils.addZeroNumber(dateTimeNow.month) + | ||
| 109 | +// "-" + | ||
| 110 | +// Utils.addZeroNumber(dateTimeNow.day) + | ||
| 111 | +// " " + | ||
| 112 | +// morning.split("-")[1] + | ||
| 113 | +// ":00"))) { | ||
| 114 | +// //未过早市 | ||
| 115 | +// currTimeIndex = 1; | ||
| 116 | +// } else if (noon != '' && | ||
| 117 | +// dateTimeNow.isAfter(DateTime.parse(dateTimeNow.year.toString() + | ||
| 118 | +// "-" + | ||
| 119 | +// Utils.addZeroNumber(dateTimeNow.month) + | ||
| 120 | +// "-" + | ||
| 121 | +// Utils.addZeroNumber(dateTimeNow.day) + | ||
| 122 | +// " " + | ||
| 123 | +// morning.split("-")[1] + | ||
| 124 | +// ":00")) && | ||
| 125 | +// dateTimeNow.isBefore(DateTime.parse(dateTimeNow.year.toString() + | ||
| 126 | +// "-" + | ||
| 127 | +// Utils.addZeroNumber(dateTimeNow.month) + | ||
| 128 | +// "-" + | ||
| 129 | +// Utils.addZeroNumber(dateTimeNow.day) + | ||
| 130 | +// " " + | ||
| 131 | +// noon.split("-")[1] + | ||
| 132 | +// ":00"))) { | ||
| 133 | +// //过了早市,未过午市 | ||
| 134 | +// currTimeIndex = 2; | ||
| 135 | +// } else if (night != '' && | ||
| 136 | +// dateTimeNow.isAfter(DateTime.parse(dateTimeNow.year.toString() + | ||
| 137 | +// "-" + | ||
| 138 | +// Utils.addZeroNumber(dateTimeNow.month) + | ||
| 139 | +// "-" + | ||
| 140 | +// Utils.addZeroNumber(dateTimeNow.day) + | ||
| 141 | +// " " + | ||
| 142 | +// noon.split("-")[1] + | ||
| 143 | +// ":00")) && | ||
| 144 | +// dateTimeNow.isBefore(DateTime.parse(dateTimeNow.year.toString() + | ||
| 145 | +// "-" + | ||
| 146 | +// Utils.addZeroNumber(dateTimeNow.month) + | ||
| 147 | +// "-" + | ||
| 148 | +// Utils.addZeroNumber(dateTimeNow.day) + | ||
| 149 | +// " " + | ||
| 150 | +// night.split("-")[1] + | ||
| 151 | +// ":00"))) { | ||
| 152 | +// //过了午市,未过晚市 | ||
| 153 | +// currTimeIndex = 3; | ||
| 154 | +// } else { | ||
| 155 | +// //过了晚市 | ||
| 156 | +// currTimeIndex = 3; | ||
| 157 | +// } | ||
| 158 | +// } else { | ||
| 159 | +// currTimeIndex = int.parse(widget.solt); | ||
| 160 | +// } | ||
| 161 | +// } | ||
| 162 | + | ||
| 163 | +// //获取已预订列表 | ||
| 164 | +// _getReserveList() { | ||
| 165 | +// NoteBookModel model = Provider.of<NoteBookModel>(context, listen: false); | ||
| 166 | +// Map<String, String> params = { | ||
| 167 | +// "sid": userModel.user.sellerid, | ||
| 168 | +// "rdate": _getRdate(), | ||
| 169 | +// "ddate_solt": currTimeIndex.toString(), | ||
| 170 | +// "y": "200", | ||
| 171 | +// "x": "1", | ||
| 172 | +// "keywords": "", | ||
| 173 | +// "sort": "1" | ||
| 174 | +// }; | ||
| 175 | +// if (tabIndex == 1) { | ||
| 176 | +// params["account"] = userModel.user.account; | ||
| 177 | +// } | ||
| 178 | + | ||
| 179 | +// model.getReserveList(context, params); | ||
| 180 | +// } | ||
| 181 | + | ||
| 182 | +// //获取一天开始-结束时间字符串 | ||
| 183 | +// String _getRdate() { | ||
| 184 | +// //一天开始时间 | ||
| 185 | +// double startDay = (DateTime.parse((dateTimeNow.year.toString() + | ||
| 186 | +// "-" + | ||
| 187 | +// Utils.addZeroNumber(dateTimeNow.month) + | ||
| 188 | +// "-" + | ||
| 189 | +// Utils.addZeroNumber(dateTimeNow.day) + | ||
| 190 | +// " 00:00:00")) | ||
| 191 | +// .millisecondsSinceEpoch) / | ||
| 192 | +// 1000; | ||
| 193 | +// //一天结束时间 | ||
| 194 | +// double endDay = (DateTime.parse((dateTimeNow.year.toString() + | ||
| 195 | +// "-" + | ||
| 196 | +// Utils.addZeroNumber(dateTimeNow.month) + | ||
| 197 | +// "-" + | ||
| 198 | +// Utils.addZeroNumber(dateTimeNow.day) + | ||
| 199 | +// " 23:59:59")) | ||
| 200 | +// .millisecondsSinceEpoch) / | ||
| 201 | +// 1000; | ||
| 202 | +// return startDay.floor().toString() + "-" + endDay.floor().toString(); | ||
| 203 | +// } | ||
| 204 | + | ||
| 205 | +// //获取订单统计数目 | ||
| 206 | +// _reserveCountDay() { | ||
| 207 | +// NoteBookModel model = Provider.of<NoteBookModel>(context, listen: false); | ||
| 208 | +// Map<String, String> params = { | ||
| 209 | +// "sid": userModel.user.sellerid, | ||
| 210 | +// "day": dateTimeNow.year.toString() + | ||
| 211 | +// (dateTimeNow.month < 10 | ||
| 212 | +// ? "0" + dateTimeNow.month.toString() | ||
| 213 | +// : dateTimeNow.month.toString()) + | ||
| 214 | +// (dateTimeNow.day < 10 | ||
| 215 | +// ? "0" + dateTimeNow.day.toString() | ||
| 216 | +// : dateTimeNow.day.toString()) | ||
| 217 | +// }; | ||
| 218 | +// if (tabIndex == 1) { | ||
| 219 | +// params["account"] = userModel.user.account; | ||
| 220 | +// } | ||
| 221 | +// model.getReserveCountDay(context, params); | ||
| 222 | +// } | ||
| 223 | + | ||
| 224 | +// //构建List表头 | ||
| 225 | +// Widget _buildListTitle() { | ||
| 226 | +// return Container( | ||
| 227 | +// width: double.infinity, | ||
| 228 | +// height: ScreenUtil().setHeight(75), | ||
| 229 | +// color: MyColours.color_ffffff, | ||
| 230 | +// child: Row( | ||
| 231 | +// children: <Widget>[ | ||
| 232 | +// Container( | ||
| 233 | +// width: ScreenUtil().setWidth(171), | ||
| 234 | +// alignment: Alignment.center, | ||
| 235 | +// child: Text( | ||
| 236 | +// "桌号", | ||
| 237 | +// style: TextStyle( | ||
| 238 | +// color: MyColours.color_353535, | ||
| 239 | +// fontSize: ScreenUtil().setSp(28)), | ||
| 240 | +// ), | ||
| 241 | +// ), | ||
| 242 | +// MyDivider( | ||
| 243 | +// ScreenUtil().setWidth(1), | ||
| 244 | +// ScreenUtil().setHeight(65), | ||
| 245 | +// color: MyColours.color_ededed, | ||
| 246 | +// ), | ||
| 247 | +// Container( | ||
| 248 | +// width: ScreenUtil().setWidth(230), | ||
| 249 | +// alignment: Alignment.center, | ||
| 250 | +// child: Text( | ||
| 251 | +// "用户姓名", | ||
| 252 | +// style: TextStyle( | ||
| 253 | +// color: MyColours.color_353535, | ||
| 254 | +// fontSize: ScreenUtil().setSp(28)), | ||
| 255 | +// ), | ||
| 256 | +// ), | ||
| 257 | +// MyDivider( | ||
| 258 | +// ScreenUtil().setWidth(1), | ||
| 259 | +// ScreenUtil().setHeight(90), | ||
| 260 | +// color: MyColours.color_ededed, | ||
| 261 | +// ), | ||
| 262 | +// Container( | ||
| 263 | +// width: ScreenUtil().setWidth(159), | ||
| 264 | +// alignment: Alignment.center, | ||
| 265 | +// child: Text( | ||
| 266 | +// "时间", | ||
| 267 | +// style: TextStyle( | ||
| 268 | +// color: MyColours.color_353535, | ||
| 269 | +// fontSize: ScreenUtil().setSp(28)), | ||
| 270 | +// ), | ||
| 271 | +// ), | ||
| 272 | +// MyDivider( | ||
| 273 | +// ScreenUtil().setWidth(1), | ||
| 274 | +// ScreenUtil().setHeight(90), | ||
| 275 | +// color: MyColours.color_ededed, | ||
| 276 | +// ), | ||
| 277 | +// Container( | ||
| 278 | +// width: ScreenUtil().setWidth(184), | ||
| 279 | +// alignment: Alignment.center, | ||
| 280 | +// child: Text( | ||
| 281 | +// "操作", | ||
| 282 | +// style: TextStyle( | ||
| 283 | +// color: MyColours.color_353535, | ||
| 284 | +// fontSize: ScreenUtil().setSp(28)), | ||
| 285 | +// ), | ||
| 286 | +// ), | ||
| 287 | +// ], | ||
| 288 | +// ), | ||
| 289 | +// ); | ||
| 290 | +// } | ||
| 291 | + | ||
| 292 | +// //生成日期文本 | ||
| 293 | +// _createDateText(DateTime day) { | ||
| 294 | +// if (Utils.isOneDay(day, dateTimeNow)) return; //日期没变 | ||
| 295 | +// setState(() { | ||
| 296 | +// DateTime dateNow = DateTime.now(); | ||
| 297 | +// dateText = "${day.year}年 " + | ||
| 298 | +// Utils.addZeroNumber(day.month) + | ||
| 299 | +// "月" + | ||
| 300 | +// Utils.addZeroNumber(day.day) + | ||
| 301 | +// "日"; | ||
| 302 | +// if (Utils.isOneDay(day, dateNow)) { | ||
| 303 | +// dateText += " 今天"; | ||
| 304 | +// } else if (Utils.isOneDay(day, dateNow.add(Duration(days: 1)))) { | ||
| 305 | +// dateText += " 明天"; | ||
| 306 | +// } else if (Utils.isOneDay(day, dateNow.add(Duration(days: 2)))) { | ||
| 307 | +// dateText += " 后天"; | ||
| 308 | +// } else { | ||
| 309 | +// dateText += " 周${Utils.formatWeekDayNum(day.weekday)}"; | ||
| 310 | +// } | ||
| 311 | +// dateTimeNow = day; | ||
| 312 | +// }); | ||
| 313 | +// _getReserveList(); | ||
| 314 | +// _reserveCountDay(); | ||
| 315 | +// } | ||
| 316 | + | ||
| 317 | +// Widget _buildTabbar() { | ||
| 318 | +// Container container = Container( | ||
| 319 | +// color: MyColours.color_ffffff, | ||
| 320 | +// width: double.infinity, | ||
| 321 | +// padding: EdgeInsets.only( | ||
| 322 | +// left: ScreenUtil().setWidth(20), top: ScreenUtil().setWidth(20)), | ||
| 323 | +// child: Row( | ||
| 324 | +// mainAxisSize: MainAxisSize.min, | ||
| 325 | +// children: <Widget>[ | ||
| 326 | +// Container( | ||
| 327 | +// padding: | ||
| 328 | +// EdgeInsets.symmetric(horizontal: ScreenUtil().setWidth(20)), | ||
| 329 | +// child: GestureDetector( | ||
| 330 | +// onTap: () { | ||
| 331 | +// if (tabIndex == 0) return; | ||
| 332 | +// setState(() { | ||
| 333 | +// tabIndex = 0; | ||
| 334 | +// _getReserveList(); | ||
| 335 | +// _reserveCountDay(); | ||
| 336 | +// }); | ||
| 337 | +// }, | ||
| 338 | +// child: Column( | ||
| 339 | +// mainAxisAlignment: MainAxisAlignment.center, | ||
| 340 | +// children: <Widget>[ | ||
| 341 | +// Text( | ||
| 342 | +// "全部预订", | ||
| 343 | +// style: TextStyle( | ||
| 344 | +// color: tabIndex == 0 | ||
| 345 | +// ? MyColours.color_353535 | ||
| 346 | +// : MyColours.color_999999, | ||
| 347 | +// fontSize: tabIndex == 0 | ||
| 348 | +// ? ScreenUtil().setSp(36) | ||
| 349 | +// : ScreenUtil().setSp(28), | ||
| 350 | +// fontWeight: tabIndex == 0 | ||
| 351 | +// ? FontWeight.bold | ||
| 352 | +// : FontWeight.normal), | ||
| 353 | +// ), | ||
| 354 | +// Align( | ||
| 355 | +// alignment: Alignment.bottomCenter, | ||
| 356 | +// child: Container( | ||
| 357 | +// height: ScreenUtil().setWidth(6), | ||
| 358 | +// width: ScreenUtil().setWidth(60), | ||
| 359 | +// margin: EdgeInsets.only(top: ScreenUtil().setWidth(8)), | ||
| 360 | +// decoration: tabIndex == 0 | ||
| 361 | +// ? BoxDecoration( | ||
| 362 | +// color: MyColours.color_199095, | ||
| 363 | +// borderRadius: BorderRadius.circular( | ||
| 364 | +// ScreenUtil().setWidth(6))) | ||
| 365 | +// : BoxDecoration( | ||
| 366 | +// color: MyColours.color_ffffff, | ||
| 367 | +// borderRadius: BorderRadius.circular( | ||
| 368 | +// ScreenUtil().setWidth(6))), | ||
| 369 | +// ), | ||
| 370 | +// ), | ||
| 371 | +// ], | ||
| 372 | +// )), | ||
| 373 | +// ), | ||
| 374 | +// Container( | ||
| 375 | +// padding: | ||
| 376 | +// EdgeInsets.symmetric(horizontal: ScreenUtil().setWidth(20)), | ||
| 377 | +// child: GestureDetector( | ||
| 378 | +// onTap: () { | ||
| 379 | +// if (tabIndex == 1) return; | ||
| 380 | +// setState(() { | ||
| 381 | +// tabIndex = 1; | ||
| 382 | +// _getReserveList(); | ||
| 383 | +// _reserveCountDay(); | ||
| 384 | +// }); | ||
| 385 | +// }, | ||
| 386 | +// child: Column( | ||
| 387 | +// mainAxisAlignment: MainAxisAlignment.center, | ||
| 388 | +// children: <Widget>[ | ||
| 389 | +// Text( | ||
| 390 | +// "我录入的", | ||
| 391 | +// style: TextStyle( | ||
| 392 | +// color: tabIndex == 1 | ||
| 393 | +// ? MyColours.color_353535 | ||
| 394 | +// : MyColours.color_999999, | ||
| 395 | +// fontSize: tabIndex == 1 | ||
| 396 | +// ? ScreenUtil().setSp(36) | ||
| 397 | +// : ScreenUtil().setSp(28), | ||
| 398 | +// fontWeight: tabIndex == 1 | ||
| 399 | +// ? FontWeight.bold | ||
| 400 | +// : FontWeight.normal), | ||
| 401 | +// ), | ||
| 402 | +// Align( | ||
| 403 | +// alignment: Alignment.bottomCenter, | ||
| 404 | +// child: Container( | ||
| 405 | +// height: ScreenUtil().setWidth(6), | ||
| 406 | +// width: ScreenUtil().setWidth(60), | ||
| 407 | +// margin: EdgeInsets.only(top: ScreenUtil().setWidth(8)), | ||
| 408 | +// decoration: tabIndex == 1 | ||
| 409 | +// ? BoxDecoration( | ||
| 410 | +// color: MyColours.color_199095, | ||
| 411 | +// borderRadius: BorderRadius.circular( | ||
| 412 | +// ScreenUtil().setWidth(6))) | ||
| 413 | +// : BoxDecoration( | ||
| 414 | +// color: MyColours.color_ffffff, | ||
| 415 | +// borderRadius: BorderRadius.circular( | ||
| 416 | +// ScreenUtil().setWidth(6))), | ||
| 417 | +// ), | ||
| 418 | +// ), | ||
| 419 | +// ], | ||
| 420 | +// )), | ||
| 421 | +// ), | ||
| 422 | +// Spacer(), | ||
| 423 | +// GestureDetector( | ||
| 424 | +// onTap: () { | ||
| 425 | +// NavigatorUtil.goStatisticsPage(context); | ||
| 426 | +// }, | ||
| 427 | +// child: Container( | ||
| 428 | +// color: Colors.white, | ||
| 429 | +// padding: EdgeInsets.only( | ||
| 430 | +// left: ScreenUtil().setWidth(40), | ||
| 431 | +// right: ScreenUtil().setWidth(40), | ||
| 432 | +// bottom: ScreenUtil().setWidth(30)), | ||
| 433 | +// child: Text( | ||
| 434 | +// "统计列表", | ||
| 435 | +// style: TextStyle( | ||
| 436 | +// color: MyColours.color_199095, | ||
| 437 | +// fontSize: ScreenUtil().setSp(36), | ||
| 438 | +// fontWeight: FontWeight.bold), | ||
| 439 | +// ))), | ||
| 440 | +// ], | ||
| 441 | +// ), | ||
| 442 | +// ); | ||
| 443 | +// return container; | ||
| 444 | +// } | ||
| 445 | + | ||
| 446 | +// @override | ||
| 447 | +// Widget build(BuildContext context) { | ||
| 448 | +// // TODO: implement build | ||
| 449 | +// userModel = Provider.of<UserModel>(context, listen: false); | ||
| 450 | +// return Container( | ||
| 451 | +// width: double.infinity, | ||
| 452 | +// height: double.infinity, | ||
| 453 | +// color: MyColours.color_f5f5f5, | ||
| 454 | +// child: Column( | ||
| 455 | +// children: <Widget>[ | ||
| 456 | +// _buildTabbar(), | ||
| 457 | +// Container( | ||
| 458 | +// color: MyColours.color_ffffff, | ||
| 459 | +// width: double.infinity, | ||
| 460 | +// padding: EdgeInsets.only(bottom: ScreenUtil().setWidth(16)), | ||
| 461 | +// child: Row( | ||
| 462 | +// crossAxisAlignment: CrossAxisAlignment.center, | ||
| 463 | +// children: <Widget>[ | ||
| 464 | +// Expanded( | ||
| 465 | +// child: Center( | ||
| 466 | +// child: GestureDetector( | ||
| 467 | +// onTap: () { | ||
| 468 | +// DialogUtil.showCalendarDialog(context, dateTimeNow) | ||
| 469 | +// .then((day) { | ||
| 470 | +// if (day != null) { | ||
| 471 | +// _createDateText(day); | ||
| 472 | +// } | ||
| 473 | +// }); | ||
| 474 | +// }, | ||
| 475 | +// child: Container( | ||
| 476 | +// child: Text( | ||
| 477 | +// dateText, | ||
| 478 | +// style: TextStyle( | ||
| 479 | +// color: MyColours.color_199095, | ||
| 480 | +// fontSize: ScreenUtil().setSp(34)), | ||
| 481 | +// ), | ||
| 482 | +// ), | ||
| 483 | +// ), | ||
| 484 | +// ), | ||
| 485 | +// ), | ||
| 486 | +// MyDivider( | ||
| 487 | +// ScreenUtil().setWidth(2), | ||
| 488 | +// ScreenUtil().setHeight(68), | ||
| 489 | +// color: MyColours.color_E0E0E0, | ||
| 490 | +// ), | ||
| 491 | +// Expanded( | ||
| 492 | +// child: Padding( | ||
| 493 | +// padding: EdgeInsets.symmetric( | ||
| 494 | +// horizontal: ScreenUtil().setWidth(30)), | ||
| 495 | +// child: Row( | ||
| 496 | +// mainAxisAlignment: MainAxisAlignment.center, | ||
| 497 | +// crossAxisAlignment: CrossAxisAlignment.center, | ||
| 498 | +// children: <Widget>[ | ||
| 499 | +// Offstage( | ||
| 500 | +// offstage: morning == "00:00-00:00" ? true : false, | ||
| 501 | +// child: Padding( | ||
| 502 | +// padding: EdgeInsets.only( | ||
| 503 | +// right: ScreenUtil().setWidth(18)), | ||
| 504 | +// child: CommonButton( | ||
| 505 | +// content: "早市", | ||
| 506 | +// state: currTimeIndex == 1 ? 1 : 0, | ||
| 507 | +// width: 92, | ||
| 508 | +// height: 48, | ||
| 509 | +// fontSize: 32, | ||
| 510 | +// onPress: () { | ||
| 511 | +// if (currTimeIndex == 1) return; | ||
| 512 | +// setState(() { | ||
| 513 | +// currTimeIndex = 1; | ||
| 514 | +// }); | ||
| 515 | +// _getReserveList(); | ||
| 516 | +// }, | ||
| 517 | +// ))), | ||
| 518 | +// Offstage( | ||
| 519 | +// offstage: noon == "00:00-00:00" ? true : false, | ||
| 520 | +// child: Padding( | ||
| 521 | +// padding: EdgeInsets.only( | ||
| 522 | +// right: ScreenUtil().setWidth(18)), | ||
| 523 | +// child: CommonButton( | ||
| 524 | +// content: "午市", | ||
| 525 | +// state: currTimeIndex == 2 ? 1 : 0, | ||
| 526 | +// width: 92, | ||
| 527 | +// height: 48, | ||
| 528 | +// fontSize: 32, | ||
| 529 | +// onPress: () { | ||
| 530 | +// if (currTimeIndex == 2) return; | ||
| 531 | +// setState(() { | ||
| 532 | +// currTimeIndex = 2; | ||
| 533 | +// }); | ||
| 534 | +// _getReserveList(); | ||
| 535 | +// }, | ||
| 536 | +// ))), | ||
| 537 | +// Offstage( | ||
| 538 | +// offstage: night == "00:00-00:00" ? true : false, | ||
| 539 | +// child: Container( | ||
| 540 | +// // padding: EdgeInsets.symmetric( | ||
| 541 | +// // horizontal: ScreenUtil().setWidth(10)), | ||
| 542 | +// child: CommonButton( | ||
| 543 | +// content: "晚市", | ||
| 544 | +// state: currTimeIndex == 3 ? 1 : 0, | ||
| 545 | +// width: 92, | ||
| 546 | +// height: 48, | ||
| 547 | +// fontSize: 32, | ||
| 548 | +// onPress: () { | ||
| 549 | +// if (currTimeIndex == 3) return; | ||
| 550 | +// setState(() { | ||
| 551 | +// currTimeIndex = 3; | ||
| 552 | +// }); | ||
| 553 | +// _getReserveList(); | ||
| 554 | +// }, | ||
| 555 | +// )), | ||
| 556 | +// ), | ||
| 557 | +// ], | ||
| 558 | +// ), | ||
| 559 | +// ), | ||
| 560 | +// ) | ||
| 561 | +// ], | ||
| 562 | +// ), | ||
| 563 | +// ), | ||
| 564 | +// Selector<NoteBookModel, String>( | ||
| 565 | +// selector: (context, model) => model.total, | ||
| 566 | +// builder: (context, total, child) { | ||
| 567 | +// return Container( | ||
| 568 | +// width: double.infinity, | ||
| 569 | +// alignment: Alignment.centerLeft, | ||
| 570 | +// padding: EdgeInsets.only(left: ScreenUtil().setWidth(38)), | ||
| 571 | +// height: ScreenUtil().setHeight(72), | ||
| 572 | +// color: MyColours.color_f5f5f5, | ||
| 573 | +// child: Text( | ||
| 574 | +// total, | ||
| 575 | +// style: TextStyle( | ||
| 576 | +// color: MyColours.color_353535, | ||
| 577 | +// fontSize: ScreenUtil().setSp(26)), | ||
| 578 | +// ), | ||
| 579 | +// ); | ||
| 580 | +// }, | ||
| 581 | +// ), | ||
| 582 | +// _buildListTitle(), | ||
| 583 | +// Expanded(child: Consumer<NoteBookModel>( | ||
| 584 | +// builder: (context, model, _) { | ||
| 585 | +// if (model.pageState != PageState.Success) { | ||
| 586 | +// return ExceptionPage( | ||
| 587 | +// pageState: model.pageState, | ||
| 588 | +// callback: () { | ||
| 589 | +// _getReserveList(); | ||
| 590 | +// _reserveCountDay(); | ||
| 591 | +// }, | ||
| 592 | +// emptyMsg: "暂时没有预订哦", | ||
| 593 | +// emptyImg: "empty_search", | ||
| 594 | +// showMsg: "加载中,请稍后...", | ||
| 595 | +// ); | ||
| 596 | +// } else { | ||
| 597 | +// return EasyRefresh.custom( | ||
| 598 | +// controller: _controller, | ||
| 599 | +// slivers: [ | ||
| 600 | +// SliverList( | ||
| 601 | +// delegate: SliverChildBuilderDelegate( | ||
| 602 | +// (BuildContext context, int index) { | ||
| 603 | +// return NoteBookItem(model.notebooks[index], index); | ||
| 604 | +// }, childCount: model.notebooks.length), | ||
| 605 | +// // itemExtent: ScreenUtil().setWidth(112), | ||
| 606 | +// ) | ||
| 607 | +// ], | ||
| 608 | +// onRefresh: () async { | ||
| 609 | +// _getReserveList(); | ||
| 610 | +// }, | ||
| 611 | +// ); | ||
| 612 | +// } | ||
| 613 | +// }, | ||
| 614 | +// )) | ||
| 615 | +// ], | ||
| 616 | +// ), | ||
| 617 | +// ); | ||
| 618 | +// } | ||
| 619 | +// } |
-
Please register or login to post a comment