Commit 73b14eb4237be807d0a86caf636eb04ff720a58c

Authored by wdn127929
1 parent 6f980388

到店时间UI限制最大高度

@@ -394,12 +394,13 @@ class NotebookDetailPageState extends State<NotebookDetailPage> { @@ -394,12 +394,13 @@ class NotebookDetailPageState extends State<NotebookDetailPage> {
394 _initTime(int dateSolt) { 394 _initTime(int dateSolt) {
395 ddateHm = detailModel!.detailModelAllSunModel!.ddateStr; 395 ddateHm = detailModel!.detailModelAllSunModel!.ddateStr;
396 // UserModel userModel = Provider.of<UserModel>(context, listen: false); 396 // UserModel userModel = Provider.of<UserModel>(context, listen: false);
397 - String str = detailModel!.detailModelAllSunModel!.mdate == null || detailModel!.detailModelAllSunModel!.mdate == '' 397 + String str = detailModel!.detailModelAllSunModel!.mdate == null ||
  398 + detailModel!.detailModelAllSunModel!.mdate == ''
398 ? "00:00-00:00" 399 ? "00:00-00:00"
399 : detailModel!.detailModelAllSunModel!.mdate!; 400 : detailModel!.detailModelAllSunModel!.mdate!;
400 - str == "00:00-00:00"  
401 - ? dailyList = []  
402 - : dailyList = _getHourAndMinute(str, dateSolt ); 401 + str == "00:00-00:00"
  402 + ? dailyList = []
  403 + : dailyList = _getHourAndMinute(str, dateSolt);
403 // if (dateSolt == 1) { 404 // if (dateSolt == 1) {
404 // //早餐 405 // //早餐
405 406
@@ -1677,113 +1678,126 @@ class NotebookDetailPageState extends State<NotebookDetailPage> { @@ -1677,113 +1678,126 @@ class NotebookDetailPageState extends State<NotebookDetailPage> {
1677 // if (item['isSelect'] == true) { 1678 // if (item['isSelect'] == true) {
1678 1679
1679 // } 1680 // }
1680 - 1681 + ScrollController controller = ScrollController();
1681 final option = await showModalBottomSheet( 1682 final option = await showModalBottomSheet(
1682 context: context, 1683 context: context,
1683 isScrollControlled: true, 1684 isScrollControlled: true,
1684 backgroundColor: Colors.white, 1685 backgroundColor: Colors.white,
  1686 +
1685 builder: (context) { 1687 builder: (context) {
1686 return StatefulBuilder(builder: (context, state) { 1688 return StatefulBuilder(builder: (context, state) {
1687 return SafeArea( 1689 return SafeArea(
  1690 +
1688 child: Container( 1691 child: Container(
  1692 + constraints: BoxConstraints(
  1693 + maxHeight: ScreenUtil().screenHeight-w(100)
  1694 + ),
  1695 + // margin: EdgeInsets.only(top: w(50)),
1689 decoration: BoxDecoration( 1696 decoration: BoxDecoration(
1690 borderRadius: 1697 borderRadius:
1691 BorderRadius.circular(ScreenUtil().setWidth(10))), 1698 BorderRadius.circular(ScreenUtil().setWidth(10))),
1692 - child: Column(  
1693 - mainAxisSize: MainAxisSize.min,  
1694 - children: [  
1695 - InkWell(  
1696 - onTap: () {  
1697 - if (Navigator.canPop(context)) {  
1698 - Navigator.pop(context);  
1699 - }  
1700 - },  
1701 - child: Align(  
1702 - alignment: Alignment.centerRight,  
1703 - child: Container(  
1704 - padding: EdgeInsets.fromLTRB(  
1705 - ScreenUtil().setWidth(40),  
1706 - ScreenUtil().setWidth(40),  
1707 - ScreenUtil().setWidth(40),  
1708 - ScreenUtil().setWidth(10)),  
1709 - child: Image.asset(  
1710 - 'assets/close.png',  
1711 - width: ScreenUtil().setWidth(32),  
1712 - height: ScreenUtil().setWidth(32), 1699 + child: SingleChildScrollView(
  1700 + controller: controller,
  1701 + child: Column(
  1702 +
  1703 + mainAxisSize: MainAxisSize.min,
  1704 + children: [
  1705 + InkWell(
  1706 + onTap: () {
  1707 + if (Navigator.canPop(context)) {
  1708 + Navigator.pop(context);
  1709 + }
  1710 + },
  1711 + child: Align(
  1712 + alignment: Alignment.centerRight,
  1713 + child: Container(
  1714 + padding: EdgeInsets.fromLTRB(
  1715 + ScreenUtil().setWidth(40),
  1716 + ScreenUtil().setWidth(40),
  1717 + ScreenUtil().setWidth(40),
  1718 + ScreenUtil().setWidth(10)),
  1719 + child: Image.asset(
  1720 + 'assets/close.png',
  1721 + width: ScreenUtil().setWidth(32),
  1722 + height: ScreenUtil().setWidth(32),
  1723 + ),
  1724 + ),
1713 ), 1725 ),
1714 ), 1726 ),
1715 - ),  
1716 - ),  
1717 - Center(  
1718 - child: Text(title,  
1719 - style: TextStyle(  
1720 - fontSize: ScreenUtil().setSp(34),  
1721 - fontWeight: FontWeight.bold,  
1722 - color: MyColours.color_353535)),  
1723 - ),  
1724 - Padding(  
1725 - padding: EdgeInsets.symmetric(  
1726 - horizontal: ScreenUtil().setWidth(60),  
1727 - vertical: ScreenUtil().setWidth(40)),  
1728 - child: GridView.builder(  
1729 - padding:  
1730 - EdgeInsets.only(top: ScreenUtil().setWidth(20)),  
1731 - shrinkWrap: true,  
1732 - cacheExtent: ScreenUtil().setWidth(0),  
1733 - itemCount: dailyList.length,  
1734 - gridDelegate:  
1735 - SliverGridDelegateWithFixedCrossAxisCount(  
1736 - crossAxisCount: 3,  
1737 - childAspectRatio: 80 / 36,  
1738 - mainAxisSpacing:  
1739 - ScreenUtil().setWidth(15 * 2),  
1740 - crossAxisSpacing:  
1741 - ScreenUtil().setWidth(38 * 2)),  
1742 - itemBuilder: (BuildContext context, int index) {  
1743 - // locationState = state;  
1744 - return CustomButton(  
1745 - onTap: () async {  
1746 - // state(() {  
1747 - for (var item in dailyList) {  
1748 - item['select'] = false;  
1749 - if (item['title'] ==  
1750 - dailyList[index]['title']) {  
1751 - item['select'] = true;  
1752 -  
1753 - // _homeEnterModel.isSetDate = "1";  
1754 - ddateHm = item['title'];  
1755 - }  
1756 - }  
1757 -  
1758 - detailModel!.notifyListeners();  
1759 - if (Navigator.canPop(context)) {  
1760 - Navigator.pop(context);  
1761 - }  
1762 - // setState(() {  
1763 - // selectPnum = value.first;  
1764 - // pnum = pnumlist[value.first];  
1765 - // });  
1766 - bool sucess = await detailModel!.upReserveInfo(  
1767 - context, widget.rid,  
1768 - dateStr: ddateHm,  
1769 - ymd: detailModel!  
1770 - .detailModelAllSunModel!.ddateYMD);  
1771 -  
1772 - if (sucess) {  
1773 - bus.emit("refresh_book_list"); //刷新已预订列表  
1774 - await getReserveDetailDataSet(  
1775 - showCicle: false, isShowLoading: false);  
1776 - }  
1777 - },  
1778 - width: 80,  
1779 - height: 36,  
1780 - dateText: dailyList[index]['title'].toString(),  
1781 - dayText: '',  
1782 - isSelect: dailyList[index]['select'],  
1783 - );  
1784 - }))  
1785 - ],  
1786 - ), 1727 + Center(
  1728 + child: Text(title,
  1729 + style: TextStyle(
  1730 + fontSize: ScreenUtil().setSp(34),
  1731 + fontWeight: FontWeight.bold,
  1732 + color: MyColours.color_353535)),
  1733 + ),
  1734 + Padding(
  1735 + padding: EdgeInsets.symmetric(
  1736 + horizontal: ScreenUtil().setWidth(60),
  1737 + vertical: ScreenUtil().setWidth(40)),
  1738 + child: GridView.builder(
  1739 + controller: controller,
  1740 + padding: EdgeInsets.only(
  1741 + top: ScreenUtil().setWidth(20)),
  1742 + shrinkWrap: true,
  1743 + cacheExtent: ScreenUtil().setWidth(0),
  1744 + itemCount: dailyList.length,
  1745 + gridDelegate:
  1746 + SliverGridDelegateWithFixedCrossAxisCount(
  1747 + crossAxisCount: 3,
  1748 + childAspectRatio: 80 / 36,
  1749 + mainAxisSpacing:
  1750 + ScreenUtil().setWidth(15 * 2),
  1751 + crossAxisSpacing:
  1752 + ScreenUtil().setWidth(38 * 2)),
  1753 + itemBuilder: (BuildContext context, int index) {
  1754 + // locationState = state;
  1755 + return CustomButton(
  1756 + onTap: () async {
  1757 + // state(() {
  1758 + for (var item in dailyList) {
  1759 + item['select'] = false;
  1760 + if (item['title'] ==
  1761 + dailyList[index]['title']) {
  1762 + item['select'] = true;
  1763 +
  1764 + // _homeEnterModel.isSetDate = "1";
  1765 + ddateHm = item['title'];
  1766 + }
  1767 + }
  1768 +
  1769 + detailModel!.notifyListeners();
  1770 + if (Navigator.canPop(context)) {
  1771 + Navigator.pop(context);
  1772 + }
  1773 + // setState(() {
  1774 + // selectPnum = value.first;
  1775 + // pnum = pnumlist[value.first];
  1776 + // });
  1777 + bool sucess = await detailModel!
  1778 + .upReserveInfo(context, widget.rid,
  1779 + dateStr: ddateHm,
  1780 + ymd: detailModel!
  1781 + .detailModelAllSunModel!
  1782 + .ddateYMD);
  1783 +
  1784 + if (sucess) {
  1785 + bus.emit("refresh_book_list"); //刷新已预订列表
  1786 + await getReserveDetailDataSet(
  1787 + showCicle: false,
  1788 + isShowLoading: false);
  1789 + }
  1790 + },
  1791 + width: 80,
  1792 + height: 36,
  1793 + dateText:
  1794 + dailyList[index]['title'].toString(),
  1795 + dayText: '',
  1796 + isSelect: dailyList[index]['select'],
  1797 + );
  1798 + }))
  1799 + ],
  1800 + )),
1787 )); 1801 ));
1788 }); 1802 });
1789 }); 1803 });
@@ -232,7 +232,7 @@ class _MyCustomerOrderPageState extends State<MyCustomerOrderPage> { @@ -232,7 +232,7 @@ class _MyCustomerOrderPageState extends State<MyCustomerOrderPage> {
232 color: MyColours.color_353535), 232 color: MyColours.color_353535),
233 ), 233 ),
234 Text( 234 Text(
235 - '${customerProvider.guestReserveSunModel!.count!.countMoney} ', 235 + '${customerProvider.guestReserveSunModel!.count!.countMoney??0} ',
236 style: TextStyle( 236 style: TextStyle(
237 fontSize: ScreenUtil().setSp(24), 237 fontSize: ScreenUtil().setSp(24),
238 color: MyColours.color_353535), 238 color: MyColours.color_353535),
@@ -251,7 +251,7 @@ class _MyCustomerOrderPageState extends State<MyCustomerOrderPage> { @@ -251,7 +251,7 @@ class _MyCustomerOrderPageState extends State<MyCustomerOrderPage> {
251 color: MyColours.color_353535), 251 color: MyColours.color_353535),
252 ), 252 ),
253 Text( 253 Text(
254 - '${customerProvider.guestReserveSunModel!.count!.countPnum} ', 254 + '${customerProvider.guestReserveSunModel!.count!.countPnum??0} ',
255 style: TextStyle( 255 style: TextStyle(
256 fontSize: ScreenUtil().setSp(24), 256 fontSize: ScreenUtil().setSp(24),
257 color: MyColours.color_353535), 257 color: MyColours.color_353535),
@@ -107,7 +107,9 @@ class NoteBookPageState extends State<NoteBookPage> { @@ -107,7 +107,9 @@ class NoteBookPageState extends State<NoteBookPage> {
107 } 107 }
108 108
109 WidgetsBinding.instance.addPostFrameCallback((_) { 109 WidgetsBinding.instance.addPostFrameCallback((_) {
110 - getMealSectionByDay(first: true); 110 + getMealSectionByDay(
  111 + first: true,
  112 + );
111 noteBookModel.isSimple = App.sp!.getBool("isSimple") ?? true; 113 noteBookModel.isSimple = App.sp!.getBool("isSimple") ?? true;
112 114
113 setState(() {}); 115 setState(() {});
@@ -117,7 +119,7 @@ class NoteBookPageState extends State<NoteBookPage> { @@ -117,7 +119,7 @@ class NoteBookPageState extends State<NoteBookPage> {
117 }); 119 });
118 } 120 }
119 121
120 - getMealSectionByDay({bool needInit = true, bool first = false}) async { 122 + getMealSectionByDay({ bool first = false}) async {
121 Map<String, String?> pramas = { 123 Map<String, String?> pramas = {
122 'sellerid': Provider.of<UserModel>(context, listen: false).user!.sellerid, 124 'sellerid': Provider.of<UserModel>(context, listen: false).user!.sellerid,
123 'day': 125 'day':
@@ -125,7 +127,7 @@ class NoteBookPageState extends State<NoteBookPage> { @@ -125,7 +127,7 @@ class NoteBookPageState extends State<NoteBookPage> {
125 }; 127 };
126 await storeBaseIndoProvider.getMealSectionByDay(context, pramas, 128 await storeBaseIndoProvider.getMealSectionByDay(context, pramas,
127 showLoading: false); 129 showLoading: false);
128 - _initTime(first: first, needInit: needInit); 130 + _initTime(first: first);
129 } 131 }
130 132
131 getSellerVersion() async { 133 getSellerVersion() async {
@@ -162,7 +164,7 @@ class NoteBookPageState extends State<NoteBookPage> { @@ -162,7 +164,7 @@ class NoteBookPageState extends State<NoteBookPage> {
162 } 164 }
163 165
164 //初始化时间 166 //初始化时间
165 - _initTime({bool needInit = true, bool first = false}) { 167 + _initTime({bool first = false}) {
166 if (first && widget.date != null) { 168 if (first && widget.date != null) {
167 _refreshPageCalendar(dateTimeNow); 169 _refreshPageCalendar(dateTimeNow);
168 } 170 }
@@ -179,8 +181,14 @@ class NoteBookPageState extends State<NoteBookPage> { @@ -179,8 +181,14 @@ class NoteBookPageState extends State<NoteBookPage> {
179 meal2 = element.mdate; 181 meal2 = element.mdate;
180 } 182 }
181 }); 183 });
182 - if ((first && (widget.solt == null || widget.solt == "null")) || needInit) {  
183 - initCurruntIndex(); 184 + if (first ) {
  185 + //
  186 + if ( widget.solt == null || widget.solt == "null") {
  187 + initCurruntIndex();
  188 +
  189 + } else {
  190 + currTimeIndex = int.parse(widget.solt!);
  191 + }
184 } else { 192 } else {
185 if (first) { 193 if (first) {
186 bool has = storeBaseIndoProvider.dayDateData! 194 bool has = storeBaseIndoProvider.dayDateData!
@@ -439,8 +447,7 @@ class NoteBookPageState extends State<NoteBookPage> { @@ -439,8 +447,7 @@ class NoteBookPageState extends State<NoteBookPage> {
439 print(days); 447 print(days);
440 448
441 /// _focusedDay 449 /// _focusedDay
442 - if ((days.inDays == 0 ) ||  
443 - (days.inDays > 0 && days.inDays <7)) { 450 + if ((days.inDays == 0) || (days.inDays > 0 && days.inDays < 7)) {
444 // _calendarController.setSelectedDay(day); 451 // _calendarController.setSelectedDay(day);
445 dateText = '更多\n日期'; 452 dateText = '更多\n日期';
446 clearSel = false; 453 clearSel = false;
@@ -458,7 +465,7 @@ class NoteBookPageState extends State<NoteBookPage> { @@ -458,7 +465,7 @@ class NoteBookPageState extends State<NoteBookPage> {
458 if (Utils.isOneDay(day, dateTimeNow!)) return; //日期没变 465 if (Utils.isOneDay(day, dateTimeNow!)) return; //日期没变
459 _refreshPageCalendar(day); 466 _refreshPageCalendar(day);
460 ddateSoltSelect = currTimeIndex.toString(); 467 ddateSoltSelect = currTimeIndex.toString();
461 - getMealSectionByDay(needInit: false); 468 + getMealSectionByDay();
462 _reserveCountDay(); 469 _reserveCountDay();
463 } 470 }
464 471
@@ -753,7 +760,7 @@ class NoteBookPageState extends State<NoteBookPage> { @@ -753,7 +760,7 @@ class NoteBookPageState extends State<NoteBookPage> {
753 dateText = '更多\n日期'; 760 dateText = '更多\n日期';
754 }); 761 });
755 ddateSoltSelect = currTimeIndex.toString(); 762 ddateSoltSelect = currTimeIndex.toString();
756 - getMealSectionByDay(needInit: false); 763 + getMealSectionByDay();
757 764
758 _reserveCountDay(); 765 _reserveCountDay();
759 } 766 }
@@ -819,7 +826,7 @@ class NoteBookPageState extends State<NoteBookPage> { @@ -819,7 +826,7 @@ class NoteBookPageState extends State<NoteBookPage> {
819 }); 826 });
820 ddateSoltSelect = 827 ddateSoltSelect =
821 currTimeIndex.toString(); 828 currTimeIndex.toString();
822 - getMealSectionByDay(needInit: false); 829 + getMealSectionByDay();
823 830
824 _reserveCountDay(); 831 _reserveCountDay();
825 } 832 }