Showing
6 changed files
with
722 additions
and
19 deletions
| 1 | +import 'package:flutter/material.dart'; | ||
| 2 | +import 'package:one_key/widgets/MyDivider.dart'; | ||
| 3 | +import 'package:one_key/widgets/system_app_bar.dart'; | ||
| 4 | +import 'package:one_key/widgets/v_empty_view.dart'; | ||
| 5 | + | ||
| 6 | +import '../../../models/filter_btn_model.dart'; | ||
| 7 | +import '../../../res/colors.dart'; | ||
| 8 | +import '../../../utils/dialog_util.dart'; | ||
| 9 | +import '../../../utils/screen_util.dart'; | ||
| 10 | +import '../../../utils/utils.dart'; | ||
| 11 | +import '../../../widgets/h_empty_view.dart'; | ||
| 12 | +import '../../../widgets/round_button.dart'; | ||
| 13 | + | ||
| 14 | +/** | ||
| 15 | + * 多时段编辑页面 | ||
| 16 | + */ | ||
| 17 | + | ||
| 18 | +class BookTimeSettingEditPage extends StatefulWidget { | ||
| 19 | + const BookTimeSettingEditPage(); | ||
| 20 | + | ||
| 21 | + @override | ||
| 22 | + State<BookTimeSettingEditPage> createState() => | ||
| 23 | + _BookTimeSettingEditPageState(); | ||
| 24 | +} | ||
| 25 | + | ||
| 26 | +class _BookTimeSettingEditPageState extends State<BookTimeSettingEditPage> { | ||
| 27 | + bool isTime = true; | ||
| 28 | + bool isWeek = false; | ||
| 29 | + List<FilterBtnModel> weekData = []; | ||
| 30 | + String weekShow = '点击选择日期(可多选)'; | ||
| 31 | + | ||
| 32 | + @override | ||
| 33 | + void initState() { | ||
| 34 | + super.initState(); | ||
| 35 | + _initWeekData(); | ||
| 36 | + WidgetsBinding.instance.addPostFrameCallback((_) {}); | ||
| 37 | + } | ||
| 38 | + | ||
| 39 | + _initWeekData() { | ||
| 40 | + FilterBtnModel filterBtnModel = FilterBtnModel(); | ||
| 41 | + filterBtnModel.selectNoon = false; | ||
| 42 | + filterBtnModel.selectNig = false; | ||
| 43 | + filterBtnModel.title = '周日'; | ||
| 44 | + weekData.add(filterBtnModel); | ||
| 45 | + for (int i = 1; i < 7; i++) { | ||
| 46 | + FilterBtnModel filterBtnModel = FilterBtnModel(); | ||
| 47 | + filterBtnModel.selectNoon = false; | ||
| 48 | + filterBtnModel.selectNig = false; | ||
| 49 | + filterBtnModel.title = '周${Utils.formatWeekDayNum(i)}'; | ||
| 50 | + weekData.add(filterBtnModel); | ||
| 51 | + } | ||
| 52 | + } | ||
| 53 | + | ||
| 54 | + _itemRadioWidget(bool select, String title, {GestureTapCallback onTap}) { | ||
| 55 | + return InkWell( | ||
| 56 | + onTap: onTap, | ||
| 57 | + child: Row(children: [ | ||
| 58 | + Image.asset( | ||
| 59 | + Utils.getImgPath( | ||
| 60 | + select ? 'plan_dish_select' : 'plan_dish_unselect'), | ||
| 61 | + width: w(20), | ||
| 62 | + ), | ||
| 63 | + HEmptyView(6), | ||
| 64 | + Text( | ||
| 65 | + title, | ||
| 66 | + style: TextStyle(color: MyColours.color_515151, fontSize: font(16)), | ||
| 67 | + ), | ||
| 68 | + ])); | ||
| 69 | + } | ||
| 70 | + | ||
| 71 | + ///时间选择 | ||
| 72 | + Widget _select1(String title, GestureTapCallback onTap) { | ||
| 73 | + return InkWell( | ||
| 74 | + onTap: onTap, | ||
| 75 | + child: Container( | ||
| 76 | + padding: EdgeInsets.only(left: w(16)), | ||
| 77 | + child: Row( | ||
| 78 | + crossAxisAlignment: CrossAxisAlignment.center, | ||
| 79 | + mainAxisAlignment: MainAxisAlignment.center, | ||
| 80 | + children: [ | ||
| 81 | + Container( | ||
| 82 | + // height: ScreenUtil().setWidth(40), | ||
| 83 | + // color: Colors.red, | ||
| 84 | + child: Text( | ||
| 85 | + title, | ||
| 86 | + style: TextStyle( | ||
| 87 | + height: 1.5, | ||
| 88 | + color: title == '点击选择日期(可多选)' | ||
| 89 | + ? MyColours.color_999999 | ||
| 90 | + : MyColours.color_515151, | ||
| 91 | + fontSize: font(16)), | ||
| 92 | + ), | ||
| 93 | + ), | ||
| 94 | + // HEmptyView(20), | ||
| 95 | + Spacer(), | ||
| 96 | + // Text(hintText, | ||
| 97 | + // style: TextStyle( | ||
| 98 | + // color: hintText == '点击设置开始日期' || hintText == '点击设置结束日期' | ||
| 99 | + // ? MyColours.color_999999 | ||
| 100 | + // : MyColours.color_515151, | ||
| 101 | + // fontSize: font(16), | ||
| 102 | + // )), | ||
| 103 | + HEmptyView(20), | ||
| 104 | + Image.asset( | ||
| 105 | + Utils.getImgPath('arrow_right_new'), | ||
| 106 | + width: w(9), | ||
| 107 | + ), | ||
| 108 | + HEmptyView(32), | ||
| 109 | + ], | ||
| 110 | + ), | ||
| 111 | + ), | ||
| 112 | + ); | ||
| 113 | + } | ||
| 114 | + | ||
| 115 | + @override | ||
| 116 | + Widget build(BuildContext context) { | ||
| 117 | + return Scaffold( | ||
| 118 | + backgroundColor: MyColours.color_ffffff, | ||
| 119 | + appBar: SystemAppBar('多时段预订详情'), | ||
| 120 | + body: Column( | ||
| 121 | + children: [ | ||
| 122 | + Expanded( | ||
| 123 | + child: SingleChildScrollView( | ||
| 124 | + child: Column( | ||
| 125 | + crossAxisAlignment: CrossAxisAlignment.start, | ||
| 126 | + children: [ | ||
| 127 | + Container( | ||
| 128 | + padding: EdgeInsets.symmetric( | ||
| 129 | + horizontal: w(16), | ||
| 130 | + vertical: w(12), | ||
| 131 | + ), | ||
| 132 | + child: Column( | ||
| 133 | + crossAxisAlignment: CrossAxisAlignment.start, | ||
| 134 | + children: [ | ||
| 135 | + Text( | ||
| 136 | + '选择日期:', | ||
| 137 | + style: TextStyle( | ||
| 138 | + color: MyColours.color_515151, fontSize: font(16)), | ||
| 139 | + ), | ||
| 140 | + VEmptyView(30), | ||
| 141 | + Row( | ||
| 142 | + children: [ | ||
| 143 | + HEmptyView(32), | ||
| 144 | + _itemRadioWidget(isTime, '指定日期', onTap: () { | ||
| 145 | + if (!isTime) { | ||
| 146 | + setState(() { | ||
| 147 | + isTime = true; | ||
| 148 | + isWeek = false; | ||
| 149 | + weekShow = '点击选择日期(可多选)'; | ||
| 150 | + //清空选择的周数据 | ||
| 151 | + weekData = []; | ||
| 152 | + }); | ||
| 153 | + } | ||
| 154 | + }), | ||
| 155 | + HEmptyView(80), | ||
| 156 | + _itemRadioWidget(isWeek, '每周', onTap: () { | ||
| 157 | + if (!isWeek) { | ||
| 158 | + setState(() { | ||
| 159 | + isWeek = true; | ||
| 160 | + isTime = false; | ||
| 161 | + weekShow = '点击选择日期(可多选)'; | ||
| 162 | + //清空选择的日期数据 | ||
| 163 | + }); | ||
| 164 | + } | ||
| 165 | + }), | ||
| 166 | + HEmptyView(30), | ||
| 167 | + ], | ||
| 168 | + ), | ||
| 169 | + VEmptyView(30), | ||
| 170 | + _select1(weekShow, () async { | ||
| 171 | + if (isWeek) { | ||
| 172 | + FocusScope.of(context) | ||
| 173 | + .requestFocus(FocusNode()); //点击空白处隐藏键盘 | ||
| 174 | + //弹出时间选择器 | ||
| 175 | + // showPickerDateTime(context); | ||
| 176 | + // showDateSelWidget = false; | ||
| 177 | + | ||
| 178 | + List<FilterBtnModel> data = | ||
| 179 | + await DialogUtil.openWeekSelectModalBottomSheet( | ||
| 180 | + context, weekData); | ||
| 181 | + if (data != null) { | ||
| 182 | + //改变了 | ||
| 183 | + weekData = []; | ||
| 184 | + weekData.addAll(data); | ||
| 185 | + weekShow = ''; | ||
| 186 | + | ||
| 187 | + weekData.forEach((element) { | ||
| 188 | + if (element.select) { | ||
| 189 | + weekShow += '${element.title} '; | ||
| 190 | + } | ||
| 191 | + }); | ||
| 192 | + if (weekShow.endsWith(' ')) { | ||
| 193 | + weekShow = | ||
| 194 | + weekShow.substring(0, weekShow.length - 1); | ||
| 195 | + } | ||
| 196 | + if (weekShow == '') { | ||
| 197 | + weekShow = '点击选择日期(可多选)'; | ||
| 198 | + } | ||
| 199 | + | ||
| 200 | + setState(() {}); | ||
| 201 | + } | ||
| 202 | + } else { | ||
| 203 | + DateTime dateTime = DateTime.now(); | ||
| 204 | + DialogUtil.showCalendarDialogMultiple(context, dateTime) | ||
| 205 | + .then((day) async { | ||
| 206 | + if (day != null) { | ||
| 207 | + // createDateText1(context, day); | ||
| 208 | + // bool success = | ||
| 209 | + // await tableManagerModel.getTableListOrReserve( | ||
| 210 | + // context, | ||
| 211 | + // currTimeIndex, | ||
| 212 | + // dateTime, | ||
| 213 | + // selectNumber, | ||
| 214 | + // showLoading: true, | ||
| 215 | + // ); | ||
| 216 | + } | ||
| 217 | + }); | ||
| 218 | + } | ||
| 219 | + }), | ||
| 220 | + ], | ||
| 221 | + ), | ||
| 222 | + ), | ||
| 223 | + VEmptyView(24), | ||
| 224 | + Padding( | ||
| 225 | + padding: EdgeInsets.only(left: w(16)), | ||
| 226 | + child: MyDivider( | ||
| 227 | + double.infinity, | ||
| 228 | + w(1), | ||
| 229 | + color: MyColours.color_DBDBDB, | ||
| 230 | + ), | ||
| 231 | + ) | ||
| 232 | + ], | ||
| 233 | + ), | ||
| 234 | + )), | ||
| 235 | + Container( | ||
| 236 | + color: MyColours.color_ffffff, | ||
| 237 | + padding: EdgeInsets.only( | ||
| 238 | + left: w(45), top: w(12), bottom: w(25), right: w(45)), | ||
| 239 | + child: RoundButton( | ||
| 240 | + text: '保存', | ||
| 241 | + // width: ScreenUtil().setWidth(280 * 2), | ||
| 242 | + height: w(41), | ||
| 243 | + radius: r(5), | ||
| 244 | + isBold: true, | ||
| 245 | + fontSize: 32, | ||
| 246 | + onPressed: () {})) | ||
| 247 | + ], | ||
| 248 | + ), | ||
| 249 | + ); | ||
| 250 | + } | ||
| 251 | +} |
| 1 | import 'package:flutter/material.dart'; | 1 | import 'package:flutter/material.dart'; |
| 2 | import 'package:one_key/res/colors.dart'; | 2 | import 'package:one_key/res/colors.dart'; |
| 3 | +import 'package:one_key/route/navigator_util.dart'; | ||
| 4 | +import 'package:one_key/widgets/h_empty_view.dart'; | ||
| 3 | import 'package:one_key/widgets/system_app_bar.dart'; | 5 | import 'package:one_key/widgets/system_app_bar.dart'; |
| 4 | import 'package:one_key/widgets/v_empty_view.dart'; | 6 | import 'package:one_key/widgets/v_empty_view.dart'; |
| 5 | 7 | ||
| @@ -21,26 +23,40 @@ class BookTimeSettingListPage extends StatefulWidget { | @@ -21,26 +23,40 @@ class BookTimeSettingListPage extends StatefulWidget { | ||
| 21 | class _BookTimeSettingListPageState extends State<BookTimeSettingListPage> { | 23 | class _BookTimeSettingListPageState extends State<BookTimeSettingListPage> { |
| 22 | List<Widget> listWidget() { | 24 | List<Widget> listWidget() { |
| 23 | List<Widget> datas = []; | 25 | List<Widget> datas = []; |
| 24 | - for (int i = 0; i < 10; i++) { | ||
| 25 | - datas.add( | ||
| 26 | - Text( | ||
| 27 | - '25-01-28 除夕', | 26 | + for (int i = 0; i < 3; i++) { |
| 27 | + datas.add(Container( | ||
| 28 | + child: Text( | ||
| 29 | + '2024-01-28 除夕', | ||
| 28 | style: TextStyle(fontSize: font(10), color: MyColours.color_515151), | 30 | style: TextStyle(fontSize: font(10), color: MyColours.color_515151), |
| 29 | ), | 31 | ), |
| 30 | - ); | 32 | + )); |
| 31 | } | 33 | } |
| 32 | return datas; | 34 | return datas; |
| 33 | } | 35 | } |
| 34 | 36 | ||
| 35 | - List<Widget> listWidgetTime() { | 37 | + List<Widget> listWidgetTime() { |
| 36 | List<Widget> datas = []; | 38 | List<Widget> datas = []; |
| 37 | - for (int i = 0; i < 10; i++) { | ||
| 38 | - datas.add( | ||
| 39 | - Text( | ||
| 40 | - '25-01-28 除夕', | ||
| 41 | - style: TextStyle(fontSize: font(10), color: MyColours.color_515151), | 39 | + for (int i = 0; i < 3; i++) { |
| 40 | + datas.add(Padding( | ||
| 41 | + padding: EdgeInsets.only(left: w(12), right: w(12), bottom: w(5)), | ||
| 42 | + child: Row( | ||
| 43 | + // mainAxisAlignment: MainAxisAlignment.spaceBetween, | ||
| 44 | + children: [ | ||
| 45 | + Text( | ||
| 46 | + '午餐', | ||
| 47 | + style: | ||
| 48 | + TextStyle(fontSize: font(10), color: MyColours.color_999999), | ||
| 49 | + ), | ||
| 50 | + Spacer(), | ||
| 51 | + Text( | ||
| 52 | + '10:00-13:00', | ||
| 53 | + style: | ||
| 54 | + TextStyle(fontSize: font(10), color: MyColours.color_999999), | ||
| 55 | + ), | ||
| 56 | + HEmptyView(80) | ||
| 57 | + ], | ||
| 42 | ), | 58 | ), |
| 43 | - ); | 59 | + )); |
| 44 | } | 60 | } |
| 45 | return datas; | 61 | return datas; |
| 46 | } | 62 | } |
| @@ -62,33 +78,63 @@ class _BookTimeSettingListPageState extends State<BookTimeSettingListPage> { | @@ -62,33 +78,63 @@ class _BookTimeSettingListPageState extends State<BookTimeSettingListPage> { | ||
| 62 | margin: EdgeInsets.only( | 78 | margin: EdgeInsets.only( |
| 63 | left: w(20), right: w(20), bottom: w(10)), | 79 | left: w(20), right: w(20), bottom: w(10)), |
| 64 | decoration: BoxDecoration( | 80 | decoration: BoxDecoration( |
| 81 | + color: MyColours.color_ffffff, | ||
| 82 | + boxShadow: [ | ||
| 83 | + BoxShadow( | ||
| 84 | + offset: Offset(0, w(4)), | ||
| 85 | + blurRadius: r(4), | ||
| 86 | + color: MyColours.color_40000000) | ||
| 87 | + ], | ||
| 65 | borderRadius: BorderRadius.circular(r(8))), | 88 | borderRadius: BorderRadius.circular(r(8))), |
| 66 | child: Column( | 89 | child: Column( |
| 90 | + crossAxisAlignment: CrossAxisAlignment.start, | ||
| 67 | children: [ | 91 | children: [ |
| 68 | Container( | 92 | Container( |
| 93 | + padding: EdgeInsets.symmetric(horizontal: w(12)), | ||
| 69 | height: w(33), | 94 | height: w(33), |
| 70 | decoration: BoxDecoration( | 95 | decoration: BoxDecoration( |
| 71 | - color: MyColours.color_438E93, | 96 | + color: true |
| 97 | + ? MyColours.color_438E93 | ||
| 98 | + : MyColours.color_999999, | ||
| 72 | borderRadius: BorderRadius.only( | 99 | borderRadius: BorderRadius.only( |
| 73 | topLeft: Radius.circular(r(8)), | 100 | topLeft: Radius.circular(r(8)), |
| 74 | topRight: Radius.circular(r(8)), | 101 | topRight: Radius.circular(r(8)), |
| 75 | )), | 102 | )), |
| 76 | child: Row( | 103 | child: Row( |
| 104 | + mainAxisAlignment: MainAxisAlignment.spaceBetween, | ||
| 77 | children: [ | 105 | children: [ |
| 78 | Text( | 106 | Text( |
| 79 | '每周固定/指定日期', | 107 | '每周固定/指定日期', |
| 80 | style: TextStyle( | 108 | style: TextStyle( |
| 81 | fontSize: font(18), | 109 | fontSize: font(18), |
| 82 | color: MyColours.color_ffffff), | 110 | color: MyColours.color_ffffff), |
| 111 | + ), | ||
| 112 | + RoundButton( | ||
| 113 | + width: w(32), | ||
| 114 | + height: w(19), | ||
| 115 | + radius: r(5), | ||
| 116 | + text: true ? '停用' : '启用', | ||
| 117 | + fontSize: 24, | ||
| 118 | + textColor: MyColours.color_ffffff, | ||
| 119 | + gradientStart: Colors.transparent, | ||
| 120 | + gradientEnd: Colors.transparent, | ||
| 121 | + borderColor: MyColours.color_ffffff, | ||
| 122 | + // onPressed: widget.onPressedSwich, | ||
| 83 | ) | 123 | ) |
| 84 | ], | 124 | ], |
| 85 | ), | 125 | ), |
| 86 | ), | 126 | ), |
| 87 | VEmptyView(16), | 127 | VEmptyView(16), |
| 88 | - Wrap( | ||
| 89 | - spacing: w(10), | ||
| 90 | - children: listWidget(), | ||
| 91 | - ), | 128 | + Padding( |
| 129 | + padding: EdgeInsets.symmetric(horizontal: w(12)), | ||
| 130 | + child: Wrap( | ||
| 131 | + spacing: w(5), | ||
| 132 | + children: listWidget(), | ||
| 133 | + )), | ||
| 134 | + VEmptyView(16), | ||
| 135 | + Column( | ||
| 136 | + children: listWidgetTime(), | ||
| 137 | + ) | ||
| 92 | ], | 138 | ], |
| 93 | ), | 139 | ), |
| 94 | ); | 140 | ); |
| @@ -98,13 +144,15 @@ class _BookTimeSettingListPageState extends State<BookTimeSettingListPage> { | @@ -98,13 +144,15 @@ class _BookTimeSettingListPageState extends State<BookTimeSettingListPage> { | ||
| 98 | padding: EdgeInsets.only( | 144 | padding: EdgeInsets.only( |
| 99 | left: w(45), top: w(12), bottom: w(25), right: w(45)), | 145 | left: w(45), top: w(12), bottom: w(25), right: w(45)), |
| 100 | child: RoundButton( | 146 | child: RoundButton( |
| 101 | - text: '保存', | 147 | + text: '创建新的多时段预订规则', |
| 102 | // width: ScreenUtil().setWidth(280 * 2), | 148 | // width: ScreenUtil().setWidth(280 * 2), |
| 103 | height: w(41), | 149 | height: w(41), |
| 104 | radius: r(5), | 150 | radius: r(5), |
| 105 | isBold: true, | 151 | isBold: true, |
| 106 | fontSize: 32, | 152 | fontSize: 32, |
| 107 | - onPressed: () {})) | 153 | + onPressed: () { |
| 154 | + NavigatorUtil.goBookTimeSettingEditPage(context); | ||
| 155 | + })) | ||
| 108 | ], | 156 | ], |
| 109 | ), | 157 | ), |
| 110 | ); | 158 | ); |
| @@ -2278,5 +2278,18 @@ class NavigatorUtil { | @@ -2278,5 +2278,18 @@ class NavigatorUtil { | ||
| 2278 | replace: replace); | 2278 | replace: replace); |
| 2279 | } | 2279 | } |
| 2280 | 2280 | ||
| 2281 | + | ||
| 2282 | + | ||
| 2283 | + | ||
| 2284 | +///多时段预订设置列表编辑页面 | ||
| 2285 | + static Future<dynamic> goBookTimeSettingEditPage( | ||
| 2286 | + BuildContext context, { | ||
| 2287 | + | ||
| 2288 | + replace = false, | ||
| 2289 | + }) { | ||
| 2290 | + return _navigateTo(context, "${Routes.book_time_setting_edit_page}", | ||
| 2291 | + replace: replace); | ||
| 2292 | + } | ||
| 2293 | + | ||
| 2281 | 2294 | ||
| 2282 | } | 2295 | } |
| @@ -199,6 +199,7 @@ import '../pages/login/collect_store_info_page.dart'; | @@ -199,6 +199,7 @@ import '../pages/login/collect_store_info_page.dart'; | ||
| 199 | import '../pages/login/complete_create_store.dart'; | 199 | import '../pages/login/complete_create_store.dart'; |
| 200 | import '../pages/login/web_page.dart'; | 200 | import '../pages/login/web_page.dart'; |
| 201 | import '../pages/message/message_recharge_info_page.dart'; | 201 | import '../pages/message/message_recharge_info_page.dart'; |
| 202 | +import '../pages/my/book_time_setting/book_time_setting_edit_page.dart'; | ||
| 202 | import '../pages/my/book_time_setting/book_time_setting_list_page.dart'; | 203 | import '../pages/my/book_time_setting/book_time_setting_list_page.dart'; |
| 203 | import '../pages/my/comment_manage/comment_manage_home_page.dart'; | 204 | import '../pages/my/comment_manage/comment_manage_home_page.dart'; |
| 204 | import '../pages/my/customer_type/my_customer/my_customer_home_page.dart'; | 205 | import '../pages/my/customer_type/my_customer/my_customer_home_page.dart'; |
| @@ -3911,3 +3912,21 @@ var bookTimeSettingListPageHandle = new Handler( | @@ -3911,3 +3912,21 @@ var bookTimeSettingListPageHandle = new Handler( | ||
| 3911 | child: BookTimeSettingListPage()); | 3912 | child: BookTimeSettingListPage()); |
| 3912 | }); | 3913 | }); |
| 3913 | 3914 | ||
| 3915 | + | ||
| 3916 | + | ||
| 3917 | +///多时段预订设置编辑页面 | ||
| 3918 | +var bookTimeSettingEditPageHandle = new Handler( | ||
| 3919 | + handlerFunc: (BuildContext context, Map<String, List<Object>> params) { | ||
| 3920 | + // String rid = params["rid"].first; | ||
| 3921 | + // // String smsTemplate = params["smsTemplate"].first; | ||
| 3922 | + // CouponUse use = CouponUse.fromJson( | ||
| 3923 | + // json.decode(FluroConvertUtils.fluroCnParamsDecode(params["use"].first))); | ||
| 3924 | + // CouponSunModel couponSunModel = CouponSunModel.fromJson(json.decode( | ||
| 3925 | + // FluroConvertUtils.fluroCnParamsDecode(params["couponSunModel"].first))); | ||
| 3926 | + return ChangeNotifierProvider<MarketingCenterProvider>( | ||
| 3927 | + create: (_) => MarketingCenterProvider(), | ||
| 3928 | + child: BookTimeSettingEditPage()); | ||
| 3929 | +}); | ||
| 3930 | + | ||
| 3931 | + | ||
| 3932 | + |
| @@ -394,6 +394,13 @@ class Routes { | @@ -394,6 +394,13 @@ class Routes { | ||
| 394 | 394 | ||
| 395 | static String book_time_setting_list_page = | 395 | static String book_time_setting_list_page = |
| 396 | "/book_time_setting_list_page"; //多时段预订列表 | 396 | "/book_time_setting_list_page"; //多时段预订列表 |
| 397 | + | ||
| 398 | + | ||
| 399 | + static String book_time_setting_edit_page = | ||
| 400 | + "/book_time_setting_edit_page"; //多时段预订列表编辑页面 | ||
| 401 | + | ||
| 402 | + | ||
| 403 | + | ||
| 397 | 404 | ||
| 398 | 405 | ||
| 399 | 406 | ||
| @@ -742,6 +749,11 @@ router.define(select_table_f_or_reserve, handler: handleSelectTableFOrReserveHan | @@ -742,6 +749,11 @@ router.define(select_table_f_or_reserve, handler: handleSelectTableFOrReserveHan | ||
| 742 | router.define(book_time_setting_list_page, handler:bookTimeSettingListPageHandle); | 749 | router.define(book_time_setting_list_page, handler:bookTimeSettingListPageHandle); |
| 743 | 750 | ||
| 744 | 751 | ||
| 752 | + router.define(book_time_setting_edit_page, handler:bookTimeSettingEditPageHandle); | ||
| 753 | + | ||
| 754 | + | ||
| 755 | + | ||
| 756 | + | ||
| 745 | 757 | ||
| 746 | 758 | ||
| 747 | } | 759 | } |
| @@ -7255,6 +7255,366 @@ class DialogUtil { | @@ -7255,6 +7255,366 @@ class DialogUtil { | ||
| 7255 | } | 7255 | } |
| 7256 | } | 7256 | } |
| 7257 | 7257 | ||
| 7258 | + //显示日历弹框 | ||
| 7259 | + static Future<DateTime> showCalendarDialogMultiple( | ||
| 7260 | + BuildContext context, DateTime selectDateTime) { | ||
| 7261 | + CalendarController _calendarController = CalendarController(); | ||
| 7262 | + final _selectedDay = DateTime.now(); | ||
| 7263 | + Map<DateTime, List> _events = { | ||
| 7264 | + _selectedDay: ['Event A7', 'Event B7', 'Event C7', 'Event D7'], | ||
| 7265 | + _selectedDay.add(Duration(days: 1)): [ | ||
| 7266 | + 'Event A8', | ||
| 7267 | + 'Event B8', | ||
| 7268 | + 'Event C8', | ||
| 7269 | + 'Event D8' | ||
| 7270 | + ], | ||
| 7271 | + _selectedDay.add(Duration(days: 2)): | ||
| 7272 | + Set.from(['Event A9', 'Event A9', 'Event B9']).toList(), | ||
| 7273 | + }; | ||
| 7274 | + return showModalBottomSheet<DateTime>( | ||
| 7275 | + context: context, | ||
| 7276 | + isScrollControlled: true, | ||
| 7277 | + builder: (BuildContext context) { | ||
| 7278 | + BuildContext dialogContext = context; | ||
| 7279 | + Widget widget = StatefulBuilder(builder: (context, _setState) { | ||
| 7280 | + return Container( | ||
| 7281 | + color: MyColours.color_ffffff, | ||
| 7282 | + child: Column( | ||
| 7283 | + mainAxisSize: MainAxisSize.min, | ||
| 7284 | + children: <Widget>[ | ||
| 7285 | + TableCalendar( | ||
| 7286 | + // rowHeight: ScreenUtil().setWidth(100), | ||
| 7287 | + calendarController: _calendarController, | ||
| 7288 | + initialSelectedDay: _selectedDay, | ||
| 7289 | + onDaySelected: (day, events, holidays) { | ||
| 7290 | + Navigator.of(dialogContext).pop(day); | ||
| 7291 | + }, | ||
| 7292 | + // holidays: _holidays, | ||
| 7293 | + availableGestures: AvailableGestures.none, | ||
| 7294 | + events: _events, | ||
| 7295 | + locale: "zh_CN", | ||
| 7296 | + initialCalendarFormat: CalendarFormat.month, | ||
| 7297 | + headerStyle: HeaderStyle( | ||
| 7298 | + decoration: | ||
| 7299 | + BoxDecoration(color: MyColours.color_2bb5b7), | ||
| 7300 | + headerPadding: EdgeInsets.zero, | ||
| 7301 | + formatButtonVisible: false, | ||
| 7302 | + centerHeaderTitle: false, | ||
| 7303 | + titleTextBuilder: (dateTime, _) { | ||
| 7304 | + return dateTime.year.toString() + | ||
| 7305 | + "年-" + | ||
| 7306 | + Utils.addZeroNumber(dateTime.month) + | ||
| 7307 | + "月"; | ||
| 7308 | + }, | ||
| 7309 | + titleTextStyle: TextStyle( | ||
| 7310 | + color: MyColours.color_ffffff, | ||
| 7311 | + fontSize: ScreenUtil().setSp(30)), | ||
| 7312 | + leftChevronIcon: const Icon(Icons.chevron_left, | ||
| 7313 | + color: Colors.white), | ||
| 7314 | + rightChevronIcon: const Icon(Icons.chevron_right, | ||
| 7315 | + color: Colors.white), | ||
| 7316 | + ), | ||
| 7317 | + calendarStyle: CalendarStyle( | ||
| 7318 | + contentPadding: EdgeInsets.only( | ||
| 7319 | + bottom: ScreenUtil().setWidth(8)), | ||
| 7320 | + weekdayStyle: TextStyle( | ||
| 7321 | + color: MyColours.color_2bb5b7, | ||
| 7322 | + fontSize: ScreenUtil().setSp(32)), | ||
| 7323 | + weekendStyle: TextStyle( | ||
| 7324 | + color: MyColours.color_f49a5e, | ||
| 7325 | + fontSize: ScreenUtil().setSp(32)), | ||
| 7326 | + selectedColor: MyColours.color_2bb5b7, | ||
| 7327 | + outsideDaysVisible: false, | ||
| 7328 | + ), | ||
| 7329 | + builders: CalendarBuilders( | ||
| 7330 | + dowWeekdayBuilder: (context, weekday) { | ||
| 7331 | + return Container( | ||
| 7332 | + color: MyColours.color_2bb5b7, | ||
| 7333 | + alignment: Alignment.center, | ||
| 7334 | + margin: EdgeInsets.only( | ||
| 7335 | + bottom: ScreenUtil().setWidth(30)), | ||
| 7336 | + padding: EdgeInsets.symmetric( | ||
| 7337 | + vertical: ScreenUtil().setWidth(15)), | ||
| 7338 | + child: Text( | ||
| 7339 | + weekday, | ||
| 7340 | + style: TextStyle( | ||
| 7341 | + color: MyColours.color_97e9ea, | ||
| 7342 | + fontSize: ScreenUtil().setSp(28)), | ||
| 7343 | + ), | ||
| 7344 | + ); | ||
| 7345 | + }, | ||
| 7346 | + dayBuilder: (context, date, _) { | ||
| 7347 | + return Container( | ||
| 7348 | + // height: ScreenUtil().setWidth(210), | ||
| 7349 | + decoration: BoxDecoration( | ||
| 7350 | + // shape: BoxShape.circle, | ||
| 7351 | + // color: Colors.blue, | ||
| 7352 | + ), | ||
| 7353 | + // alignment: Alignment.center, | ||
| 7354 | + // margin: EdgeInsets.fromLTRB( | ||
| 7355 | + // ScreenUtil().setWidth(12), | ||
| 7356 | + // ScreenUtil().setWidth(12), | ||
| 7357 | + // ScreenUtil().setWidth(12), | ||
| 7358 | + // ScreenUtil().setWidth(10)), | ||
| 7359 | + // padding: EdgeInsets.symmetric( | ||
| 7360 | + // // horizontal: ScreenUtil().setWidth(12), | ||
| 7361 | + // vertical: ScreenUtil().setWidth(8), | ||
| 7362 | + // ), | ||
| 7363 | + child: Column( | ||
| 7364 | + mainAxisAlignment: MainAxisAlignment.center, | ||
| 7365 | + children: [ | ||
| 7366 | + Text( | ||
| 7367 | + // "${_parseDateDay(date)}", | ||
| 7368 | + '${Utils.addZeroNumber(date.day)}', | ||
| 7369 | + style: TextStyle().copyWith( | ||
| 7370 | + fontSize: ScreenUtil().setSp(32), | ||
| 7371 | + color: MyColours.color_353535, | ||
| 7372 | + fontWeight: FontWeight.bold)), | ||
| 7373 | + // Text( | ||
| 7374 | + // // "${_parseDateDay(date)}", | ||
| 7375 | + // '${Utils.getLunarSpecialDate(date)}', | ||
| 7376 | + // style: TextStyle().copyWith( | ||
| 7377 | + // fontSize: ScreenUtil().setSp(22), | ||
| 7378 | + // color: MyColours.color_353535), | ||
| 7379 | + // ), | ||
| 7380 | + Text( | ||
| 7381 | + "${_parseDateDay(date)}", | ||
| 7382 | + style: TextStyle().copyWith( | ||
| 7383 | + fontSize: ScreenUtil().setSp(18), | ||
| 7384 | + color: MyColours.color_353535), | ||
| 7385 | + ), | ||
| 7386 | + ], | ||
| 7387 | + ), | ||
| 7388 | + ); | ||
| 7389 | + }, | ||
| 7390 | + selectedDayBuilder: (context, date, _) { | ||
| 7391 | + return Container( | ||
| 7392 | + // alignment: Alignment.center, | ||
| 7393 | + // margin: EdgeInsets.fromLTRB( | ||
| 7394 | + // ScreenUtil().setWidth(12), | ||
| 7395 | + // ScreenUtil().setWidth(12), | ||
| 7396 | + // ScreenUtil().setWidth(12), | ||
| 7397 | + // ScreenUtil().setWidth(32)), | ||
| 7398 | + padding: EdgeInsets.only( | ||
| 7399 | + bottom: ScreenUtil().setWidth(10), | ||
| 7400 | + left: ScreenUtil().setWidth(5), | ||
| 7401 | + right: ScreenUtil().setWidth(5), | ||
| 7402 | + top: ScreenUtil().setWidth(10)), | ||
| 7403 | + child: Container( | ||
| 7404 | + decoration: BoxDecoration( | ||
| 7405 | + borderRadius: BorderRadius.circular( | ||
| 7406 | + ScreenUtil().setWidth(10)), | ||
| 7407 | + color: Color.fromRGBO(42, 110, 109, 1)), | ||
| 7408 | + child: Column( | ||
| 7409 | + mainAxisAlignment: MainAxisAlignment.center, | ||
| 7410 | + children: [ | ||
| 7411 | + Text( | ||
| 7412 | + // "${_parseDateDay(date)}", | ||
| 7413 | + '${Utils.addZeroNumber(date.day)}', | ||
| 7414 | + style: TextStyle().copyWith( | ||
| 7415 | + color: MyColours.color_ffffff, | ||
| 7416 | + fontSize: ScreenUtil().setSp(32), | ||
| 7417 | + fontWeight: FontWeight.bold), | ||
| 7418 | + ), | ||
| 7419 | + Text( | ||
| 7420 | + "${_parseDateDay(date)}", | ||
| 7421 | + // '${Utils.lunarCalendarHolidaysShow(date)}', | ||
| 7422 | + style: TextStyle().copyWith( | ||
| 7423 | + fontSize: ScreenUtil().setSp(22), | ||
| 7424 | + color: MyColours.color_ffffff), | ||
| 7425 | + ) | ||
| 7426 | + ], | ||
| 7427 | + ), | ||
| 7428 | + ), | ||
| 7429 | + ); | ||
| 7430 | + }, | ||
| 7431 | + todayDayBuilder: (context, date, _) { | ||
| 7432 | + return Container( | ||
| 7433 | + // alignment: Alignment.center, | ||
| 7434 | + // margin: EdgeInsets.fromLTRB( | ||
| 7435 | + // ScreenUtil().setWidth(12), | ||
| 7436 | + // ScreenUtil().setWidth(12), | ||
| 7437 | + // ScreenUtil().setWidth(12), | ||
| 7438 | + // ScreenUtil().setWidth(32)), | ||
| 7439 | + padding: EdgeInsets.only( | ||
| 7440 | + bottom: ScreenUtil().setWidth(10), | ||
| 7441 | + left: ScreenUtil().setWidth(5), | ||
| 7442 | + right: ScreenUtil().setWidth(5), | ||
| 7443 | + top: ScreenUtil().setWidth(10)), | ||
| 7444 | + child: Container( | ||
| 7445 | + decoration: BoxDecoration( | ||
| 7446 | + borderRadius: BorderRadius.circular( | ||
| 7447 | + ScreenUtil().setWidth(10)), | ||
| 7448 | + color: MyColours.color_2bb5b7), | ||
| 7449 | + child: Column( | ||
| 7450 | + mainAxisAlignment: MainAxisAlignment.center, | ||
| 7451 | + children: [ | ||
| 7452 | + Text( | ||
| 7453 | + // "${_parseDateDay(date)}", | ||
| 7454 | + '${Utils.addZeroNumber(date.day)}', | ||
| 7455 | + style: TextStyle().copyWith( | ||
| 7456 | + color: MyColours.color_ffffff, | ||
| 7457 | + fontSize: ScreenUtil().setSp(32), | ||
| 7458 | + fontWeight: FontWeight.bold), | ||
| 7459 | + ), | ||
| 7460 | + Text( | ||
| 7461 | + "${_parseDateDay(date)}", | ||
| 7462 | + // '${Utils.lunarCalendarHolidaysShow(date)}', | ||
| 7463 | + style: TextStyle().copyWith( | ||
| 7464 | + fontSize: ScreenUtil().setSp(22), | ||
| 7465 | + color: MyColours.color_ffffff), | ||
| 7466 | + ) | ||
| 7467 | + ], | ||
| 7468 | + ), | ||
| 7469 | + ), | ||
| 7470 | + ); | ||
| 7471 | + // return Container( | ||
| 7472 | + // decoration: BoxDecoration( | ||
| 7473 | + // shape: BoxShape.circle, | ||
| 7474 | + // border: Border.all( | ||
| 7475 | + // color: MyColours.color_2bb5b7, | ||
| 7476 | + // width: ScreenUtil().setWidth(2))), | ||
| 7477 | + // alignment: Alignment.center, | ||
| 7478 | + // margin: EdgeInsets.fromLTRB( | ||
| 7479 | + // ScreenUtil().setWidth(12), | ||
| 7480 | + // ScreenUtil().setWidth(12), | ||
| 7481 | + // ScreenUtil().setWidth(12), | ||
| 7482 | + // ScreenUtil().setWidth(32)), | ||
| 7483 | + // padding: EdgeInsets.only( | ||
| 7484 | + // bottom: ScreenUtil().setWidth(8), | ||
| 7485 | + // left: ScreenUtil().setWidth(16), | ||
| 7486 | + // right: ScreenUtil().setWidth(16), | ||
| 7487 | + // top: ScreenUtil().setWidth(8)), | ||
| 7488 | + // child: Text( | ||
| 7489 | + // // '今', | ||
| 7490 | + // '${Utils.addZeroNumber(date.day)}', | ||
| 7491 | + // style: TextStyle().copyWith( | ||
| 7492 | + // fontSize: ScreenUtil().setSp(32), | ||
| 7493 | + // color: MyColours.color_2bb5b7), | ||
| 7494 | + // ), | ||
| 7495 | + // ); | ||
| 7496 | + }, | ||
| 7497 | + markersBuilder: (context, date, events, holidays) { | ||
| 7498 | + final children = <Widget>[]; | ||
| 7499 | + | ||
| 7500 | + // if (events.isNotEmpty) { | ||
| 7501 | + // children.add( | ||
| 7502 | + // Positioned( | ||
| 7503 | + // right: 1, | ||
| 7504 | + // bottom: 1, | ||
| 7505 | + // child: _buildEventsMarker(date, events), | ||
| 7506 | + // ), | ||
| 7507 | + // ); | ||
| 7508 | + // } | ||
| 7509 | + | ||
| 7510 | + // if (holidays.isNotEmpty) { | ||
| 7511 | + // children.add( | ||
| 7512 | + // Positioned( | ||
| 7513 | + // right: ScreenUtil().setWidth(27), | ||
| 7514 | + // bottom: 0, | ||
| 7515 | + // top: ScreenUtil().setWidth(30), | ||
| 7516 | + // child: buildMarker(date)), | ||
| 7517 | + // Align( | ||
| 7518 | + // alignment: Alignment.bottomCenter, | ||
| 7519 | + // child: buildMarker(date), | ||
| 7520 | + // ) | ||
| 7521 | + // ); | ||
| 7522 | + // } | ||
| 7523 | + | ||
| 7524 | + return []; | ||
| 7525 | + }, | ||
| 7526 | + // singleMarkerBuilder: (context, dateTime, event) { | ||
| 7527 | + // return Container( | ||
| 7528 | + // width: ScreenUtil().setWidth(6), | ||
| 7529 | + // height: ScreenUtil().setWidth(6), | ||
| 7530 | + // margin: | ||
| 7531 | + // const EdgeInsets.symmetric(horizontal: 0.3), | ||
| 7532 | + // decoration: BoxDecoration( | ||
| 7533 | + // shape: BoxShape.circle, | ||
| 7534 | + // color: MyColours.color_ff0000, | ||
| 7535 | + // ), | ||
| 7536 | + // ); | ||
| 7537 | + // }, | ||
| 7538 | + ), | ||
| 7539 | + ), | ||
| 7540 | + VEmptyView(4), | ||
| 7541 | + Row( | ||
| 7542 | + mainAxisAlignment: MainAxisAlignment.spaceEvenly, | ||
| 7543 | + children: [ | ||
| 7544 | + RoundButton( | ||
| 7545 | + onPressed: () async { | ||
| 7546 | + _calendarController | ||
| 7547 | + .setSelectedDay(DateTime.now()); | ||
| 7548 | + _setState(() {}); | ||
| 7549 | + }, | ||
| 7550 | + text: '回到今天', | ||
| 7551 | + fontSize: 28, | ||
| 7552 | + isBold: false, | ||
| 7553 | + height: ScreenUtil().setWidth(70), | ||
| 7554 | + width: ScreenUtil().setWidth(220), | ||
| 7555 | + gradientStart: MyColours.color_2bb5b7, | ||
| 7556 | + gradientEnd: MyColours.color_2bb5b7, | ||
| 7557 | + radius: ScreenUtil().setWidth(10), | ||
| 7558 | + ), | ||
| 7559 | + RoundButton( | ||
| 7560 | + onPressed: () async { | ||
| 7561 | + Navigator.pop(context); | ||
| 7562 | + }, | ||
| 7563 | + text: '取消', | ||
| 7564 | + fontSize: 28, | ||
| 7565 | + isBold: false, | ||
| 7566 | + textColor: MyColours.color_333333, | ||
| 7567 | + borderColor: Color.fromRGBO(119, 119, 119, 1), | ||
| 7568 | + height: ScreenUtil().setWidth(70), | ||
| 7569 | + width: ScreenUtil().setWidth(220), | ||
| 7570 | + gradientStart: Colors.transparent, | ||
| 7571 | + gradientEnd: Colors.transparent, | ||
| 7572 | + radius: ScreenUtil().setWidth(10), | ||
| 7573 | + ) | ||
| 7574 | + ], | ||
| 7575 | + ), | ||
| 7576 | + VEmptyView(40) | ||
| 7577 | + ], | ||
| 7578 | + )) | ||
| 7579 | + | ||
| 7580 | + // Positioned( | ||
| 7581 | + // right: ScreenUtil().setWidth(62), | ||
| 7582 | + // bottom: ScreenUtil().setHeight(20), | ||
| 7583 | + // child: Container( | ||
| 7584 | + // child: GestureDetector( | ||
| 7585 | + // onTap: () { | ||
| 7586 | + // _calendarController.setSelectedDay(DateTime.now()); | ||
| 7587 | + // _setState(() {}); | ||
| 7588 | + // }, | ||
| 7589 | + // child: Container( | ||
| 7590 | + // child: ClipOval( | ||
| 7591 | + // child: Container( | ||
| 7592 | + // width: ScreenUtil().setWidth(100), | ||
| 7593 | + // height: ScreenUtil().setWidth(100), | ||
| 7594 | + // alignment: Alignment.center, | ||
| 7595 | + // color: MyColours.color_2bb5b7, | ||
| 7596 | + // child: Text( | ||
| 7597 | + // "回到\n今天", | ||
| 7598 | + // style: TextStyle( | ||
| 7599 | + // color: MyColours.color_ffffff, | ||
| 7600 | + // fontSize: ScreenUtil().setSp(26)), | ||
| 7601 | + // ), | ||
| 7602 | + // )), | ||
| 7603 | + // ), | ||
| 7604 | + // ), | ||
| 7605 | + // ), | ||
| 7606 | + // ) | ||
| 7607 | + // ], | ||
| 7608 | + ; | ||
| 7609 | + }); | ||
| 7610 | + return SizedBox( | ||
| 7611 | + width: double.infinity, | ||
| 7612 | + // height: ScreenUtil().setWidth(975), | ||
| 7613 | + child: widget, | ||
| 7614 | + ); | ||
| 7615 | + }); | ||
| 7616 | + } | ||
| 7617 | + | ||
| 7258 | //显示日历弹框 | 7618 | //显示日历弹框 |
| 7259 | static Future<DateTime> showCalendarDialog( | 7619 | static Future<DateTime> showCalendarDialog( |
| 7260 | BuildContext context, DateTime selectDateTime) { | 7620 | BuildContext context, DateTime selectDateTime) { |
-
Please register or login to post a comment