Showing
21 changed files
with
1128 additions
and
632 deletions
| @@ -409,11 +409,7 @@ | @@ -409,11 +409,7 @@ | ||
| 409 | CODE_SIGN_IDENTITY = "iPhone Developer"; | 409 | CODE_SIGN_IDENTITY = "iPhone Developer"; |
| 410 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; | 410 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; |
| 411 | CODE_SIGN_STYLE = Automatic; | 411 | CODE_SIGN_STYLE = Automatic; |
| 412 | -<<<<<<< HEAD | ||
| 413 | CURRENT_PROJECT_VERSION = 145; | 412 | CURRENT_PROJECT_VERSION = 145; |
| 414 | -======= | ||
| 415 | - CURRENT_PROJECT_VERSION = 146; | ||
| 416 | ->>>>>>> 4ecf950986f1856303c83ccacadc2b15efeb20ac | ||
| 417 | DEVELOPMENT_TEAM = 8J59HM8B82; | 413 | DEVELOPMENT_TEAM = 8J59HM8B82; |
| 418 | ENABLE_BITCODE = NO; | 414 | ENABLE_BITCODE = NO; |
| 419 | FRAMEWORK_SEARCH_PATHS = ( | 415 | FRAMEWORK_SEARCH_PATHS = ( |
| @@ -426,11 +422,7 @@ | @@ -426,11 +422,7 @@ | ||
| 426 | "$(inherited)", | 422 | "$(inherited)", |
| 427 | "$(PROJECT_DIR)/Flutter", | 423 | "$(PROJECT_DIR)/Flutter", |
| 428 | ); | 424 | ); |
| 429 | -<<<<<<< HEAD | ||
| 430 | MARKETING_VERSION = 1.4.5; | 425 | MARKETING_VERSION = 1.4.5; |
| 431 | -======= | ||
| 432 | - MARKETING_VERSION = 1.4.6; | ||
| 433 | ->>>>>>> 4ecf950986f1856303c83ccacadc2b15efeb20ac | ||
| 434 | PRODUCT_BUNDLE_IDENTIFIER = com.naji.reserveLine; | 426 | PRODUCT_BUNDLE_IDENTIFIER = com.naji.reserveLine; |
| 435 | PRODUCT_NAME = "一键订"; | 427 | PRODUCT_NAME = "一键订"; |
| 436 | PROVISIONING_PROFILE_SPECIFIER = ""; | 428 | PROVISIONING_PROFILE_SPECIFIER = ""; |
| @@ -559,11 +551,7 @@ | @@ -559,11 +551,7 @@ | ||
| 559 | CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; | 551 | CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; |
| 560 | CODE_SIGN_IDENTITY = "iPhone Developer"; | 552 | CODE_SIGN_IDENTITY = "iPhone Developer"; |
| 561 | CODE_SIGN_STYLE = Automatic; | 553 | CODE_SIGN_STYLE = Automatic; |
| 562 | -<<<<<<< HEAD | ||
| 563 | CURRENT_PROJECT_VERSION = 145; | 554 | CURRENT_PROJECT_VERSION = 145; |
| 564 | -======= | ||
| 565 | - CURRENT_PROJECT_VERSION = 146; | ||
| 566 | ->>>>>>> 4ecf950986f1856303c83ccacadc2b15efeb20ac | ||
| 567 | DEVELOPMENT_TEAM = 8J59HM8B82; | 555 | DEVELOPMENT_TEAM = 8J59HM8B82; |
| 568 | ENABLE_BITCODE = NO; | 556 | ENABLE_BITCODE = NO; |
| 569 | FRAMEWORK_SEARCH_PATHS = ( | 557 | FRAMEWORK_SEARCH_PATHS = ( |
| @@ -576,11 +564,7 @@ | @@ -576,11 +564,7 @@ | ||
| 576 | "$(inherited)", | 564 | "$(inherited)", |
| 577 | "$(PROJECT_DIR)/Flutter", | 565 | "$(PROJECT_DIR)/Flutter", |
| 578 | ); | 566 | ); |
| 579 | -<<<<<<< HEAD | ||
| 580 | MARKETING_VERSION = 1.4.5; | 567 | MARKETING_VERSION = 1.4.5; |
| 581 | -======= | ||
| 582 | - MARKETING_VERSION = 1.4.6; | ||
| 583 | ->>>>>>> 4ecf950986f1856303c83ccacadc2b15efeb20ac | ||
| 584 | PRODUCT_BUNDLE_IDENTIFIER = com.naji.reserveLine; | 568 | PRODUCT_BUNDLE_IDENTIFIER = com.naji.reserveLine; |
| 585 | PRODUCT_NAME = "一键订"; | 569 | PRODUCT_NAME = "一键订"; |
| 586 | PROVISIONING_PROFILE_SPECIFIER = ""; | 570 | PROVISIONING_PROFILE_SPECIFIER = ""; |
| @@ -600,11 +584,7 @@ | @@ -600,11 +584,7 @@ | ||
| 600 | CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; | 584 | CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; |
| 601 | CODE_SIGN_IDENTITY = "iPhone Developer"; | 585 | CODE_SIGN_IDENTITY = "iPhone Developer"; |
| 602 | CODE_SIGN_STYLE = Automatic; | 586 | CODE_SIGN_STYLE = Automatic; |
| 603 | -<<<<<<< HEAD | ||
| 604 | CURRENT_PROJECT_VERSION = 145; | 587 | CURRENT_PROJECT_VERSION = 145; |
| 605 | -======= | ||
| 606 | - CURRENT_PROJECT_VERSION = 146; | ||
| 607 | ->>>>>>> 4ecf950986f1856303c83ccacadc2b15efeb20ac | ||
| 608 | DEVELOPMENT_TEAM = 8J59HM8B82; | 588 | DEVELOPMENT_TEAM = 8J59HM8B82; |
| 609 | ENABLE_BITCODE = NO; | 589 | ENABLE_BITCODE = NO; |
| 610 | FRAMEWORK_SEARCH_PATHS = ( | 590 | FRAMEWORK_SEARCH_PATHS = ( |
| @@ -617,11 +597,7 @@ | @@ -617,11 +597,7 @@ | ||
| 617 | "$(inherited)", | 597 | "$(inherited)", |
| 618 | "$(PROJECT_DIR)/Flutter", | 598 | "$(PROJECT_DIR)/Flutter", |
| 619 | ); | 599 | ); |
| 620 | -<<<<<<< HEAD | ||
| 621 | MARKETING_VERSION = 1.4.5; | 600 | MARKETING_VERSION = 1.4.5; |
| 622 | -======= | ||
| 623 | - MARKETING_VERSION = 1.4.6; | ||
| 624 | ->>>>>>> 4ecf950986f1856303c83ccacadc2b15efeb20ac | ||
| 625 | PRODUCT_BUNDLE_IDENTIFIER = com.naji.reserveLine; | 601 | PRODUCT_BUNDLE_IDENTIFIER = com.naji.reserveLine; |
| 626 | PRODUCT_NAME = "一键订"; | 602 | PRODUCT_NAME = "一键订"; |
| 627 | PROVISIONING_PROFILE_SPECIFIER = ""; | 603 | PROVISIONING_PROFILE_SPECIFIER = ""; |
| @@ -37,6 +37,7 @@ Future<void> main() async { | @@ -37,6 +37,7 @@ Future<void> main() async { | ||
| 37 | LogUtil.init(isDebug: true, tag: 'ONE_KEY'); | 37 | LogUtil.init(isDebug: true, tag: 'ONE_KEY'); |
| 38 | Provider.debugCheckInvalidValueType = null; | 38 | Provider.debugCheckInvalidValueType = null; |
| 39 | await initializeDateFormatting(); | 39 | await initializeDateFormatting(); |
| 40 | + Utils.changeStatusColor(); | ||
| 40 | SystemChrome.setPreferredOrientations( | 41 | SystemChrome.setPreferredOrientations( |
| 41 | [DeviceOrientation.portraitUp, DeviceOrientation.portraitDown]) | 42 | [DeviceOrientation.portraitUp, DeviceOrientation.portraitDown]) |
| 42 | .then((_) { | 43 | .then((_) { |
lib/models/get_seller_info_model.dart
0 → 100644
| 1 | +import 'package:json_annotation/json_annotation.dart'; | ||
| 2 | + | ||
| 3 | +part 'get_seller_info_model.g.dart'; | ||
| 4 | + | ||
| 5 | +@JsonSerializable() | ||
| 6 | +class GetSellerInfoModel extends Object { | ||
| 7 | + @JsonKey(name: 'ret') | ||
| 8 | + int ret; | ||
| 9 | + | ||
| 10 | + @JsonKey(name: 'data') | ||
| 11 | + GetSellerInfoSunModel data; | ||
| 12 | + | ||
| 13 | + @JsonKey(name: 'msg') | ||
| 14 | + String msg; | ||
| 15 | + | ||
| 16 | + GetSellerInfoModel( | ||
| 17 | + this.ret, | ||
| 18 | + this.data, | ||
| 19 | + this.msg, | ||
| 20 | + ); | ||
| 21 | + | ||
| 22 | + factory GetSellerInfoModel.fromJson(Map<String, dynamic> srcJson) => | ||
| 23 | + _$GetSellerInfoModelFromJson(srcJson); | ||
| 24 | + | ||
| 25 | + Map<String, dynamic> toJson() => _$GetSellerInfoModelToJson(this); | ||
| 26 | +} | ||
| 27 | + | ||
| 28 | +@JsonSerializable() | ||
| 29 | +class GetSellerInfoSunModel extends Object { | ||
| 30 | + @JsonKey(name: 'data') | ||
| 31 | + Data data; | ||
| 32 | + | ||
| 33 | + GetSellerInfoSunModel( | ||
| 34 | + this.data, | ||
| 35 | + ); | ||
| 36 | + | ||
| 37 | + factory GetSellerInfoSunModel.fromJson(Map<String, dynamic> srcJson) => | ||
| 38 | + _$GetSellerInfoSunModelFromJson(srcJson); | ||
| 39 | + | ||
| 40 | + Map<String, dynamic> toJson() => _$GetSellerInfoSunModelToJson(this); | ||
| 41 | +} | ||
| 42 | + | ||
| 43 | +@JsonSerializable() | ||
| 44 | +class Data extends Object { | ||
| 45 | + @JsonKey(name: 'id') | ||
| 46 | + String id; | ||
| 47 | + | ||
| 48 | + @JsonKey(name: 'pid') | ||
| 49 | + String pid; | ||
| 50 | + | ||
| 51 | + @JsonKey(name: 'openid') | ||
| 52 | + String openid; | ||
| 53 | + | ||
| 54 | + @JsonKey(name: 'sellername') | ||
| 55 | + String sellername; | ||
| 56 | + | ||
| 57 | + @JsonKey(name: 'selleralias') | ||
| 58 | + String selleralias; | ||
| 59 | + | ||
| 60 | + @JsonKey(name: 'slogan') | ||
| 61 | + String slogan; | ||
| 62 | + | ||
| 63 | + @JsonKey(name: 'sellerdesc') | ||
| 64 | + String sellerdesc; | ||
| 65 | + | ||
| 66 | + @JsonKey(name: 'seller_logo') | ||
| 67 | + String sellerLogo; | ||
| 68 | + | ||
| 69 | + @JsonKey(name: 'seller_image') | ||
| 70 | + String sellerImage; | ||
| 71 | + | ||
| 72 | + @JsonKey(name: 'seller_tel') | ||
| 73 | + String sellerTel; | ||
| 74 | + | ||
| 75 | + @JsonKey(name: 'phone') | ||
| 76 | + String phone; | ||
| 77 | + | ||
| 78 | + @JsonKey(name: 'map_address') | ||
| 79 | + String mapAddress; | ||
| 80 | + | ||
| 81 | + @JsonKey(name: 'long') | ||
| 82 | + String long; | ||
| 83 | + | ||
| 84 | + @JsonKey(name: 'lat') | ||
| 85 | + String lat; | ||
| 86 | + | ||
| 87 | + @JsonKey(name: 'discount_type') | ||
| 88 | + String discountType; | ||
| 89 | + | ||
| 90 | + @JsonKey(name: 'last_num') | ||
| 91 | + String lastNum; | ||
| 92 | + | ||
| 93 | + @JsonKey(name: 'ispass') | ||
| 94 | + String ispass; | ||
| 95 | + | ||
| 96 | + @JsonKey(name: 'dis_ispass') | ||
| 97 | + String disIspass; | ||
| 98 | + | ||
| 99 | + @JsonKey(name: 'account_money') | ||
| 100 | + String accountMoney; | ||
| 101 | + | ||
| 102 | + @JsonKey(name: 'isopen_dc') | ||
| 103 | + String isopenDc; | ||
| 104 | + | ||
| 105 | + @JsonKey(name: 'isopen_md') | ||
| 106 | + String isopenMd; | ||
| 107 | + | ||
| 108 | + @JsonKey(name: 'dc_adduser_code') | ||
| 109 | + String dcAdduserCode; | ||
| 110 | + | ||
| 111 | + @JsonKey(name: 'average') | ||
| 112 | + String average; | ||
| 113 | + | ||
| 114 | + @JsonKey(name: 'is_online_reserve') | ||
| 115 | + String isOnlineReserve; | ||
| 116 | + | ||
| 117 | + @JsonKey(name: 'is_tele') | ||
| 118 | + String isTele; | ||
| 119 | + | ||
| 120 | + @JsonKey(name: 'daily') | ||
| 121 | + String daily; | ||
| 122 | + | ||
| 123 | + @JsonKey(name: 'daily_time') | ||
| 124 | + String dailyTime; | ||
| 125 | + | ||
| 126 | + @JsonKey(name: 'scale') | ||
| 127 | + String scale; | ||
| 128 | + | ||
| 129 | + @JsonKey(name: 'score') | ||
| 130 | + String score; | ||
| 131 | + | ||
| 132 | + @JsonKey(name: 'is_auth') | ||
| 133 | + String isAuth; | ||
| 134 | + | ||
| 135 | + @JsonKey(name: 'is_call_tel') | ||
| 136 | + String isCallTel; | ||
| 137 | + | ||
| 138 | + @JsonKey(name: 'rec_stime') | ||
| 139 | + String recStime; | ||
| 140 | + | ||
| 141 | + @JsonKey(name: 'rec_etime') | ||
| 142 | + String recEtime; | ||
| 143 | + | ||
| 144 | + @JsonKey(name: 'status') | ||
| 145 | + String status; | ||
| 146 | + | ||
| 147 | + @JsonKey(name: 'cdate') | ||
| 148 | + String cdate; | ||
| 149 | + | ||
| 150 | + @JsonKey(name: 'pro_code') | ||
| 151 | + String proCode; | ||
| 152 | + | ||
| 153 | + @JsonKey(name: 'city_code') | ||
| 154 | + String cityCode; | ||
| 155 | + | ||
| 156 | + @JsonKey(name: 'dis_code') | ||
| 157 | + String disCode; | ||
| 158 | + | ||
| 159 | + @JsonKey(name: 'seller_code') | ||
| 160 | + String sellerCode; | ||
| 161 | + | ||
| 162 | + Data( | ||
| 163 | + this.id, | ||
| 164 | + this.pid, | ||
| 165 | + this.openid, | ||
| 166 | + this.sellername, | ||
| 167 | + this.selleralias, | ||
| 168 | + this.slogan, | ||
| 169 | + this.sellerdesc, | ||
| 170 | + this.sellerLogo, | ||
| 171 | + this.sellerImage, | ||
| 172 | + this.sellerTel, | ||
| 173 | + this.phone, | ||
| 174 | + this.mapAddress, | ||
| 175 | + this.long, | ||
| 176 | + this.lat, | ||
| 177 | + this.discountType, | ||
| 178 | + this.lastNum, | ||
| 179 | + this.ispass, | ||
| 180 | + this.disIspass, | ||
| 181 | + this.accountMoney, | ||
| 182 | + this.isopenDc, | ||
| 183 | + this.isopenMd, | ||
| 184 | + this.dcAdduserCode, | ||
| 185 | + this.average, | ||
| 186 | + this.isOnlineReserve, | ||
| 187 | + this.isTele, | ||
| 188 | + this.daily, | ||
| 189 | + this.dailyTime, | ||
| 190 | + this.scale, | ||
| 191 | + this.score, | ||
| 192 | + this.isAuth, | ||
| 193 | + this.isCallTel, | ||
| 194 | + this.recStime, | ||
| 195 | + this.recEtime, | ||
| 196 | + this.status, | ||
| 197 | + this.cdate, | ||
| 198 | + this.proCode, | ||
| 199 | + this.cityCode, | ||
| 200 | + this.disCode, | ||
| 201 | + this.sellerCode, | ||
| 202 | + ); | ||
| 203 | + | ||
| 204 | + factory Data.fromJson(Map<String, dynamic> srcJson) => | ||
| 205 | + _$DataFromJson(srcJson); | ||
| 206 | + | ||
| 207 | + Map<String, dynamic> toJson() => _$DataToJson(this); | ||
| 208 | +} |
lib/models/get_seller_info_model.g.dart
0 → 100644
| 1 | +// GENERATED CODE - DO NOT MODIFY BY HAND | ||
| 2 | + | ||
| 3 | +part of 'get_seller_info_model.dart'; | ||
| 4 | + | ||
| 5 | +// ************************************************************************** | ||
| 6 | +// JsonSerializableGenerator | ||
| 7 | +// ************************************************************************** | ||
| 8 | + | ||
| 9 | +GetSellerInfoModel _$GetSellerInfoModelFromJson(Map<String, dynamic> json) { | ||
| 10 | + return GetSellerInfoModel( | ||
| 11 | + json['ret'] as int, | ||
| 12 | + json['data'] == null | ||
| 13 | + ? null | ||
| 14 | + : GetSellerInfoSunModel.fromJson( | ||
| 15 | + json['data'] as Map<String, dynamic>), | ||
| 16 | + json['msg'] as String); | ||
| 17 | +} | ||
| 18 | + | ||
| 19 | +Map<String, dynamic> _$GetSellerInfoModelToJson(GetSellerInfoModel instance) => | ||
| 20 | + <String, dynamic>{ | ||
| 21 | + 'ret': instance.ret, | ||
| 22 | + 'data': instance.data, | ||
| 23 | + 'msg': instance.msg | ||
| 24 | + }; | ||
| 25 | + | ||
| 26 | +GetSellerInfoSunModel _$GetSellerInfoSunModelFromJson( | ||
| 27 | + Map<String, dynamic> json) { | ||
| 28 | + return GetSellerInfoSunModel(json['data'] == null | ||
| 29 | + ? null | ||
| 30 | + : Data.fromJson(json['data'] as Map<String, dynamic>)); | ||
| 31 | +} | ||
| 32 | + | ||
| 33 | +Map<String, dynamic> _$GetSellerInfoSunModelToJson( | ||
| 34 | + GetSellerInfoSunModel instance) => | ||
| 35 | + <String, dynamic>{'data': instance.data}; | ||
| 36 | + | ||
| 37 | +Data _$DataFromJson(Map<String, dynamic> json) { | ||
| 38 | + return Data( | ||
| 39 | + json['id'] as String, | ||
| 40 | + json['pid'] as String, | ||
| 41 | + json['openid'] as String, | ||
| 42 | + json['sellername'] as String, | ||
| 43 | + json['selleralias'] as String, | ||
| 44 | + json['slogan'] as String, | ||
| 45 | + json['sellerdesc'] as String, | ||
| 46 | + json['seller_logo'] as String, | ||
| 47 | + json['seller_image'] as String, | ||
| 48 | + json['seller_tel'] as String, | ||
| 49 | + json['phone'] as String, | ||
| 50 | + json['map_address'] as String, | ||
| 51 | + json['long'] as String, | ||
| 52 | + json['lat'] as String, | ||
| 53 | + json['discount_type'] as String, | ||
| 54 | + json['last_num'] as String, | ||
| 55 | + json['ispass'] as String, | ||
| 56 | + json['dis_ispass'] as String, | ||
| 57 | + json['account_money'] as String, | ||
| 58 | + json['isopen_dc'] as String, | ||
| 59 | + json['isopen_md'] as String, | ||
| 60 | + json['dc_adduser_code'] as String, | ||
| 61 | + json['average'] as String, | ||
| 62 | + json['is_online_reserve'] as String, | ||
| 63 | + json['is_tele'] as String, | ||
| 64 | + json['daily'] as String, | ||
| 65 | + json['daily_time'] as String, | ||
| 66 | + json['scale'] as String, | ||
| 67 | + json['score'] as String, | ||
| 68 | + json['is_auth'] as String, | ||
| 69 | + json['is_call_tel'] as String, | ||
| 70 | + json['rec_stime'] as String, | ||
| 71 | + json['rec_etime'] as String, | ||
| 72 | + json['status'] as String, | ||
| 73 | + json['cdate'] as String, | ||
| 74 | + json['pro_code'] as String, | ||
| 75 | + json['city_code'] as String, | ||
| 76 | + json['dis_code'] as String, | ||
| 77 | + json['seller_code'] as String); | ||
| 78 | +} | ||
| 79 | + | ||
| 80 | +Map<String, dynamic> _$DataToJson(Data instance) => <String, dynamic>{ | ||
| 81 | + 'id': instance.id, | ||
| 82 | + 'pid': instance.pid, | ||
| 83 | + 'openid': instance.openid, | ||
| 84 | + 'sellername': instance.sellername, | ||
| 85 | + 'selleralias': instance.selleralias, | ||
| 86 | + 'slogan': instance.slogan, | ||
| 87 | + 'sellerdesc': instance.sellerdesc, | ||
| 88 | + 'seller_logo': instance.sellerLogo, | ||
| 89 | + 'seller_image': instance.sellerImage, | ||
| 90 | + 'seller_tel': instance.sellerTel, | ||
| 91 | + 'phone': instance.phone, | ||
| 92 | + 'map_address': instance.mapAddress, | ||
| 93 | + 'long': instance.long, | ||
| 94 | + 'lat': instance.lat, | ||
| 95 | + 'discount_type': instance.discountType, | ||
| 96 | + 'last_num': instance.lastNum, | ||
| 97 | + 'ispass': instance.ispass, | ||
| 98 | + 'dis_ispass': instance.disIspass, | ||
| 99 | + 'account_money': instance.accountMoney, | ||
| 100 | + 'isopen_dc': instance.isopenDc, | ||
| 101 | + 'isopen_md': instance.isopenMd, | ||
| 102 | + 'dc_adduser_code': instance.dcAdduserCode, | ||
| 103 | + 'average': instance.average, | ||
| 104 | + 'is_online_reserve': instance.isOnlineReserve, | ||
| 105 | + 'is_tele': instance.isTele, | ||
| 106 | + 'daily': instance.daily, | ||
| 107 | + 'daily_time': instance.dailyTime, | ||
| 108 | + 'scale': instance.scale, | ||
| 109 | + 'score': instance.score, | ||
| 110 | + 'is_auth': instance.isAuth, | ||
| 111 | + 'is_call_tel': instance.isCallTel, | ||
| 112 | + 'rec_stime': instance.recStime, | ||
| 113 | + 'rec_etime': instance.recEtime, | ||
| 114 | + 'status': instance.status, | ||
| 115 | + 'cdate': instance.cdate, | ||
| 116 | + 'pro_code': instance.proCode, | ||
| 117 | + 'city_code': instance.cityCode, | ||
| 118 | + 'dis_code': instance.disCode, | ||
| 119 | + 'seller_code': instance.sellerCode | ||
| 120 | + }; |
| @@ -215,6 +215,7 @@ class DioUtil { | @@ -215,6 +215,7 @@ class DioUtil { | ||
| 215 | _data = _dataMap[_dataKey]; | 215 | _data = _dataMap[_dataKey]; |
| 216 | _responseData = _dataMap; | 216 | _responseData = _dataMap; |
| 217 | } | 217 | } |
| 218 | + | ||
| 218 | Loading.hideLoading(context); | 219 | Loading.hideLoading(context); |
| 219 | return new BaseResp(_status, _code, _msg, _data, _responseData); | 220 | return new BaseResp(_status, _code, _msg, _data, _responseData); |
| 220 | } catch (e) { | 221 | } catch (e) { |
| @@ -38,5 +38,11 @@ class HttpUrl { | @@ -38,5 +38,11 @@ class HttpUrl { | ||
| 38 | static const String set_switch_status = | 38 | static const String set_switch_status = |
| 39 | "?service=App.Reserve.SetSwitchStatus"; //启用/停用桌位 | 39 | "?service=App.Reserve.SetSwitchStatus"; //启用/停用桌位 |
| 40 | static const String sms_info = "?service=App.SendSMS.SmsInfo"; //短信余量查询及套餐查询接口 | 40 | static const String sms_info = "?service=App.SendSMS.SmsInfo"; //短信余量查询及套餐查询接口 |
| 41 | - static const String set_seller_info = "?service=App.Seller.SetSellerById"; // 根据商家ID获取商家信息 | 41 | + static const String set_seller_info = |
| 42 | + "?service=App.Seller.SetSellerById"; // 根据商家ID设置商家信息 | ||
| 43 | + static const String get_seller_info = | ||
| 44 | + "?service=App.Seller.GetSellerById"; // 根据商家ID获取商家信息 | ||
| 45 | + static const String set_order_time = | ||
| 46 | + "?service=App.Seller.SetReOrderTime"; //在线预订配置-接单时间 | ||
| 47 | + | ||
| 42 | } | 48 | } |
| @@ -114,7 +114,9 @@ class _NoteBookChangePageState extends State<NoteBookChangePage> { | @@ -114,7 +114,9 @@ class _NoteBookChangePageState extends State<NoteBookChangePage> { | ||
| 114 | mainAxisAlignment: MainAxisAlignment.spaceBetween, | 114 | mainAxisAlignment: MainAxisAlignment.spaceBetween, |
| 115 | children: _notebookDetailChangeModel.dateList.map((value) { | 115 | children: _notebookDetailChangeModel.dateList.map((value) { |
| 116 | return CustomButton( | 116 | return CustomButton( |
| 117 | - dateText: value['title'].toString().length<=5?value['title'].toString():value['title'].toString().substring(5), | 117 | + dateText: value['title'].toString().length <= 5 |
| 118 | + ? value['title'].toString() | ||
| 119 | + : value['title'].toString().substring(5), | ||
| 118 | fontSize: value['fontSize'], | 120 | fontSize: value['fontSize'], |
| 119 | dayText: value['dayText'], | 121 | dayText: value['dayText'], |
| 120 | isImage: value['isImage'], | 122 | isImage: value['isImage'], |
| @@ -838,7 +840,11 @@ class _NoteBookChangePageState extends State<NoteBookChangePage> { | @@ -838,7 +840,11 @@ class _NoteBookChangePageState extends State<NoteBookChangePage> { | ||
| 838 | if (permissionStatus == PermissionStatus.neverAskAgain) { | 840 | if (permissionStatus == PermissionStatus.neverAskAgain) { |
| 839 | //用户选择不在弹出权限提示框 | 841 | //用户选择不在弹出权限提示框 |
| 840 | print('never'); | 842 | print('never'); |
| 841 | - DialogUtil.openAlertDialog(context); | 843 | + DialogUtil.openAlertDialog( |
| 844 | + context, '未获得通讯录权限', "请在手机的权限管理里,将通讯录权限开启", '去设置',340.0, onTap: () { | ||
| 845 | + openSetting(); | ||
| 846 | + Navigator.pop(context, ''); | ||
| 847 | + }); | ||
| 842 | } else { | 848 | } else { |
| 843 | // 申请权限 | 849 | // 申请权限 |
| 844 | bool canContacts = await requestContactPermission(); | 850 | bool canContacts = await requestContactPermission(); |
| @@ -846,7 +852,12 @@ class _NoteBookChangePageState extends State<NoteBookChangePage> { | @@ -846,7 +852,12 @@ class _NoteBookChangePageState extends State<NoteBookChangePage> { | ||
| 846 | _getContactData(); | 852 | _getContactData(); |
| 847 | } else { | 853 | } else { |
| 848 | //拒绝通讯录权限 , 苹果拒绝权限后,不再提示权限框,进入此处 | 854 | //拒绝通讯录权限 , 苹果拒绝权限后,不再提示权限框,进入此处 |
| 849 | - DialogUtil.openAlertDialog(context); | 855 | + DialogUtil.openAlertDialog( |
| 856 | + context, '未获得通讯录权限', "请在手机的权限管理里,将通讯录权限开启", '去设置', 340.0, | ||
| 857 | + onTap: () { | ||
| 858 | + openSetting(); | ||
| 859 | + Navigator.pop(context, ''); | ||
| 860 | + }); | ||
| 850 | } | 861 | } |
| 851 | } | 862 | } |
| 852 | } else { | 863 | } else { |
| @@ -434,9 +434,9 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver { | @@ -434,9 +434,9 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver { | ||
| 434 | _currIndex = index; | 434 | _currIndex = index; |
| 435 | }); | 435 | }); |
| 436 | if (_currIndex == 3) { | 436 | if (_currIndex == 3) { |
| 437 | - Utils.changeStatusColor(color: MyColours.color_199095); | 437 | + Utils.changeStatusColor(color: Colors.transparent); |
| 438 | } else { | 438 | } else { |
| 439 | - Utils.changeStatusColor(color: MyColours.color_ffffff); | 439 | + Utils.changeStatusColor(color: Colors.white); |
| 440 | } | 440 | } |
| 441 | } | 441 | } |
| 442 | }, | 442 | }, |
| 1 | import 'dart:async'; | 1 | import 'dart:async'; |
| 2 | 2 | ||
| 3 | import 'package:flutter/material.dart'; | 3 | import 'package:flutter/material.dart'; |
| 4 | +import 'package:one_key/utils/event_bus.dart'; | ||
| 4 | import 'package:one_key/widgets/system_app_bar.dart'; | 5 | import 'package:one_key/widgets/system_app_bar.dart'; |
| 5 | import 'package:webview_flutter/webview_flutter.dart'; | 6 | import 'package:webview_flutter/webview_flutter.dart'; |
| 6 | 7 | ||
| @@ -14,7 +15,9 @@ class WebPage extends StatelessWidget { | @@ -14,7 +15,9 @@ class WebPage extends StatelessWidget { | ||
| 14 | final Completer<WebViewController> _controller = | 15 | final Completer<WebViewController> _controller = |
| 15 | Completer<WebViewController>(); | 16 | Completer<WebViewController>(); |
| 16 | return Scaffold( | 17 | return Scaffold( |
| 17 | - appBar: SystemAppBar(title), | 18 | + appBar: SystemAppBar(title, onTap: () { |
| 19 | + Navigator.of(context).pop(); | ||
| 20 | + }), | ||
| 18 | body: WebView( | 21 | body: WebView( |
| 19 | initialUrl: "http://colorcun.com/privacy1.html", | 22 | initialUrl: "http://colorcun.com/privacy1.html", |
| 20 | javascriptMode: JavascriptMode.unrestricted, | 23 | javascriptMode: JavascriptMode.unrestricted, |
| @@ -31,9 +34,7 @@ class WebPage extends StatelessWidget { | @@ -31,9 +34,7 @@ class WebPage extends StatelessWidget { | ||
| 31 | } | 34 | } |
| 32 | return NavigationDecision.navigate; | 35 | return NavigationDecision.navigate; |
| 33 | }, | 36 | }, |
| 34 | - onPageStarted: (String url) { | ||
| 35 | - | ||
| 36 | - }, | 37 | + onPageStarted: (String url) {}, |
| 37 | onPageFinished: (String url) { | 38 | onPageFinished: (String url) { |
| 38 | // Loading.hideLoading(context); | 39 | // Loading.hideLoading(context); |
| 39 | }, | 40 | }, |
| @@ -8,10 +8,12 @@ import 'package:one_key/models/settime.dart'; | @@ -8,10 +8,12 @@ import 'package:one_key/models/settime.dart'; | ||
| 8 | import 'package:one_key/provider/book_set_time_model.dart'; | 8 | import 'package:one_key/provider/book_set_time_model.dart'; |
| 9 | import 'package:one_key/res/colors.dart'; | 9 | import 'package:one_key/res/colors.dart'; |
| 10 | import 'package:one_key/utils/dialog_util.dart'; | 10 | import 'package:one_key/utils/dialog_util.dart'; |
| 11 | +import 'package:one_key/utils/event_bus.dart'; | ||
| 11 | import 'package:one_key/utils/utils.dart'; | 12 | import 'package:one_key/utils/utils.dart'; |
| 12 | import 'package:one_key/widgets/MyDivider.dart'; | 13 | import 'package:one_key/widgets/MyDivider.dart'; |
| 13 | import 'package:one_key/widgets/common_button.dart'; | 14 | import 'package:one_key/widgets/common_button.dart'; |
| 14 | import 'package:one_key/widgets/h_empty_view.dart'; | 15 | import 'package:one_key/widgets/h_empty_view.dart'; |
| 16 | +import 'package:one_key/widgets/set_time_widget.dart'; | ||
| 15 | import 'package:one_key/widgets/system_app_bar.dart'; | 17 | import 'package:one_key/widgets/system_app_bar.dart'; |
| 16 | import 'package:one_key/widgets/v_empty_view.dart'; | 18 | import 'package:one_key/widgets/v_empty_view.dart'; |
| 17 | import 'package:provider/provider.dart'; | 19 | import 'package:provider/provider.dart'; |
| @@ -28,7 +30,6 @@ class BookTimeSetPage extends StatefulWidget { | @@ -28,7 +30,6 @@ class BookTimeSetPage extends StatefulWidget { | ||
| 28 | class _BookTimeSetPageState extends State<BookTimeSetPage> { | 30 | class _BookTimeSetPageState extends State<BookTimeSetPage> { |
| 29 | List swichState; | 31 | List swichState; |
| 30 | final GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>(); | 32 | final GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>(); |
| 31 | - List dateData; | ||
| 32 | SetTime morning = SetTime(); | 33 | SetTime morning = SetTime(); |
| 33 | SetTime noon = SetTime(); | 34 | SetTime noon = SetTime(); |
| 34 | SetTime night = SetTime(); | 35 | SetTime night = SetTime(); |
| @@ -44,80 +45,7 @@ class _BookTimeSetPageState extends State<BookTimeSetPage> { | @@ -44,80 +45,7 @@ class _BookTimeSetPageState extends State<BookTimeSetPage> { | ||
| 44 | night.start = '16:00'; | 45 | night.start = '16:00'; |
| 45 | night.end = '21:00'; | 46 | night.end = '21:00'; |
| 46 | swichState = [false, true, true]; | 47 | swichState = [false, true, true]; |
| 47 | - dateData = [ | ||
| 48 | - { | ||
| 49 | - '深夜00时': [00, 30] | ||
| 50 | - }, | ||
| 51 | - { | ||
| 52 | - '深夜01时': [00, 30] | ||
| 53 | - }, | ||
| 54 | - { | ||
| 55 | - '深夜02时': [00, 30] | ||
| 56 | - }, | ||
| 57 | - { | ||
| 58 | - '深夜03时': [00, 30] | ||
| 59 | - }, | ||
| 60 | - { | ||
| 61 | - '深夜04时': [00, 30] | ||
| 62 | - }, | ||
| 63 | - { | ||
| 64 | - '深夜05时': [00, 30] | ||
| 65 | - }, | ||
| 66 | - { | ||
| 67 | - '早上06时': [00, 30] | ||
| 68 | - }, | ||
| 69 | - { | ||
| 70 | - '早上07时': [00, 30] | ||
| 71 | - }, | ||
| 72 | - { | ||
| 73 | - '早上08时': [00, 30] | ||
| 74 | - }, | ||
| 75 | - { | ||
| 76 | - '早上09时': [00, 30] | ||
| 77 | - }, | ||
| 78 | - { | ||
| 79 | - '中午10时': [00, 30] | ||
| 80 | - }, | ||
| 81 | - { | ||
| 82 | - '中午11时': [00, 30] | ||
| 83 | - }, | ||
| 84 | - { | ||
| 85 | - '中午12时': [00, 30] | ||
| 86 | - }, | ||
| 87 | - { | ||
| 88 | - '中午13时': [00, 30] | ||
| 89 | - }, | ||
| 90 | - { | ||
| 91 | - '中午14时': [00, 30] | ||
| 92 | - }, | ||
| 93 | - { | ||
| 94 | - '下午15时': [00, 30] | ||
| 95 | - }, | ||
| 96 | - { | ||
| 97 | - '下午16时': [00, 30] | ||
| 98 | - }, | ||
| 99 | - { | ||
| 100 | - '下午17时': [00, 30] | ||
| 101 | - }, | ||
| 102 | - { | ||
| 103 | - '下午18时': [00, 30] | ||
| 104 | - }, | ||
| 105 | - { | ||
| 106 | - '晚上19时': [00, 30] | ||
| 107 | - }, | ||
| 108 | - { | ||
| 109 | - '晚上20时': [00, 30] | ||
| 110 | - }, | ||
| 111 | - { | ||
| 112 | - '晚上21时': [00, 30] | ||
| 113 | - }, | ||
| 114 | - { | ||
| 115 | - '晚上22时': [00, 30] | ||
| 116 | - }, | ||
| 117 | - { | ||
| 118 | - '晚上23时': [00, 30] | ||
| 119 | - } | ||
| 120 | - ]; | 48 | + |
| 121 | WidgetsBinding.instance.addPostFrameCallback((_) { | 49 | WidgetsBinding.instance.addPostFrameCallback((_) { |
| 122 | _getDailyTime(); | 50 | _getDailyTime(); |
| 123 | }); | 51 | }); |
| @@ -156,14 +84,14 @@ class _BookTimeSetPageState extends State<BookTimeSetPage> { | @@ -156,14 +84,14 @@ class _BookTimeSetPageState extends State<BookTimeSetPage> { | ||
| 156 | } | 84 | } |
| 157 | if (swichState[0] == false) { | 85 | if (swichState[0] == false) { |
| 158 | if (model.daily.noon.isNotEmpty) { | 86 | if (model.daily.noon.isNotEmpty) { |
| 159 | - _compareDateTime(noon.start, morning.end, (needChange) { | 87 | + Utils.compareDateTime(noon.start, morning.end, (needChange) { |
| 160 | if (needChange) { | 88 | if (needChange) { |
| 161 | morning.end = noon.start; | 89 | morning.end = noon.start; |
| 162 | } else { | 90 | } else { |
| 163 | morning.end = '10:00'; | 91 | morning.end = '10:00'; |
| 164 | } | 92 | } |
| 165 | }); | 93 | }); |
| 166 | - _compareDateTime(noon.start, morning.start, (needChange) { | 94 | + Utils.compareDateTime(noon.start, morning.start, (needChange) { |
| 167 | if (needChange) { | 95 | if (needChange) { |
| 168 | morning.start = noon.start; | 96 | morning.start = noon.start; |
| 169 | } else { | 97 | } else { |
| @@ -171,14 +99,14 @@ class _BookTimeSetPageState extends State<BookTimeSetPage> { | @@ -171,14 +99,14 @@ class _BookTimeSetPageState extends State<BookTimeSetPage> { | ||
| 171 | } | 99 | } |
| 172 | }); | 100 | }); |
| 173 | } else if (model.daily.night.isNotEmpty) { | 101 | } else if (model.daily.night.isNotEmpty) { |
| 174 | - _compareDateTime(night.start, morning.end, (needChange) { | 102 | + Utils.compareDateTime(night.start, morning.end, (needChange) { |
| 175 | if (needChange) { | 103 | if (needChange) { |
| 176 | morning.end = night.start; | 104 | morning.end = night.start; |
| 177 | } else { | 105 | } else { |
| 178 | morning.end = '10:00'; | 106 | morning.end = '10:00'; |
| 179 | } | 107 | } |
| 180 | }); | 108 | }); |
| 181 | - _compareDateTime(night.start, morning.start, (needChange) { | 109 | + Utils.compareDateTime(night.start, morning.start, (needChange) { |
| 182 | if (needChange) { | 110 | if (needChange) { |
| 183 | morning.start = night.start; | 111 | morning.start = night.start; |
| 184 | } else { | 112 | } else { |
| @@ -189,18 +117,18 @@ class _BookTimeSetPageState extends State<BookTimeSetPage> { | @@ -189,18 +117,18 @@ class _BookTimeSetPageState extends State<BookTimeSetPage> { | ||
| 189 | } | 117 | } |
| 190 | if (swichState[1] == false) { | 118 | if (swichState[1] == false) { |
| 191 | if (model.daily.morning.isNotEmpty) { | 119 | if (model.daily.morning.isNotEmpty) { |
| 192 | - _compareDateTime(noon.start, morning.end, (needChange) { | 120 | + Utils.compareDateTime(noon.start, morning.end, (needChange) { |
| 193 | if (needChange) { | 121 | if (needChange) { |
| 194 | noon.start = morning.end; | 122 | noon.start = morning.end; |
| 195 | } else { | 123 | } else { |
| 196 | noon.start = '11:00'; | 124 | noon.start = '11:00'; |
| 197 | } | 125 | } |
| 198 | }); | 126 | }); |
| 199 | - _compareDateTime(noon.end, morning.end, (needChange) { | 127 | + Utils.compareDateTime(noon.end, morning.end, (needChange) { |
| 200 | if (needChange) { | 128 | if (needChange) { |
| 201 | noon.end = morning.end; | 129 | noon.end = morning.end; |
| 202 | } else { | 130 | } else { |
| 203 | - _compareDateTime(noon.end, night.start, (needChange) { | 131 | + Utils.compareDateTime(noon.end, night.start, (needChange) { |
| 204 | if (needChange) { | 132 | if (needChange) { |
| 205 | noon.end = '14:30'; | 133 | noon.end = '14:30'; |
| 206 | } else { | 134 | } else { |
| @@ -211,12 +139,12 @@ class _BookTimeSetPageState extends State<BookTimeSetPage> { | @@ -211,12 +139,12 @@ class _BookTimeSetPageState extends State<BookTimeSetPage> { | ||
| 211 | }); | 139 | }); |
| 212 | } | 140 | } |
| 213 | if (model.daily.night.isNotEmpty) { | 141 | if (model.daily.night.isNotEmpty) { |
| 214 | - _compareDateTime(noon.start, night.start, (needChange) { | 142 | + Utils.compareDateTime(noon.start, night.start, (needChange) { |
| 215 | if (!needChange) { | 143 | if (!needChange) { |
| 216 | noon.start = night.start; | 144 | noon.start = night.start; |
| 217 | } | 145 | } |
| 218 | }); | 146 | }); |
| 219 | - _compareDateTime(noon.end, morning.start, (needChange) { | 147 | + Utils.compareDateTime(noon.end, morning.start, (needChange) { |
| 220 | if (!needChange) { | 148 | if (!needChange) { |
| 221 | noon.end = night.start; | 149 | noon.end = night.start; |
| 222 | } | 150 | } |
| @@ -225,25 +153,33 @@ class _BookTimeSetPageState extends State<BookTimeSetPage> { | @@ -225,25 +153,33 @@ class _BookTimeSetPageState extends State<BookTimeSetPage> { | ||
| 225 | } | 153 | } |
| 226 | if (swichState[2] == false) { | 154 | if (swichState[2] == false) { |
| 227 | if (model.daily.noon.isNotEmpty) { | 155 | if (model.daily.noon.isNotEmpty) { |
| 228 | - _compareDateTime(night.start, noon.end, (needChange) { | 156 | + Utils.compareDateTime(night.start, noon.end, (needChange) { |
| 229 | if (needChange) { | 157 | if (needChange) { |
| 230 | night.start = noon.end; | 158 | night.start = noon.end; |
| 231 | - night.end = noon.end; | 159 | + Utils.compareDateTime(night.end, noon.end, (needChange) { |
| 160 | + if (needChange) { | ||
| 161 | + night.end = noon.end; | ||
| 162 | + } | ||
| 163 | + }); | ||
| 232 | } | 164 | } |
| 233 | }); | 165 | }); |
| 234 | - _compareDateTime(night.end, noon.start, (needChange) { | 166 | + Utils.compareDateTime(night.end, noon.start, (needChange) { |
| 235 | if (needChange) { | 167 | if (needChange) { |
| 236 | night.end = noon.start; | 168 | night.end = noon.start; |
| 237 | } | 169 | } |
| 238 | }); | 170 | }); |
| 239 | } else if (model.daily.morning.isNotEmpty) { | 171 | } else if (model.daily.morning.isNotEmpty) { |
| 240 | - _compareDateTime(night.start, morning.end, (needChange) { | 172 | + Utils.compareDateTime(night.start, morning.end, (needChange) { |
| 241 | if (needChange) { | 173 | if (needChange) { |
| 242 | night.start = morning.end; | 174 | night.start = morning.end; |
| 243 | - night.end = morning.end; | 175 | + Utils.compareDateTime(night.end, noon.end, (needChange) { |
| 176 | + if (needChange) { | ||
| 177 | + night.end = morning.end; | ||
| 178 | + } | ||
| 179 | + }); | ||
| 244 | } | 180 | } |
| 245 | }); | 181 | }); |
| 246 | - _compareDateTime(night.start, morning.start, (needChange) { | 182 | + Utils.compareDateTime(night.start, morning.start, (needChange) { |
| 247 | if (needChange) { | 183 | if (needChange) { |
| 248 | night.start = morning.start; | 184 | night.start = morning.start; |
| 249 | } | 185 | } |
| @@ -297,19 +233,21 @@ class _BookTimeSetPageState extends State<BookTimeSetPage> { | @@ -297,19 +233,21 @@ class _BookTimeSetPageState extends State<BookTimeSetPage> { | ||
| 297 | ), | 233 | ), |
| 298 | timeWidget('开始时间', startTime, highted: swichState[tag], onTap: () { | 234 | timeWidget('开始时间', startTime, highted: swichState[tag], onTap: () { |
| 299 | if (swichState[tag]) { | 235 | if (swichState[tag]) { |
| 300 | - List data = dateData; | 236 | + List data = SetTimeWidget.dateData; |
| 301 | if (tag == 0) { | 237 | if (tag == 0) { |
| 302 | //早市 | 238 | //早市 |
| 303 | - data = dateData; | 239 | + data = SetTimeWidget.dateData; |
| 304 | } else if (tag == 1) { | 240 | } else if (tag == 1) { |
| 305 | //午市 | 241 | //午市 |
| 306 | - data = _getPickerData(morning.end); | 242 | + data = |
| 243 | + Utils.getPickerData(morning.end, SetTimeWidget.dateData); | ||
| 307 | } else if (tag == 2) { | 244 | } else if (tag == 2) { |
| 308 | //晚市 | 245 | //晚市 |
| 309 | - data = _getPickerData(noon.end); | 246 | + data = Utils.getPickerData(noon.end, SetTimeWidget.dateData); |
| 310 | } | 247 | } |
| 311 | 248 | ||
| 312 | - DialogUtil.showSelectCusmanDialog(context, data, (value) { | 249 | + SetTimeWidget().showTimeSelector(context, data, startTime, |
| 250 | + (value) { | ||
| 313 | if (value != null) { | 251 | if (value != null) { |
| 314 | String temp; | 252 | String temp; |
| 315 | if (data.length == 1) { | 253 | if (data.length == 1) { |
| @@ -323,34 +261,37 @@ class _BookTimeSetPageState extends State<BookTimeSetPage> { | @@ -323,34 +261,37 @@ class _BookTimeSetPageState extends State<BookTimeSetPage> { | ||
| 323 | } | 261 | } |
| 324 | 262 | ||
| 325 | print(data[value[0]].keys.first); | 263 | print(data[value[0]].keys.first); |
| 326 | - String time = _getTimeString( | ||
| 327 | - _getHourFromTitle(data[value[0]].keys.first), temp); | 264 | + String time = Utils.getTimeString( |
| 265 | + Utils.getHourFromTitle(data[value[0]].keys.first), | ||
| 266 | + temp); | ||
| 328 | setState(() { | 267 | setState(() { |
| 329 | if (tag == 0) { | 268 | if (tag == 0) { |
| 330 | //早市 | 269 | //早市 |
| 331 | morning.start = time; | 270 | morning.start = time; |
| 332 | setState(() { | 271 | setState(() { |
| 333 | - _compareDateTime(morning.end, time, (needChange) { | 272 | + Utils.compareDateTime(morning.end, time, |
| 273 | + (needChange) { | ||
| 334 | if (needChange) { | 274 | if (needChange) { |
| 335 | morning.end = time; | 275 | morning.end = time; |
| 336 | } | 276 | } |
| 337 | }); | 277 | }); |
| 338 | - _compareDateTime(noon.start, time, (needChange) { | 278 | + Utils.compareDateTime(noon.start, time, (needChange) { |
| 339 | if (needChange) { | 279 | if (needChange) { |
| 340 | noon.start = time; | 280 | noon.start = time; |
| 341 | } | 281 | } |
| 342 | }); | 282 | }); |
| 343 | - _compareDateTime(noon.end, time, (needChange) { | 283 | + Utils.compareDateTime(noon.end, time, (needChange) { |
| 344 | if (needChange) { | 284 | if (needChange) { |
| 345 | noon.end = time; | 285 | noon.end = time; |
| 346 | } | 286 | } |
| 347 | }); | 287 | }); |
| 348 | - _compareDateTime(night.start, time, (needChange) { | 288 | + Utils.compareDateTime(night.start, time, |
| 289 | + (needChange) { | ||
| 349 | if (needChange) { | 290 | if (needChange) { |
| 350 | night.start = time; | 291 | night.start = time; |
| 351 | } | 292 | } |
| 352 | }); | 293 | }); |
| 353 | - _compareDateTime(night.end, time, (needChange) { | 294 | + Utils.compareDateTime(night.end, time, (needChange) { |
| 354 | if (needChange) { | 295 | if (needChange) { |
| 355 | night.end = time; | 296 | night.end = time; |
| 356 | } | 297 | } |
| @@ -360,17 +301,18 @@ class _BookTimeSetPageState extends State<BookTimeSetPage> { | @@ -360,17 +301,18 @@ class _BookTimeSetPageState extends State<BookTimeSetPage> { | ||
| 360 | //午市 | 301 | //午市 |
| 361 | noon.start = time; | 302 | noon.start = time; |
| 362 | setState(() { | 303 | setState(() { |
| 363 | - _compareDateTime(noon.end, time, (needChange) { | 304 | + Utils.compareDateTime(noon.end, time, (needChange) { |
| 364 | if (needChange) { | 305 | if (needChange) { |
| 365 | noon.end = time; | 306 | noon.end = time; |
| 366 | } | 307 | } |
| 367 | }); | 308 | }); |
| 368 | - _compareDateTime(night.start, time, (needChange) { | 309 | + Utils.compareDateTime(night.start, time, |
| 310 | + (needChange) { | ||
| 369 | if (needChange) { | 311 | if (needChange) { |
| 370 | night.start = time; | 312 | night.start = time; |
| 371 | } | 313 | } |
| 372 | }); | 314 | }); |
| 373 | - _compareDateTime(night.end, time, (needChange) { | 315 | + Utils.compareDateTime(night.end, time, (needChange) { |
| 374 | if (needChange) { | 316 | if (needChange) { |
| 375 | night.end = time; | 317 | night.end = time; |
| 376 | } | 318 | } |
| @@ -380,7 +322,7 @@ class _BookTimeSetPageState extends State<BookTimeSetPage> { | @@ -380,7 +322,7 @@ class _BookTimeSetPageState extends State<BookTimeSetPage> { | ||
| 380 | //晚市 | 322 | //晚市 |
| 381 | night.start = time; | 323 | night.start = time; |
| 382 | setState(() { | 324 | setState(() { |
| 383 | - _compareDateTime(night.end, time, (needChange) { | 325 | + Utils.compareDateTime(night.end, time, (needChange) { |
| 384 | if (needChange) { | 326 | if (needChange) { |
| 385 | night.end = time; | 327 | night.end = time; |
| 386 | } | 328 | } |
| @@ -390,11 +332,6 @@ class _BookTimeSetPageState extends State<BookTimeSetPage> { | @@ -390,11 +332,6 @@ class _BookTimeSetPageState extends State<BookTimeSetPage> { | ||
| 390 | }); | 332 | }); |
| 391 | print(value); | 333 | print(value); |
| 392 | } | 334 | } |
| 393 | - }, selecteds: [ | ||
| 394 | - _getFirSelected(startTime, data), | ||
| 395 | - _getSecSelected(startTime) | ||
| 396 | - ]).then((value) { | ||
| 397 | - print(value); | ||
| 398 | }); | 335 | }); |
| 399 | } | 336 | } |
| 400 | }), | 337 | }), |
| @@ -408,18 +345,22 @@ class _BookTimeSetPageState extends State<BookTimeSetPage> { | @@ -408,18 +345,22 @@ class _BookTimeSetPageState extends State<BookTimeSetPage> { | ||
| 408 | )), | 345 | )), |
| 409 | timeWidget('结束时间', endTime, highted: swichState[tag], onTap: () { | 346 | timeWidget('结束时间', endTime, highted: swichState[tag], onTap: () { |
| 410 | if (swichState[tag]) { | 347 | if (swichState[tag]) { |
| 411 | - List data = dateData; | 348 | + List data = SetTimeWidget.dateData; |
| 412 | if (tag == 0) { | 349 | if (tag == 0) { |
| 413 | //早市 | 350 | //早市 |
| 414 | - data = _getPickerData(morning.start); | 351 | + data = Utils.getPickerData( |
| 352 | + morning.start, SetTimeWidget.dateData); | ||
| 415 | } else if (tag == 1) { | 353 | } else if (tag == 1) { |
| 416 | //午市 | 354 | //午市 |
| 417 | - data = _getPickerData(noon.start); | 355 | + data = |
| 356 | + Utils.getPickerData(noon.start, SetTimeWidget.dateData); | ||
| 418 | } else if (tag == 2) { | 357 | } else if (tag == 2) { |
| 419 | //晚市 | 358 | //晚市 |
| 420 | - data = _getPickerData(night.start); | 359 | + data = |
| 360 | + Utils.getPickerData(night.start, SetTimeWidget.dateData); | ||
| 421 | } | 361 | } |
| 422 | - DialogUtil.showSelectCusmanDialog(context, data, (value) { | 362 | + SetTimeWidget().showTimeSelector(context, data, startTime, |
| 363 | + (value) { | ||
| 423 | if (value != null) { | 364 | if (value != null) { |
| 424 | String temp; | 365 | String temp; |
| 425 | if (data.length == 1) { | 366 | if (data.length == 1) { |
| @@ -431,29 +372,31 @@ class _BookTimeSetPageState extends State<BookTimeSetPage> { | @@ -431,29 +372,31 @@ class _BookTimeSetPageState extends State<BookTimeSetPage> { | ||
| 431 | temp = '30'; | 372 | temp = '30'; |
| 432 | } | 373 | } |
| 433 | } | 374 | } |
| 434 | - String time = _getTimeString( | ||
| 435 | - _getHourFromTitle(data[value[0]].keys.first), temp); | 375 | + String time = Utils.getTimeString( |
| 376 | + Utils.getHourFromTitle(data[value[0]].keys.first), | ||
| 377 | + temp); | ||
| 436 | setState(() { | 378 | setState(() { |
| 437 | if (tag == 0) { | 379 | if (tag == 0) { |
| 438 | //早市 | 380 | //早市 |
| 439 | morning.end = time; | 381 | morning.end = time; |
| 440 | setState(() { | 382 | setState(() { |
| 441 | - _compareDateTime(noon.start, time, (needChange) { | 383 | + Utils.compareDateTime(noon.start, time, (needChange) { |
| 442 | if (needChange) { | 384 | if (needChange) { |
| 443 | noon.start = time; | 385 | noon.start = time; |
| 444 | } | 386 | } |
| 445 | }); | 387 | }); |
| 446 | - _compareDateTime(noon.end, time, (needChange) { | 388 | + Utils.compareDateTime(noon.end, time, (needChange) { |
| 447 | if (needChange) { | 389 | if (needChange) { |
| 448 | noon.end = time; | 390 | noon.end = time; |
| 449 | } | 391 | } |
| 450 | }); | 392 | }); |
| 451 | - _compareDateTime(night.start, time, (needChange) { | 393 | + Utils.compareDateTime(night.start, time, |
| 394 | + (needChange) { | ||
| 452 | if (needChange) { | 395 | if (needChange) { |
| 453 | night.start = time; | 396 | night.start = time; |
| 454 | } | 397 | } |
| 455 | }); | 398 | }); |
| 456 | - _compareDateTime(night.end, time, (needChange) { | 399 | + Utils.compareDateTime(night.end, time, (needChange) { |
| 457 | if (needChange) { | 400 | if (needChange) { |
| 458 | night.end = time; | 401 | night.end = time; |
| 459 | } | 402 | } |
| @@ -463,12 +406,13 @@ class _BookTimeSetPageState extends State<BookTimeSetPage> { | @@ -463,12 +406,13 @@ class _BookTimeSetPageState extends State<BookTimeSetPage> { | ||
| 463 | //午市 | 406 | //午市 |
| 464 | noon.end = time; | 407 | noon.end = time; |
| 465 | setState(() { | 408 | setState(() { |
| 466 | - _compareDateTime(night.start, time, (needChange) { | 409 | + Utils.compareDateTime(night.start, time, |
| 410 | + (needChange) { | ||
| 467 | if (needChange) { | 411 | if (needChange) { |
| 468 | night.start = time; | 412 | night.start = time; |
| 469 | } | 413 | } |
| 470 | }); | 414 | }); |
| 471 | - _compareDateTime(night.end, time, (needChange) { | 415 | + Utils.compareDateTime(night.end, time, (needChange) { |
| 472 | if (needChange) { | 416 | if (needChange) { |
| 473 | night.end = time; | 417 | night.end = time; |
| 474 | } | 418 | } |
| @@ -481,11 +425,6 @@ class _BookTimeSetPageState extends State<BookTimeSetPage> { | @@ -481,11 +425,6 @@ class _BookTimeSetPageState extends State<BookTimeSetPage> { | ||
| 481 | }); | 425 | }); |
| 482 | print(value); | 426 | print(value); |
| 483 | } | 427 | } |
| 484 | - }, selecteds: [ | ||
| 485 | - _getFirSelected(endTime, data), | ||
| 486 | - _getSecSelected(endTime) | ||
| 487 | - ]).then((value) { | ||
| 488 | - print(value); | ||
| 489 | }); | 428 | }); |
| 490 | } | 429 | } |
| 491 | }) | 430 | }) |
| @@ -493,89 +432,6 @@ class _BookTimeSetPageState extends State<BookTimeSetPage> { | @@ -493,89 +432,6 @@ class _BookTimeSetPageState extends State<BookTimeSetPage> { | ||
| 493 | )); | 432 | )); |
| 494 | } | 433 | } |
| 495 | 434 | ||
| 496 | - ///工具 | ||
| 497 | - /// 组装成07:00 | ||
| 498 | - _getTimeString(dynamic hour, String minute) { | ||
| 499 | - return '${hour}:${minute}'; | ||
| 500 | - } | ||
| 501 | - | ||
| 502 | - /// 组装成 07:00-10:00 | ||
| 503 | - _getTimelLongString(String start, String end) { | ||
| 504 | - return '${start}-${end}'; | ||
| 505 | - } | ||
| 506 | - | ||
| 507 | - /// 从07:00中获取07 | ||
| 508 | - _getHourFromhourAndMinute(String hourAndMinute) { | ||
| 509 | - return hourAndMinute.substring(0, 2); | ||
| 510 | - } | ||
| 511 | - | ||
| 512 | - ///从深夜00时中获取00 | ||
| 513 | - _getHourFromTitle(String title) { | ||
| 514 | - return title.substring(2, 4); | ||
| 515 | - } | ||
| 516 | - | ||
| 517 | - // 第一列当前选中第几个 | ||
| 518 | - _getFirSelected(String hourAndMinute, List data) { | ||
| 519 | - String hour = _getHourFromhourAndMinute(hourAndMinute); | ||
| 520 | - for (int i = 0; i < data.length; i++) { | ||
| 521 | - Map map = data[i]; | ||
| 522 | - String key = map.keys.first; | ||
| 523 | - if (key.contains(hour)) { | ||
| 524 | - return i; | ||
| 525 | - } | ||
| 526 | - } | ||
| 527 | - return 0; | ||
| 528 | - } | ||
| 529 | - | ||
| 530 | - // 第二列当前选中第几个 | ||
| 531 | - _getSecSelected(String hourAndMinute) { | ||
| 532 | - String minute = _getMinuteFromhourAndMinute(hourAndMinute); | ||
| 533 | - if (minute == '00') { | ||
| 534 | - return 0; | ||
| 535 | - } | ||
| 536 | - return 1; | ||
| 537 | - } | ||
| 538 | - | ||
| 539 | - /// 0 还是 30 | ||
| 540 | - /// 从07:00中获取0 或者 30 | ||
| 541 | - _getMinuteFromhourAndMinute(String hourAndMinute) { | ||
| 542 | - return hourAndMinute.substring(3, 5); | ||
| 543 | - } | ||
| 544 | - | ||
| 545 | - ///获取选择器数据 | ||
| 546 | - _getPickerData(String lastTime) { | ||
| 547 | - String hour = _getHourFromhourAndMinute(lastTime); | ||
| 548 | - String minute = _getMinuteFromhourAndMinute(lastTime); | ||
| 549 | - if (minute == '30') { | ||
| 550 | - hour = '${int.parse(hour) + 1}'; | ||
| 551 | - } | ||
| 552 | - List tempList = List(); | ||
| 553 | - tempList.addAll(dateData); | ||
| 554 | - tempList.removeRange(0, int.parse(hour)); | ||
| 555 | - if (tempList.length == 0) { | ||
| 556 | - tempList = [ | ||
| 557 | - { | ||
| 558 | - '晚上23时': [30] | ||
| 559 | - } | ||
| 560 | - ]; | ||
| 561 | - } | ||
| 562 | - return tempList; | ||
| 563 | - } | ||
| 564 | - | ||
| 565 | - ///判断时间大小 | ||
| 566 | - /// a < b 则 a = b | ||
| 567 | - _compareDateTime(String a, String b, BookTimeSetCallback callback) { | ||
| 568 | - String tempa = '${DateUtil.getNowDateStr().substring(0, 10)} ${a}:00'; | ||
| 569 | - String tempb = '${DateUtil.getNowDateStr().substring(0, 10)} ${b}:00'; | ||
| 570 | - int aMs = DateUtil.getDateMsByTimeStr(tempa); | ||
| 571 | - int bMs = DateUtil.getDateMsByTimeStr(tempb); | ||
| 572 | - if (aMs < bMs) { | ||
| 573 | - callback(true); | ||
| 574 | - } else { | ||
| 575 | - callback(false); | ||
| 576 | - } | ||
| 577 | - } | ||
| 578 | - | ||
| 579 | ///底部widget | 435 | ///底部widget |
| 580 | /// | 436 | /// |
| 581 | _bottomWidget() { | 437 | _bottomWidget() { |
| @@ -602,76 +458,90 @@ class _BookTimeSetPageState extends State<BookTimeSetPage> { | @@ -602,76 +458,90 @@ class _BookTimeSetPageState extends State<BookTimeSetPage> { | ||
| 602 | @override | 458 | @override |
| 603 | Widget build(BuildContext context) { | 459 | Widget build(BuildContext context) { |
| 604 | bookSetTimeModel = Provider.of<BookSetTimeModel>(context, listen: true); | 460 | bookSetTimeModel = Provider.of<BookSetTimeModel>(context, listen: true); |
| 605 | - return Scaffold( | ||
| 606 | - key: _scaffoldKey, | ||
| 607 | - backgroundColor: MyColours.color_f5f5f5, | ||
| 608 | - appBar: SystemAppBar('可订时段'), | ||
| 609 | - body: SafeArea( | ||
| 610 | - child: Column( | ||
| 611 | - children: [ | ||
| 612 | - Expanded( | ||
| 613 | - child: SingleChildScrollView( | ||
| 614 | - child: Column( | ||
| 615 | - children: [ | ||
| 616 | - _itemWidget('早市', morning.start, morning.end, 0), | ||
| 617 | - VEmptyView(20), | ||
| 618 | - _itemWidget('午市', noon.start, noon.end, 1), | ||
| 619 | - VEmptyView(20), | ||
| 620 | - _itemWidget('晚市', night.start, night.end, 2), | ||
| 621 | - _bottomWidget() | ||
| 622 | - ], | ||
| 623 | - ), | ||
| 624 | - )), | ||
| 625 | - Padding( | ||
| 626 | - padding: EdgeInsets.fromLTRB( | ||
| 627 | - ScreenUtil().setWidth(40), | ||
| 628 | - ScreenUtil().setWidth(0), | ||
| 629 | - ScreenUtil().setWidth(40), | ||
| 630 | - ScreenUtil().setWidth(60)), | ||
| 631 | - child: CommonButton( | ||
| 632 | - width: double.infinity, | ||
| 633 | - height: 84, | ||
| 634 | - fontSize: 34, | ||
| 635 | - content: '保存', | ||
| 636 | - state: 2, | ||
| 637 | - onPress: () async { | ||
| 638 | - String morningStr = ''; | ||
| 639 | - String noonStr = ''; | ||
| 640 | - String nightStr = ''; | ||
| 641 | - if (swichState[0]) { | ||
| 642 | - morningStr = | ||
| 643 | - _getTimelLongString(morning.start, morning.end); | ||
| 644 | - } | ||
| 645 | - if (swichState[1]) { | ||
| 646 | - noonStr = _getTimelLongString(noon.start, noon.end); | ||
| 647 | - } | ||
| 648 | - if (swichState[2]) { | ||
| 649 | - nightStr = _getTimelLongString(night.start, night.end); | ||
| 650 | - } | 461 | + return WillPopScope( |
| 462 | + child: Scaffold( | ||
| 463 | + key: _scaffoldKey, | ||
| 464 | + backgroundColor: MyColours.color_f5f5f5, | ||
| 465 | + appBar: SystemAppBar( | ||
| 466 | + '可订时段', | ||
| 467 | + onTap: () { | ||
| 468 | + EventBus().emit('changeStatusColor'); | ||
| 469 | + Navigator.of(context).pop(); | ||
| 470 | + }, | ||
| 471 | + ), | ||
| 472 | + body: SafeArea( | ||
| 473 | + child: Column( | ||
| 474 | + children: [ | ||
| 475 | + Expanded( | ||
| 476 | + child: SingleChildScrollView( | ||
| 477 | + child: Column( | ||
| 478 | + children: [ | ||
| 479 | + _itemWidget('早市', morning.start, morning.end, 0), | ||
| 480 | + VEmptyView(20), | ||
| 481 | + _itemWidget('午市', noon.start, noon.end, 1), | ||
| 482 | + VEmptyView(20), | ||
| 483 | + _itemWidget('晚市', night.start, night.end, 2), | ||
| 484 | + _bottomWidget() | ||
| 485 | + ], | ||
| 486 | + ), | ||
| 487 | + )), | ||
| 488 | + Padding( | ||
| 489 | + padding: EdgeInsets.fromLTRB( | ||
| 490 | + ScreenUtil().setWidth(40), | ||
| 491 | + ScreenUtil().setWidth(0), | ||
| 492 | + ScreenUtil().setWidth(40), | ||
| 493 | + ScreenUtil().setWidth(60)), | ||
| 494 | + child: CommonButton( | ||
| 495 | + width: double.infinity, | ||
| 496 | + height: 84, | ||
| 497 | + fontSize: 34, | ||
| 498 | + content: '保存', | ||
| 499 | + state: 2, | ||
| 500 | + onPress: () async { | ||
| 501 | + String morningStr = ''; | ||
| 502 | + String noonStr = ''; | ||
| 503 | + String nightStr = ''; | ||
| 504 | + if (swichState[0]) { | ||
| 505 | + morningStr = Utils.getTimelLongString( | ||
| 506 | + morning.start, morning.end); | ||
| 507 | + } | ||
| 508 | + if (swichState[1]) { | ||
| 509 | + noonStr = | ||
| 510 | + Utils.getTimelLongString(noon.start, noon.end); | ||
| 511 | + } | ||
| 512 | + if (swichState[2]) { | ||
| 513 | + nightStr = | ||
| 514 | + Utils.getTimelLongString(night.start, night.end); | ||
| 515 | + } | ||
| 651 | 516 | ||
| 652 | - DialogUtil.confirmTimeAlertDialog( | ||
| 653 | - context, morningStr, noonStr, nightStr, () async { | ||
| 654 | - ///接口 | ||
| 655 | - /// | ||
| 656 | - SetSellerInfoSunModel sunModel = await bookSetTimeModel | ||
| 657 | - .setSellerInfoById(context, { | ||
| 658 | - 'morning': morningStr, | ||
| 659 | - 'noon': noonStr, | ||
| 660 | - 'night': nightStr | ||
| 661 | - }); | ||
| 662 | - if (sunModel != null) { | ||
| 663 | - //修改成功 | ||
| 664 | - Utils.showToast('保存成功'); | ||
| 665 | - Navigator.pop(context); | ||
| 666 | - } else { | ||
| 667 | - // Utils.showToast('保存失败'); | ||
| 668 | - } | ||
| 669 | - }); | ||
| 670 | - }, | ||
| 671 | - )) | ||
| 672 | - ], | ||
| 673 | - )), | ||
| 674 | - ); | 517 | + DialogUtil.confirmTimeAlertDialog( |
| 518 | + context, morningStr, noonStr, nightStr, () async { | ||
| 519 | + ///接口 | ||
| 520 | + /// | ||
| 521 | + SetSellerInfoSunModel sunModel = await bookSetTimeModel | ||
| 522 | + .setSellerInfoById(context, { | ||
| 523 | + 'morning': morningStr, | ||
| 524 | + 'noon': noonStr, | ||
| 525 | + 'night': nightStr | ||
| 526 | + }); | ||
| 527 | + if (sunModel != null) { | ||
| 528 | + //修改成功 | ||
| 529 | + Utils.showToast('保存成功'); | ||
| 530 | + EventBus().emit('changeStatusColor'); | ||
| 531 | + Navigator.pop(context); | ||
| 532 | + } else { | ||
| 533 | + // Utils.showToast('保存失败'); | ||
| 534 | + } | ||
| 535 | + }); | ||
| 536 | + }, | ||
| 537 | + )) | ||
| 538 | + ], | ||
| 539 | + )), | ||
| 540 | + ), | ||
| 541 | + onWillPop: () async { | ||
| 542 | + EventBus().emit('changeStatusColor'); | ||
| 543 | + return true; | ||
| 544 | + }); | ||
| 675 | } | 545 | } |
| 676 | } | 546 | } |
| 677 | 547 |
| @@ -6,6 +6,7 @@ import 'package:one_key/provider/my_model.dart'; | @@ -6,6 +6,7 @@ import 'package:one_key/provider/my_model.dart'; | ||
| 6 | import 'package:one_key/provider/update_model.dart'; | 6 | import 'package:one_key/provider/update_model.dart'; |
| 7 | import 'package:one_key/provider/user_model.dart'; | 7 | import 'package:one_key/provider/user_model.dart'; |
| 8 | import 'package:one_key/res/colors.dart'; | 8 | import 'package:one_key/res/colors.dart'; |
| 9 | +import 'package:one_key/utils/event_bus.dart'; | ||
| 9 | import 'package:one_key/utils/navigator_util.dart'; | 10 | import 'package:one_key/utils/navigator_util.dart'; |
| 10 | import 'package:one_key/utils/utils.dart'; | 11 | import 'package:one_key/utils/utils.dart'; |
| 11 | import 'package:one_key/widgets/MyDivider.dart'; | 12 | import 'package:one_key/widgets/MyDivider.dart'; |
| @@ -35,6 +36,7 @@ class MyPageState extends State<MyPage> with WidgetsBindingObserver { | @@ -35,6 +36,7 @@ class MyPageState extends State<MyPage> with WidgetsBindingObserver { | ||
| 35 | void initState() { | 36 | void initState() { |
| 36 | // TODO: implement initState | 37 | // TODO: implement initState |
| 37 | super.initState(); | 38 | super.initState(); |
| 39 | + | ||
| 38 | controller = ScrollController(initialScrollOffset: 0.0); | 40 | controller = ScrollController(initialScrollOffset: 0.0); |
| 39 | WidgetsBinding.instance.addObserver(this); | 41 | WidgetsBinding.instance.addObserver(this); |
| 40 | Utils.getCurrVersion().then((version) { | 42 | Utils.getCurrVersion().then((version) { |
| @@ -46,6 +48,16 @@ class MyPageState extends State<MyPage> with WidgetsBindingObserver { | @@ -46,6 +48,16 @@ class MyPageState extends State<MyPage> with WidgetsBindingObserver { | ||
| 46 | ///获取短信余量 | 48 | ///获取短信余量 |
| 47 | _getSmsInfo(context); | 49 | _getSmsInfo(context); |
| 48 | }); | 50 | }); |
| 51 | + EventBus().on('changeStatusColor', (arg) { | ||
| 52 | + Utils.changeStatusColor(color: Colors.transparent); | ||
| 53 | + }); | ||
| 54 | + } | ||
| 55 | + | ||
| 56 | + @override | ||
| 57 | + void dispose() { | ||
| 58 | + // TODO: implement dispose | ||
| 59 | + super.dispose(); | ||
| 60 | + EventBus().off('changeStatusColor'); | ||
| 49 | } | 61 | } |
| 50 | 62 | ||
| 51 | @override | 63 | @override |
| @@ -103,229 +115,209 @@ class MyPageState extends State<MyPage> with WidgetsBindingObserver { | @@ -103,229 +115,209 @@ class MyPageState extends State<MyPage> with WidgetsBindingObserver { | ||
| 103 | fontWeight: FontWeight.normal, | 115 | fontWeight: FontWeight.normal, |
| 104 | decoration: TextDecoration.none), | 116 | decoration: TextDecoration.none), |
| 105 | )), | 117 | )), |
| 106 | - body: NestedScrollView( | ||
| 107 | - controller: controller, | ||
| 108 | - headerSliverBuilder: | ||
| 109 | - (BuildContext context, bool innerBoxIsScrolled) { | ||
| 110 | - return <Widget>[ | ||
| 111 | - SliverAppBar( | ||
| 112 | - pinned: false, | ||
| 113 | - floating: true, | ||
| 114 | - expandedHeight: ScreenUtil().setWidth(242), | ||
| 115 | - flexibleSpace: FlexibleSpaceBar( | ||
| 116 | - collapseMode: CollapseMode.pin, | ||
| 117 | - background: Container( | ||
| 118 | - //头部整个背景颜色 | ||
| 119 | - // height: ScreenUtil().getAdapterSize(800), | ||
| 120 | - child: Consumer<UserModel>(builder: | ||
| 121 | - (BuildContext context, UserModel model, | ||
| 122 | - Widget child) { | ||
| 123 | - return Stack( | ||
| 124 | - children: [ | ||
| 125 | - Container( | ||
| 126 | - width: double.infinity, | ||
| 127 | - height: ScreenUtil().setHeight(242 + 121), | ||
| 128 | - alignment: Alignment.centerLeft, | ||
| 129 | - color: MyColours.color_199095, | ||
| 130 | - ), | ||
| 131 | - Padding( | ||
| 132 | - padding: EdgeInsets.only( | ||
| 133 | - left: ScreenUtil().setWidth(40)), | ||
| 134 | - child: Column( | ||
| 135 | - crossAxisAlignment: CrossAxisAlignment.start, | ||
| 136 | - children: [ | ||
| 137 | - VEmptyView(38), | ||
| 138 | - Text( | ||
| 139 | - model.user.sellername, | ||
| 140 | - style: TextStyle( | ||
| 141 | - color: MyColours.color_ffffff, | ||
| 142 | - fontSize: ScreenUtil().setSp(36)), | ||
| 143 | - ), | ||
| 144 | - VEmptyView(38), | ||
| 145 | - Text( | ||
| 146 | - model.user.account + | ||
| 147 | - " | " + | ||
| 148 | - model.user.role_name, | ||
| 149 | - style: TextStyle( | ||
| 150 | - color: MyColours.color_ffffff, | ||
| 151 | - fontSize: ScreenUtil().setSp(30)), | ||
| 152 | - ), | ||
| 153 | - ], | ||
| 154 | - )) | ||
| 155 | - ], | ||
| 156 | - ); | ||
| 157 | - }))), | ||
| 158 | - ) | ||
| 159 | - ]; | ||
| 160 | - }, | ||
| 161 | - body: Consumer<UserModel>( | ||
| 162 | - builder: (BuildContext context, UserModel model, Widget child) { | ||
| 163 | - return SingleChildScrollView( | ||
| 164 | - physics: NeverScrollableScrollPhysics(), | 118 | + body: Consumer<UserModel>( |
| 119 | + builder: (BuildContext context, UserModel model, Widget child) { | ||
| 120 | + return MediaQuery.removePadding( | ||
| 121 | + context: context, | ||
| 122 | + child: SingleChildScrollView( | ||
| 165 | child: Column( | 123 | child: Column( |
| 166 | - children: <Widget>[ | ||
| 167 | - VEmptyView(40), | ||
| 168 | - MyItem( | ||
| 169 | - title: "短信管理", | ||
| 170 | - content: myModel.smsInfo.isNotEmpty | ||
| 171 | - ? '剩余${myModel.smsInfo}条' | ||
| 172 | - : '', | ||
| 173 | - callback: () { | ||
| 174 | - Utils.goMiniProgramZm(context, "setting/sms"); | ||
| 175 | - }, | ||
| 176 | - ), | ||
| 177 | - MyDivider( | ||
| 178 | - double.infinity, | ||
| 179 | - ScreenUtil().setHeight(1), | ||
| 180 | - color: MyColours.color_f3f3f3, | ||
| 181 | - ), | ||
| 182 | - MyItem( | ||
| 183 | - title: "包间类型置满管理", | ||
| 184 | - content: "", | ||
| 185 | - callback: () { | ||
| 186 | - Utils.goMiniProgramZm(context, "roomtype/roomtype"); | ||
| 187 | - }, | ||
| 188 | - ), | ||
| 189 | - MyDivider( | ||
| 190 | - double.infinity, | ||
| 191 | - ScreenUtil().setHeight(1), | ||
| 192 | - color: MyColours.color_f3f3f3, | ||
| 193 | - ), | ||
| 194 | - MyItem( | ||
| 195 | - title: "可订时段管理", | ||
| 196 | - content: "", | ||
| 197 | - callback: () { | ||
| 198 | - NavigatorUtil.goBookTimeSetPage(context); | ||
| 199 | - }, | ||
| 200 | - ), | ||
| 201 | - MyDivider( | ||
| 202 | - double.infinity, | ||
| 203 | - ScreenUtil().setHeight(1), | ||
| 204 | - color: MyColours.color_f3f3f3, | ||
| 205 | - ), | ||
| 206 | - MyItem( | ||
| 207 | - title: "接单时间管理", | ||
| 208 | - content: "", | ||
| 209 | - callback: () { | ||
| 210 | - NavigatorUtil.goReceiveOrdersTimeSetPage(context); | ||
| 211 | - }, | ||
| 212 | - ), | ||
| 213 | - VEmptyView(40), | ||
| 214 | - MyItem( | ||
| 215 | - title: "联系客服", | ||
| 216 | - content: "09:00~21:00", | ||
| 217 | - callback: () { | ||
| 218 | - Utils.goPhone("400-000-9690"); | ||
| 219 | - }, | ||
| 220 | - ), | ||
| 221 | - MyDivider( | ||
| 222 | - double.infinity, | ||
| 223 | - ScreenUtil().setHeight(1), | ||
| 224 | - color: MyColours.color_f3f3f3, | ||
| 225 | - ), | ||
| 226 | - MyItem( | ||
| 227 | - title: "帮助与反馈", | ||
| 228 | - content: "", | ||
| 229 | - callback: () { | ||
| 230 | - Utils.goHelp(context); | ||
| 231 | - }, | 124 | + children: <Widget>[ |
| 125 | + Stack( | ||
| 126 | + children: [ | ||
| 127 | + Container( | ||
| 128 | + width: double.infinity, | ||
| 129 | + height: ScreenUtil().setHeight(200), | ||
| 130 | + alignment: Alignment.centerLeft, | ||
| 131 | + color: MyColours.color_199095, | ||
| 232 | ), | 132 | ), |
| 233 | - MyDivider(double.infinity, ScreenUtil().setHeight(1), | ||
| 234 | - color: MyColours.color_f3f3f3), | ||
| 235 | - GestureDetector( | ||
| 236 | - onTap: checkUpdate, | ||
| 237 | - child: Container( | ||
| 238 | - width: double.infinity, | ||
| 239 | - height: ScreenUtil().setHeight(122), | ||
| 240 | - color: MyColours.color_ffffff, | ||
| 241 | - padding: EdgeInsets.symmetric( | ||
| 242 | - horizontal: ScreenUtil().setWidth(40)), | ||
| 243 | - alignment: Alignment.center, | ||
| 244 | - child: Row( | ||
| 245 | - children: <Widget>[ | 133 | + Padding( |
| 134 | + padding: | ||
| 135 | + EdgeInsets.only(left: ScreenUtil().setWidth(40)), | ||
| 136 | + child: Column( | ||
| 137 | + crossAxisAlignment: CrossAxisAlignment.start, | ||
| 138 | + children: [ | ||
| 139 | + VEmptyView(38), | ||
| 246 | Text( | 140 | Text( |
| 247 | - "版本更新", | 141 | + model.user.sellername, |
| 248 | style: TextStyle( | 142 | style: TextStyle( |
| 249 | - fontSize: ScreenUtil().setSp(30), | ||
| 250 | - color: MyColours.color_353535), | 143 | + color: MyColours.color_ffffff, |
| 144 | + fontSize: ScreenUtil().setSp(36)), | ||
| 145 | + ), | ||
| 146 | + VEmptyView(38), | ||
| 147 | + Text( | ||
| 148 | + model.user.account + | ||
| 149 | + " | " + | ||
| 150 | + model.user.role_name, | ||
| 151 | + style: TextStyle( | ||
| 152 | + color: MyColours.color_ffffff, | ||
| 153 | + fontSize: ScreenUtil().setSp(30)), | ||
| 251 | ), | 154 | ), |
| 252 | - Spacer(), | ||
| 253 | - newVersion | ||
| 254 | - ? Container( | ||
| 255 | - width: ScreenUtil().setWidth(120), | ||
| 256 | - height: ScreenUtil().setWidth(34), | ||
| 257 | - decoration: BoxDecoration( | ||
| 258 | - color: MyColours.color_E14553, | ||
| 259 | - borderRadius: BorderRadius.all( | ||
| 260 | - Radius.circular( | ||
| 261 | - ScreenUtil().setWidth(6))), | ||
| 262 | - ), | ||
| 263 | - child: Center( | ||
| 264 | - child: Text( | ||
| 265 | - "发现新版本", | ||
| 266 | - style: TextStyle( | ||
| 267 | - fontSize: ScreenUtil().setSp(24), | ||
| 268 | - color: MyColours.color_ffffff), | ||
| 269 | - ), | ||
| 270 | - ), | ||
| 271 | - ) | ||
| 272 | - : Text( | ||
| 273 | - cur_version, | ||
| 274 | - style: TextStyle( | ||
| 275 | - fontSize: ScreenUtil().setSp(28), | ||
| 276 | - color: MyColours.color_666666), | ||
| 277 | - ), | ||
| 278 | - HEmptyView(20), | ||
| 279 | - Image.asset( | ||
| 280 | - "assets/arr_right_gray.png", | ||
| 281 | - width: ScreenUtil().setWidth(14), | ||
| 282 | - height: ScreenUtil().setWidth(22), | ||
| 283 | - ) | ||
| 284 | ], | 155 | ], |
| 156 | + )) | ||
| 157 | + ], | ||
| 158 | + ), | ||
| 159 | + VEmptyView(40), | ||
| 160 | + MyItem( | ||
| 161 | + title: "短信管理", | ||
| 162 | + content: myModel.smsInfo.isNotEmpty | ||
| 163 | + ? '剩余${myModel.smsInfo}条' | ||
| 164 | + : '', | ||
| 165 | + callback: () { | ||
| 166 | + Utils.goMiniProgramZm(context, "setting/sms"); | ||
| 167 | + }, | ||
| 168 | + ), | ||
| 169 | + MyDivider( | ||
| 170 | + double.infinity, | ||
| 171 | + ScreenUtil().setHeight(1), | ||
| 172 | + color: MyColours.color_f3f3f3, | ||
| 173 | + ), | ||
| 174 | + MyItem( | ||
| 175 | + title: "包间类型置满管理", | ||
| 176 | + content: "", | ||
| 177 | + callback: () { | ||
| 178 | + Utils.goMiniProgramZm(context, "roomtype/roomtype"); | ||
| 179 | + }, | ||
| 180 | + ), | ||
| 181 | + MyDivider( | ||
| 182 | + double.infinity, | ||
| 183 | + ScreenUtil().setHeight(1), | ||
| 184 | + color: MyColours.color_f3f3f3, | ||
| 185 | + ), | ||
| 186 | + MyItem( | ||
| 187 | + title: "可订时段管理", | ||
| 188 | + content: "", | ||
| 189 | + callback: () { | ||
| 190 | + NavigatorUtil.goBookTimeSetPage(context); | ||
| 191 | + }, | ||
| 192 | + ), | ||
| 193 | + MyDivider( | ||
| 194 | + double.infinity, | ||
| 195 | + ScreenUtil().setHeight(1), | ||
| 196 | + color: MyColours.color_f3f3f3, | ||
| 197 | + ), | ||
| 198 | + MyItem( | ||
| 199 | + title: "接单时间管理", | ||
| 200 | + content: "", | ||
| 201 | + callback: () { | ||
| 202 | + NavigatorUtil.goReceiveOrdersTimeSetPage(context); | ||
| 203 | + }, | ||
| 204 | + ), | ||
| 205 | + VEmptyView(40), | ||
| 206 | + MyItem( | ||
| 207 | + title: "联系客服", | ||
| 208 | + content: "09:00~21:00", | ||
| 209 | + callback: () { | ||
| 210 | + Utils.goPhone("400-000-9690"); | ||
| 211 | + }, | ||
| 212 | + ), | ||
| 213 | + MyDivider( | ||
| 214 | + double.infinity, | ||
| 215 | + ScreenUtil().setHeight(1), | ||
| 216 | + color: MyColours.color_f3f3f3, | ||
| 217 | + ), | ||
| 218 | + MyItem( | ||
| 219 | + title: "帮助与反馈", | ||
| 220 | + content: "", | ||
| 221 | + callback: () { | ||
| 222 | + Utils.goHelp(context); | ||
| 223 | + }, | ||
| 224 | + ), | ||
| 225 | + MyDivider(double.infinity, ScreenUtil().setHeight(1), | ||
| 226 | + color: MyColours.color_f3f3f3), | ||
| 227 | + GestureDetector( | ||
| 228 | + onTap: checkUpdate, | ||
| 229 | + child: Container( | ||
| 230 | + width: double.infinity, | ||
| 231 | + height: ScreenUtil().setHeight(122), | ||
| 232 | + color: MyColours.color_ffffff, | ||
| 233 | + padding: EdgeInsets.symmetric( | ||
| 234 | + horizontal: ScreenUtil().setWidth(40)), | ||
| 235 | + alignment: Alignment.center, | ||
| 236 | + child: Row( | ||
| 237 | + children: <Widget>[ | ||
| 238 | + Text( | ||
| 239 | + "版本更新", | ||
| 240 | + style: TextStyle( | ||
| 241 | + fontSize: ScreenUtil().setSp(30), | ||
| 242 | + color: MyColours.color_353535), | ||
| 285 | ), | 243 | ), |
| 286 | - ), | ||
| 287 | - ), | ||
| 288 | - MyDivider( | ||
| 289 | - double.infinity, | ||
| 290 | - ScreenUtil().setHeight(1), | ||
| 291 | - color: MyColours.color_f3f3f3, | ||
| 292 | - ), | ||
| 293 | - VEmptyView(40), | ||
| 294 | - Consumer<UserModel>( | ||
| 295 | - builder: (BuildContext context, UserModel model, | ||
| 296 | - Widget child) { | ||
| 297 | - return GestureDetector( | ||
| 298 | - onTap: () { | ||
| 299 | - model.showLoginOutDialog(context); | ||
| 300 | - }, | ||
| 301 | - child: Container( | ||
| 302 | - height: ScreenUtil().setHeight(122), | ||
| 303 | - color: MyColours.color_ffffff, | ||
| 304 | - child: Center( | ||
| 305 | - child: Row( | ||
| 306 | - mainAxisSize: MainAxisSize.min, | ||
| 307 | - crossAxisAlignment: CrossAxisAlignment.center, | ||
| 308 | - children: <Widget>[ | ||
| 309 | - Image.asset( | ||
| 310 | - "assets/icon_exist.png", | ||
| 311 | - width: ScreenUtil().setWidth(30), | ||
| 312 | - height: ScreenUtil().setWidth(30), | 244 | + Spacer(), |
| 245 | + newVersion | ||
| 246 | + ? Container( | ||
| 247 | + width: ScreenUtil().setWidth(120), | ||
| 248 | + height: ScreenUtil().setWidth(34), | ||
| 249 | + decoration: BoxDecoration( | ||
| 250 | + color: MyColours.color_E14553, | ||
| 251 | + borderRadius: BorderRadius.all( | ||
| 252 | + Radius.circular( | ||
| 253 | + ScreenUtil().setWidth(6))), | ||
| 254 | + ), | ||
| 255 | + child: Center( | ||
| 256 | + child: Text( | ||
| 257 | + "发现新版本", | ||
| 258 | + style: TextStyle( | ||
| 259 | + fontSize: ScreenUtil().setSp(24), | ||
| 260 | + color: MyColours.color_ffffff), | ||
| 313 | ), | 261 | ), |
| 314 | - HEmptyView(18), | ||
| 315 | - Text("退出登录", | ||
| 316 | - style: TextStyle( | ||
| 317 | - color: MyColours.color_199095, | ||
| 318 | - fontSize: ScreenUtil().setSp(34), | ||
| 319 | - )) | ||
| 320 | - ], | 262 | + ), |
| 263 | + ) | ||
| 264 | + : Text( | ||
| 265 | + cur_version, | ||
| 266 | + style: TextStyle( | ||
| 267 | + fontSize: ScreenUtil().setSp(28), | ||
| 268 | + color: MyColours.color_666666), | ||
| 321 | ), | 269 | ), |
| 322 | - ), | ||
| 323 | - ), | ||
| 324 | - ); | 270 | + HEmptyView(20), |
| 271 | + Image.asset( | ||
| 272 | + "assets/arr_right_gray.png", | ||
| 273 | + width: ScreenUtil().setWidth(14), | ||
| 274 | + height: ScreenUtil().setWidth(22), | ||
| 275 | + ) | ||
| 276 | + ], | ||
| 277 | + ), | ||
| 278 | + ), | ||
| 279 | + ), | ||
| 280 | + MyDivider( | ||
| 281 | + double.infinity, | ||
| 282 | + ScreenUtil().setHeight(1), | ||
| 283 | + color: MyColours.color_f3f3f3, | ||
| 284 | + ), | ||
| 285 | + VEmptyView(40), | ||
| 286 | + Consumer<UserModel>( | ||
| 287 | + builder: | ||
| 288 | + (BuildContext context, UserModel model, Widget child) { | ||
| 289 | + return GestureDetector( | ||
| 290 | + onTap: () { | ||
| 291 | + model.showLoginOutDialog(context); | ||
| 325 | }, | 292 | }, |
| 326 | - ) | ||
| 327 | - ], | ||
| 328 | - )); | ||
| 329 | - }))); | 293 | + child: Container( |
| 294 | + height: ScreenUtil().setHeight(122), | ||
| 295 | + color: MyColours.color_ffffff, | ||
| 296 | + child: Center( | ||
| 297 | + child: Row( | ||
| 298 | + mainAxisSize: MainAxisSize.min, | ||
| 299 | + crossAxisAlignment: CrossAxisAlignment.center, | ||
| 300 | + children: <Widget>[ | ||
| 301 | + Image.asset( | ||
| 302 | + "assets/icon_exist.png", | ||
| 303 | + width: ScreenUtil().setWidth(30), | ||
| 304 | + height: ScreenUtil().setWidth(30), | ||
| 305 | + ), | ||
| 306 | + HEmptyView(18), | ||
| 307 | + Text("退出登录", | ||
| 308 | + style: TextStyle( | ||
| 309 | + color: MyColours.color_199095, | ||
| 310 | + fontSize: ScreenUtil().setSp(34), | ||
| 311 | + )) | ||
| 312 | + ], | ||
| 313 | + ), | ||
| 314 | + ), | ||
| 315 | + ), | ||
| 316 | + ); | ||
| 317 | + }, | ||
| 318 | + ) | ||
| 319 | + ], | ||
| 320 | + ))); | ||
| 321 | + })); | ||
| 330 | } | 322 | } |
| 331 | } | 323 | } |
| 1 | import 'package:flutter/material.dart'; | 1 | import 'package:flutter/material.dart'; |
| 2 | import 'package:flutter_screenutil/screenutil.dart'; | 2 | import 'package:flutter_screenutil/screenutil.dart'; |
| 3 | +import 'package:one_key/models/get_seller_info_model.dart'; | ||
| 3 | import 'package:one_key/models/settime.dart'; | 4 | import 'package:one_key/models/settime.dart'; |
| 4 | import 'package:one_key/pages/my/book_time_set.dart'; | 5 | import 'package:one_key/pages/my/book_time_set.dart'; |
| 6 | +import 'package:one_key/provider/book_set_time_model.dart'; | ||
| 5 | import 'package:one_key/res/colors.dart'; | 7 | import 'package:one_key/res/colors.dart'; |
| 8 | +import 'package:one_key/utils/dialog_util.dart'; | ||
| 9 | +import 'package:one_key/utils/event_bus.dart'; | ||
| 10 | +import 'package:one_key/utils/utils.dart'; | ||
| 6 | import 'package:one_key/widgets/MyDivider.dart'; | 11 | import 'package:one_key/widgets/MyDivider.dart'; |
| 7 | import 'package:one_key/widgets/common_button.dart'; | 12 | import 'package:one_key/widgets/common_button.dart'; |
| 13 | +import 'package:one_key/widgets/set_time_widget.dart'; | ||
| 8 | import 'package:one_key/widgets/system_app_bar.dart'; | 14 | import 'package:one_key/widgets/system_app_bar.dart'; |
| 9 | import 'package:one_key/widgets/v_empty_view.dart'; | 15 | import 'package:one_key/widgets/v_empty_view.dart'; |
| 16 | +import 'package:provider/provider.dart'; | ||
| 10 | 17 | ||
| 11 | class ReceiveOrdersTimeSetPage extends StatefulWidget { | 18 | class ReceiveOrdersTimeSetPage extends StatefulWidget { |
| 12 | ReceiveOrdersTimeSetPage({Key key}) : super(key: key); | 19 | ReceiveOrdersTimeSetPage({Key key}) : super(key: key); |
| @@ -18,76 +25,160 @@ class ReceiveOrdersTimeSetPage extends StatefulWidget { | @@ -18,76 +25,160 @@ class ReceiveOrdersTimeSetPage extends StatefulWidget { | ||
| 18 | 25 | ||
| 19 | class _ReceiveOrdersTimeSetPageState extends State<ReceiveOrdersTimeSetPage> { | 26 | class _ReceiveOrdersTimeSetPageState extends State<ReceiveOrdersTimeSetPage> { |
| 20 | SetTime receiveOrdersTime = SetTime(); | 27 | SetTime receiveOrdersTime = SetTime(); |
| 28 | + BookSetTimeModel bookSetTimeModel; | ||
| 21 | 29 | ||
| 22 | @override | 30 | @override |
| 23 | void initState() { | 31 | void initState() { |
| 24 | super.initState(); | 32 | super.initState(); |
| 33 | + receiveOrdersTime.start = '08:00'; | ||
| 34 | + receiveOrdersTime.end = '23:00'; | ||
| 25 | WidgetsBinding.instance.addPostFrameCallback((_) { | 35 | WidgetsBinding.instance.addPostFrameCallback((_) { |
| 26 | - // _getDailyTime(); | 36 | + _getReceiveOrdersTime(); |
| 37 | + }); | ||
| 38 | + } | ||
| 39 | + | ||
| 40 | + ///获取接单时间接口 | ||
| 41 | + _getReceiveOrdersTime() async { | ||
| 42 | + GetSellerInfoSunModel model = await bookSetTimeModel.getSellerById(context); | ||
| 43 | + setState(() { | ||
| 44 | + receiveOrdersTime.start = model.data.recStime; | ||
| 45 | + receiveOrdersTime.end = model.data.recEtime; | ||
| 27 | }); | 46 | }); |
| 28 | } | 47 | } |
| 29 | 48 | ||
| 30 | @override | 49 | @override |
| 31 | Widget build(BuildContext context) { | 50 | Widget build(BuildContext context) { |
| 32 | - return Scaffold( | ||
| 33 | - backgroundColor: MyColours.color_f5f5f5, | ||
| 34 | - appBar: SystemAppBar('接单时间'), | ||
| 35 | - body: SafeArea( | ||
| 36 | - child: Column( | ||
| 37 | - children: [ | ||
| 38 | - Expanded( | ||
| 39 | - child: SingleChildScrollView( | ||
| 40 | - child: Column( | ||
| 41 | - crossAxisAlignment: CrossAxisAlignment.start, | ||
| 42 | - children: [ | ||
| 43 | - Container( | ||
| 44 | - height: ScreenUtil().setWidth(126 * 2), | ||
| 45 | - color: MyColours.color_ffffff, | ||
| 46 | - child: Column( | ||
| 47 | - children: [ | ||
| 48 | - timeWidget('开始时间', '07:00', highted: true, onTap: () {}), | ||
| 49 | - Padding( | ||
| 50 | - padding: EdgeInsets.symmetric( | ||
| 51 | - horizontal: ScreenUtil().setWidth(40)), | ||
| 52 | - child: MyDivider( | ||
| 53 | - double.infinity, | ||
| 54 | - ScreenUtil().setWidth(2), | ||
| 55 | - color: MyColours.color_f3f3f3, | ||
| 56 | - )), | ||
| 57 | - timeWidget('结束时间', '07:00', highted: true, onTap: () {}), | ||
| 58 | - ], | ||
| 59 | - ), | ||
| 60 | - ), | ||
| 61 | - VEmptyView(60), | ||
| 62 | - Padding( | ||
| 63 | - padding: EdgeInsets.symmetric( | ||
| 64 | - horizontal: ScreenUtil().setWidth(40)), | ||
| 65 | - child: textWidget('温馨提示:'), | 51 | + bookSetTimeModel = Provider.of<BookSetTimeModel>(context, listen: true); |
| 52 | + return WillPopScope( | ||
| 53 | + child: Scaffold( | ||
| 54 | + backgroundColor: MyColours.color_f5f5f5, | ||
| 55 | + appBar: SystemAppBar( | ||
| 56 | + '接单时间', | ||
| 57 | + onTap: () { | ||
| 58 | + EventBus().emit('changeStatusColor'); | ||
| 59 | + Navigator.of(context).pop(); | ||
| 60 | + }, | ||
| 61 | + ), | ||
| 62 | + body: SafeArea( | ||
| 63 | + child: Column( | ||
| 64 | + children: [ | ||
| 65 | + Expanded( | ||
| 66 | + child: SingleChildScrollView( | ||
| 67 | + child: Column( | ||
| 68 | + crossAxisAlignment: CrossAxisAlignment.start, | ||
| 69 | + children: [ | ||
| 70 | + Container( | ||
| 71 | + height: ScreenUtil().setWidth(126 * 2), | ||
| 72 | + color: MyColours.color_ffffff, | ||
| 73 | + child: Column( | ||
| 74 | + children: [ | ||
| 75 | + timeWidget('开始时间', receiveOrdersTime.start, | ||
| 76 | + highted: true, onTap: () { | ||
| 77 | + SetTimeWidget().showTimeSelector( | ||
| 78 | + context, | ||
| 79 | + SetTimeWidget.dateData, | ||
| 80 | + receiveOrdersTime.start, (value) { | ||
| 81 | + if (value != null) { | ||
| 82 | + String temp; | ||
| 83 | + if (value[1] == 0) { | ||
| 84 | + temp = '00'; | ||
| 85 | + } else { | ||
| 86 | + temp = '30'; | ||
| 87 | + } | ||
| 88 | + String time = Utils.getTimeString( | ||
| 89 | + Utils.getHourFromTitle(SetTimeWidget | ||
| 90 | + .dateData[value[0]].keys.first), | ||
| 91 | + temp); | ||
| 92 | + setState(() { | ||
| 93 | + receiveOrdersTime.start = time; | ||
| 94 | + }); | ||
| 95 | + } | ||
| 96 | + }); | ||
| 97 | + }), | ||
| 98 | + Padding( | ||
| 99 | + padding: EdgeInsets.symmetric( | ||
| 100 | + horizontal: ScreenUtil().setWidth(40)), | ||
| 101 | + child: MyDivider( | ||
| 102 | + double.infinity, | ||
| 103 | + ScreenUtil().setWidth(2), | ||
| 104 | + color: MyColours.color_f3f3f3, | ||
| 105 | + )), | ||
| 106 | + timeWidget('结束时间', receiveOrdersTime.end, | ||
| 107 | + highted: true, onTap: () { | ||
| 108 | + SetTimeWidget().showTimeSelector( | ||
| 109 | + context, | ||
| 110 | + SetTimeWidget.dateData, | ||
| 111 | + receiveOrdersTime.end, (value) { | ||
| 112 | + if (value != null) { | ||
| 113 | + String temp; | ||
| 114 | + if (value[1] == 0) { | ||
| 115 | + temp = '00'; | ||
| 116 | + } else { | ||
| 117 | + temp = '30'; | ||
| 118 | + } | ||
| 119 | + String time = Utils.getTimeString( | ||
| 120 | + Utils.getHourFromTitle(SetTimeWidget | ||
| 121 | + .dateData[value[0]].keys.first), | ||
| 122 | + temp); | ||
| 123 | + setState(() { | ||
| 124 | + receiveOrdersTime.end = time; | ||
| 125 | + }); | ||
| 126 | + } | ||
| 127 | + }); | ||
| 128 | + }), | ||
| 129 | + ], | ||
| 130 | + ), | ||
| 131 | + ), | ||
| 132 | + VEmptyView(60), | ||
| 133 | + Padding( | ||
| 134 | + padding: EdgeInsets.symmetric( | ||
| 135 | + horizontal: ScreenUtil().setWidth(40)), | ||
| 136 | + child: textWidget('温馨提示:'), | ||
| 137 | + ), | ||
| 138 | + VEmptyView(10), | ||
| 139 | + Padding( | ||
| 140 | + padding: EdgeInsets.symmetric( | ||
| 141 | + horizontal: ScreenUtil().setWidth(40)), | ||
| 142 | + child: textWidget('修改接单时间后,必须重启话机才能正常生效。')) | ||
| 143 | + ], | ||
| 66 | ), | 144 | ), |
| 67 | - VEmptyView(10), | ||
| 68 | - Padding( | ||
| 69 | - padding: EdgeInsets.symmetric( | ||
| 70 | - horizontal: ScreenUtil().setWidth(40)), | ||
| 71 | - child: textWidget('修改接单时间后,必须重启话机才能正常生效。')) | ||
| 72 | - ], | ||
| 73 | - ), | 145 | + )), |
| 146 | + Padding( | ||
| 147 | + padding: EdgeInsets.fromLTRB( | ||
| 148 | + ScreenUtil().setWidth(40), | ||
| 149 | + ScreenUtil().setWidth(0), | ||
| 150 | + ScreenUtil().setWidth(40), | ||
| 151 | + ScreenUtil().setWidth(60)), | ||
| 152 | + child: CommonButton( | ||
| 153 | + width: double.infinity, | ||
| 154 | + height: 84, | ||
| 155 | + fontSize: 34, | ||
| 156 | + content: '保存', | ||
| 157 | + state: 2, | ||
| 158 | + onPress: () async { | ||
| 159 | + bool isSuccess = await bookSetTimeModel.setReOrderTime( | ||
| 160 | + context, | ||
| 161 | + receiveOrdersTime.start, | ||
| 162 | + receiveOrdersTime.end); | ||
| 163 | + if (isSuccess) { | ||
| 164 | + ///弹出提示框 | ||
| 165 | + /// | ||
| 166 | + DialogUtil.openAlertDialog( | ||
| 167 | + context, '接单时间已修改', '需要重启电话机才能生效', '知道了', 295, | ||
| 168 | + onTap: () { | ||
| 169 | + EventBus().emit('changeStatusColor'); | ||
| 170 | + Navigator.of(context).pop(); | ||
| 171 | + Navigator.of(context).pop(); | ||
| 172 | + }); | ||
| 173 | + } | ||
| 174 | + }, | ||
| 175 | + )) | ||
| 176 | + ], | ||
| 74 | )), | 177 | )), |
| 75 | - Padding( | ||
| 76 | - padding: EdgeInsets.fromLTRB( | ||
| 77 | - ScreenUtil().setWidth(40), | ||
| 78 | - ScreenUtil().setWidth(0), | ||
| 79 | - ScreenUtil().setWidth(40), | ||
| 80 | - ScreenUtil().setWidth(60)), | ||
| 81 | - child: CommonButton( | ||
| 82 | - width: double.infinity, | ||
| 83 | - height: 84, | ||
| 84 | - fontSize: 34, | ||
| 85 | - content: '保存', | ||
| 86 | - state: 2, | ||
| 87 | - onPress: () async {}, | ||
| 88 | - )) | ||
| 89 | - ], | ||
| 90 | - )), | ||
| 91 | - ); | 178 | + ), |
| 179 | + onWillPop: () async { | ||
| 180 | + EventBus().emit('changeStatusColor'); | ||
| 181 | + return true; | ||
| 182 | + }); | ||
| 92 | } | 183 | } |
| 93 | } | 184 | } |
| @@ -2,28 +2,29 @@ import 'dart:async'; | @@ -2,28 +2,29 @@ import 'dart:async'; | ||
| 2 | import 'dart:convert'; | 2 | import 'dart:convert'; |
| 3 | 3 | ||
| 4 | import 'package:flutter/material.dart'; | 4 | import 'package:flutter/material.dart'; |
| 5 | +import 'package:one_key/utils/event_bus.dart'; | ||
| 5 | import 'package:one_key/widgets/app_bar.dart'; | 6 | import 'package:one_key/widgets/app_bar.dart'; |
| 7 | +import 'package:one_key/widgets/system_app_bar.dart'; | ||
| 6 | import 'package:webview_flutter/webview_flutter.dart'; | 8 | import 'package:webview_flutter/webview_flutter.dart'; |
| 7 | 9 | ||
| 8 | class WebViewPage extends StatefulWidget { | 10 | class WebViewPage extends StatefulWidget { |
| 9 | - | ||
| 10 | @override | 11 | @override |
| 11 | _WebViewPageState createState() => _WebViewPageState(); | 12 | _WebViewPageState createState() => _WebViewPageState(); |
| 12 | } | 13 | } |
| 13 | 14 | ||
| 14 | class _WebViewPageState extends State<WebViewPage> { | 15 | class _WebViewPageState extends State<WebViewPage> { |
| 15 | final Completer<WebViewController> _controller = | 16 | final Completer<WebViewController> _controller = |
| 16 | - Completer<WebViewController>(); | 17 | + Completer<WebViewController>(); |
| 17 | 18 | ||
| 18 | @override | 19 | @override |
| 19 | Widget build(BuildContext context) { | 20 | Widget build(BuildContext context) { |
| 20 | return Scaffold( | 21 | return Scaffold( |
| 21 | // We're using a Builder here so we have a context that is below the Scaffold | 22 | // We're using a Builder here so we have a context that is below the Scaffold |
| 22 | // to allow calling Scaffold.of(context) so we can show a snackbar. | 23 | // to allow calling Scaffold.of(context) so we can show a snackbar. |
| 23 | - appBar: AppBar( | ||
| 24 | - title: const Text('一键订'), | ||
| 25 | - // This drop down menu demonstrates that Flutter widgets can be shown over the web view. | ||
| 26 | - ), | 24 | + appBar: SystemAppBar('一键订',onTap: () { |
| 25 | + EventBus().emit('changeStatusColor'); | ||
| 26 | + Navigator.of(context).pop(); | ||
| 27 | + },), | ||
| 27 | body: Builder(builder: (BuildContext context) { | 28 | body: Builder(builder: (BuildContext context) { |
| 28 | return WebView( | 29 | return WebView( |
| 29 | initialUrl: "https://support.qq.com/product/152856", | 30 | initialUrl: "https://support.qq.com/product/152856", |
| @@ -65,5 +66,4 @@ class _WebViewPageState extends State<WebViewPage> { | @@ -65,5 +66,4 @@ class _WebViewPageState extends State<WebViewPage> { | ||
| 65 | ); | 66 | ); |
| 66 | }); | 67 | }); |
| 67 | } | 68 | } |
| 68 | - | ||
| 69 | -} | ||
| 69 | +} |
| @@ -2,9 +2,9 @@ import 'dart:convert'; | @@ -2,9 +2,9 @@ import 'dart:convert'; | ||
| 2 | 2 | ||
| 3 | import 'package:flutter/material.dart'; | 3 | import 'package:flutter/material.dart'; |
| 4 | import 'package:one_key/constant/constant.dart'; | 4 | import 'package:one_key/constant/constant.dart'; |
| 5 | +import 'package:one_key/models/get_seller_info_model.dart'; | ||
| 5 | import 'package:one_key/models/seller_info.dart'; | 6 | import 'package:one_key/models/seller_info.dart'; |
| 6 | import 'package:one_key/models/set_seller_info_model.dart'; | 7 | import 'package:one_key/models/set_seller_info_model.dart'; |
| 7 | -import 'package:one_key/models/settime.dart'; | ||
| 8 | import 'package:one_key/net/base_resp.dart'; | 8 | import 'package:one_key/net/base_resp.dart'; |
| 9 | import 'package:one_key/net/dio_util.dart'; | 9 | import 'package:one_key/net/dio_util.dart'; |
| 10 | import 'package:one_key/net/http_url.dart'; | 10 | import 'package:one_key/net/http_url.dart'; |
| @@ -75,4 +75,68 @@ class BookSetTimeModel with ChangeNotifier { | @@ -75,4 +75,68 @@ class BookSetTimeModel with ChangeNotifier { | ||
| 75 | return itemModel; | 75 | return itemModel; |
| 76 | } | 76 | } |
| 77 | } | 77 | } |
| 78 | + | ||
| 79 | + ///根据商家ID获取商家信息 | ||
| 80 | + Future<GetSellerInfoSunModel> getSellerById(BuildContext context) async { | ||
| 81 | + UserModel userModel = Provider.of<UserModel>(context, listen: false); | ||
| 82 | + Map<String, String> params = { | ||
| 83 | + "sellerid": userModel.user.sellerid, | ||
| 84 | + }; | ||
| 85 | + BaseResp<Map<String, dynamic>> baseResp = await DioUtil() | ||
| 86 | + .request<Map<String, dynamic>>( | ||
| 87 | + context, Method.get, HttpUrl.get_seller_info, | ||
| 88 | + data: params) | ||
| 89 | + .catchError((error) { | ||
| 90 | + print(error.toString()); | ||
| 91 | + }); | ||
| 92 | + GetSellerInfoSunModel itemModel; | ||
| 93 | + if (baseResp == null) return itemModel; | ||
| 94 | + if (baseResp.code == Constant.status_success) { | ||
| 95 | + if (int.parse(baseResp.status) != Constant.status_success) { | ||
| 96 | + Utils.showToast(baseResp.msg ?? ""); | ||
| 97 | + return itemModel; | ||
| 98 | + } | ||
| 99 | + if (baseResp.responseData['data'] != null) { | ||
| 100 | + itemModel = GetSellerInfoModel.fromJson(baseResp.responseData).data; | ||
| 101 | + } else { | ||
| 102 | + Utils.showToast(baseResp.msg ?? ""); | ||
| 103 | + } | ||
| 104 | + return itemModel; | ||
| 105 | + } | ||
| 106 | + } | ||
| 107 | + | ||
| 108 | + ///在线预订配置-接单时间 | ||
| 109 | + Future<bool> setReOrderTime( | ||
| 110 | + BuildContext context, String start, String end) async { | ||
| 111 | + UserModel userModel = Provider.of<UserModel>(context, listen: false); | ||
| 112 | + Map<String, dynamic> params = { | ||
| 113 | + "sellerid": int.parse(userModel.user.sellerid), | ||
| 114 | + "start": start, | ||
| 115 | + 'end': end | ||
| 116 | + }; | ||
| 117 | + BaseResp<dynamic> baseResp = await DioUtil() | ||
| 118 | + .request<dynamic>(context, Method.get, HttpUrl.set_order_time, | ||
| 119 | + data: params) | ||
| 120 | + .catchError((error) { | ||
| 121 | + print(error.toString()); | ||
| 122 | + }); | ||
| 123 | + | ||
| 124 | + if (baseResp == null) return false; | ||
| 125 | + if (baseResp.code == Constant.status_success) { | ||
| 126 | + if (int.parse(baseResp.status) != Constant.status_success) { | ||
| 127 | + Utils.showToast(baseResp.msg ?? ""); | ||
| 128 | + return false; | ||
| 129 | + } | ||
| 130 | + if (baseResp.responseData['ret'] == 200) { | ||
| 131 | + // if (baseResp.responseData['data'] == 0) { | ||
| 132 | + return true; | ||
| 133 | + // } else { | ||
| 134 | + // return false; | ||
| 135 | + // } | ||
| 136 | + } else { | ||
| 137 | + Utils.showToast(baseResp.msg ?? ""); | ||
| 138 | + return false; | ||
| 139 | + } | ||
| 140 | + } | ||
| 141 | + } | ||
| 78 | } | 142 | } |
| @@ -145,7 +145,7 @@ var handleBookTimeSetHandler = new Handler( | @@ -145,7 +145,7 @@ var handleBookTimeSetHandler = new Handler( | ||
| 145 | create: (_) => BookSetTimeModel(), child: BookTimeSetPage()); | 145 | create: (_) => BookSetTimeModel(), child: BookTimeSetPage()); |
| 146 | }); | 146 | }); |
| 147 | 147 | ||
| 148 | -// 跳转可订时段管理页面 | 148 | +// 跳转接单时间管理 |
| 149 | var handleReceiveOrdersTimeSetHandler = new Handler( | 149 | var handleReceiveOrdersTimeSetHandler = new Handler( |
| 150 | handlerFunc: (BuildContext context, Map<String, List<Object>> params) { | 150 | handlerFunc: (BuildContext context, Map<String, List<Object>> params) { |
| 151 | return ChangeNotifierProvider<BookSetTimeModel>( | 151 | return ChangeNotifierProvider<BookSetTimeModel>( |
| @@ -683,14 +683,16 @@ class DialogUtil { | @@ -683,14 +683,16 @@ class DialogUtil { | ||
| 683 | }); | 683 | }); |
| 684 | } | 684 | } |
| 685 | 685 | ||
| 686 | - static Future openAlertDialog(BuildContext context) async { | 686 | + static Future openAlertDialog(BuildContext context, String title, |
| 687 | + String content, String btnTitle, double height, | ||
| 688 | + {GestureTapCallback onTap}) async { | ||
| 687 | final action = await showDialog( | 689 | final action = await showDialog( |
| 688 | context: context, | 690 | context: context, |
| 689 | barrierDismissible: true, | 691 | barrierDismissible: true, |
| 690 | builder: (BuildContext context) { | 692 | builder: (BuildContext context) { |
| 691 | return Center( | 693 | return Center( |
| 692 | child: Container( | 694 | child: Container( |
| 693 | - height: ScreenUtil().setWidth(160 * 2 + 20), | 695 | + height: ScreenUtil().setWidth(height), |
| 694 | width: ScreenUtil().setWidth(280 * 2), | 696 | width: ScreenUtil().setWidth(280 * 2), |
| 695 | decoration: BoxDecoration( | 697 | decoration: BoxDecoration( |
| 696 | borderRadius: BorderRadius.circular(ScreenUtil().setWidth(30))), | 698 | borderRadius: BorderRadius.circular(ScreenUtil().setWidth(30))), |
| @@ -704,7 +706,7 @@ class DialogUtil { | @@ -704,7 +706,7 @@ class DialogUtil { | ||
| 704 | Container( | 706 | Container( |
| 705 | height: ScreenUtil().setWidth(48), | 707 | height: ScreenUtil().setWidth(48), |
| 706 | alignment: Alignment.center, | 708 | alignment: Alignment.center, |
| 707 | - child: Text('未获得通讯录权限', | 709 | + child: Text(title, |
| 708 | style: TextStyle( | 710 | style: TextStyle( |
| 709 | fontSize: ScreenUtil().setSp(36), | 711 | fontSize: ScreenUtil().setSp(36), |
| 710 | color: MyColours.color_353535)), | 712 | color: MyColours.color_353535)), |
| @@ -723,7 +725,7 @@ class DialogUtil { | @@ -723,7 +725,7 @@ class DialogUtil { | ||
| 723 | ScreenUtil() | 725 | ScreenUtil() |
| 724 | .setWidth(2)), //1为 StrutStyle 的 leading的值 | 726 | .setWidth(2)), //1为 StrutStyle 的 leading的值 |
| 725 | child: Text( | 727 | child: Text( |
| 726 | - "请在手机的权限管理里,将通讯录权限开启", | 728 | + content, |
| 727 | style: TextStyle( | 729 | style: TextStyle( |
| 728 | color: MyColours.color_353535, | 730 | color: MyColours.color_353535, |
| 729 | fontSize: ScreenUtil().setSp(28), | 731 | fontSize: ScreenUtil().setSp(28), |
| @@ -743,16 +745,13 @@ class DialogUtil { | @@ -743,16 +745,13 @@ class DialogUtil { | ||
| 743 | height: ScreenUtil().setWidth(47 * 2), | 745 | height: ScreenUtil().setWidth(47 * 2), |
| 744 | alignment: Alignment.center, | 746 | alignment: Alignment.center, |
| 745 | child: Text( | 747 | child: Text( |
| 746 | - '去设置', | 748 | + btnTitle, |
| 747 | style: TextStyle( | 749 | style: TextStyle( |
| 748 | color: MyColours.color_2bb5b7, | 750 | color: MyColours.color_2bb5b7, |
| 749 | fontSize: ScreenUtil().setWidth(34)), | 751 | fontSize: ScreenUtil().setWidth(34)), |
| 750 | ), | 752 | ), |
| 751 | ), | 753 | ), |
| 752 | - onTap: () { | ||
| 753 | - openSetting(); | ||
| 754 | - Navigator.pop(context, ''); | ||
| 755 | - }, | 754 | + onTap: onTap, |
| 756 | ) | 755 | ) |
| 757 | ], | 756 | ], |
| 758 | ), | 757 | ), |
| @@ -761,20 +760,6 @@ class DialogUtil { | @@ -761,20 +760,6 @@ class DialogUtil { | ||
| 761 | ); | 760 | ); |
| 762 | }, | 761 | }, |
| 763 | ); | 762 | ); |
| 764 | - | ||
| 765 | - switch (action) { | ||
| 766 | - // case Action.Ok: | ||
| 767 | - // setState(() { | ||
| 768 | - // _choice = 'Ok'; | ||
| 769 | - // }); | ||
| 770 | - // break; | ||
| 771 | - // case Action.Cancel: | ||
| 772 | - // setState(() { | ||
| 773 | - // _choice = 'Cancel'; | ||
| 774 | - // }); | ||
| 775 | - // break; | ||
| 776 | - // default: | ||
| 777 | - } | ||
| 778 | } | 763 | } |
| 779 | 764 | ||
| 780 | ///时段设置提示弹框 | 765 | ///时段设置提示弹框 |
| @@ -18,9 +18,12 @@ import 'package:webview_flutter/webview_flutter.dart'; | @@ -18,9 +18,12 @@ import 'package:webview_flutter/webview_flutter.dart'; | ||
| 18 | 18 | ||
| 19 | import '../app.dart'; | 19 | import '../app.dart'; |
| 20 | 20 | ||
| 21 | +typedef BookTimeSetCallback = void Function(bool needChange); | ||
| 22 | + | ||
| 21 | class Utils { | 23 | class Utils { |
| 22 | static void showToast(String msg) { | 24 | static void showToast(String msg) { |
| 23 | - Fluttertoast.showToast(msg: msg, toastLength:Toast.LENGTH_LONG,gravity: ToastGravity.CENTER); | 25 | + Fluttertoast.showToast( |
| 26 | + msg: msg, toastLength: Toast.LENGTH_LONG, gravity: ToastGravity.CENTER); | ||
| 24 | } | 27 | } |
| 25 | 28 | ||
| 26 | //本地图片资源路径 | 29 | //本地图片资源路径 |
| @@ -199,4 +202,64 @@ class Utils { | @@ -199,4 +202,64 @@ class Utils { | ||
| 199 | } | 202 | } |
| 200 | return pnum; | 203 | return pnum; |
| 201 | } | 204 | } |
| 205 | + | ||
| 206 | + ///工具 | ||
| 207 | + /// 组装成07:00 | ||
| 208 | + static getTimeString(dynamic hour, String minute) { | ||
| 209 | + return '${hour}:${minute}'; | ||
| 210 | + } | ||
| 211 | + | ||
| 212 | + /// 组装成 07:00-10:00 | ||
| 213 | + static getTimelLongString(String start, String end) { | ||
| 214 | + return '${start}-${end}'; | ||
| 215 | + } | ||
| 216 | + | ||
| 217 | + /// 从07:00中获取07 | ||
| 218 | + static getHourFromhourAndMinute(String hourAndMinute) { | ||
| 219 | + return hourAndMinute.substring(0, 2); | ||
| 220 | + } | ||
| 221 | + | ||
| 222 | + ///从深夜00时中获取00 | ||
| 223 | + static getHourFromTitle(String title) { | ||
| 224 | + return title.substring(2, 4); | ||
| 225 | + } | ||
| 226 | + | ||
| 227 | + /// 0 还是 30 | ||
| 228 | + /// 从07:00中获取0 或者 30 | ||
| 229 | + static getMinuteFromhourAndMinute(String hourAndMinute) { | ||
| 230 | + return hourAndMinute.substring(3, 5); | ||
| 231 | + } | ||
| 232 | + | ||
| 233 | + /// a < b 则 a = b | ||
| 234 | + static compareDateTime(String a, String b, BookTimeSetCallback callback) { | ||
| 235 | + String tempa = '${DateUtil.getNowDateStr().substring(0, 10)} ${a}:00'; | ||
| 236 | + String tempb = '${DateUtil.getNowDateStr().substring(0, 10)} ${b}:00'; | ||
| 237 | + int aMs = DateUtil.getDateMsByTimeStr(tempa); | ||
| 238 | + int bMs = DateUtil.getDateMsByTimeStr(tempb); | ||
| 239 | + if (aMs < bMs) { | ||
| 240 | + callback(true); | ||
| 241 | + } else { | ||
| 242 | + callback(false); | ||
| 243 | + } | ||
| 244 | + } | ||
| 245 | + | ||
| 246 | + ///获取时间选择器数据 | ||
| 247 | + static getPickerData(String lastTime, List dateData) { | ||
| 248 | + String hour = Utils.getHourFromhourAndMinute(lastTime); | ||
| 249 | + String minute = Utils.getMinuteFromhourAndMinute(lastTime); | ||
| 250 | + if (minute == '30') { | ||
| 251 | + hour = '${int.parse(hour) + 1}'; | ||
| 252 | + } | ||
| 253 | + List tempList = List(); | ||
| 254 | + tempList.addAll(dateData); | ||
| 255 | + tempList.removeRange(0, int.parse(hour)); | ||
| 256 | + if (tempList.length == 0) { | ||
| 257 | + tempList = [ | ||
| 258 | + { | ||
| 259 | + '晚上23时': [30] | ||
| 260 | + } | ||
| 261 | + ]; | ||
| 262 | + } | ||
| 263 | + return tempList; | ||
| 264 | + } | ||
| 202 | } | 265 | } |
lib/widgets/set_time_widget.dart
0 → 100644
| 1 | +import 'package:flutter/material.dart'; | ||
| 2 | +import 'package:one_key/utils/dialog_util.dart'; | ||
| 3 | +import 'package:one_key/utils/utils.dart'; | ||
| 4 | + | ||
| 5 | +typedef SetTimeCallback = void Function(List value); | ||
| 6 | + | ||
| 7 | +class SetTimeWidget { | ||
| 8 | + static List dateData = [ | ||
| 9 | + { | ||
| 10 | + '深夜00时': [00, 30] | ||
| 11 | + }, | ||
| 12 | + { | ||
| 13 | + '深夜01时': [00, 30] | ||
| 14 | + }, | ||
| 15 | + { | ||
| 16 | + '深夜02时': [00, 30] | ||
| 17 | + }, | ||
| 18 | + { | ||
| 19 | + '深夜03时': [00, 30] | ||
| 20 | + }, | ||
| 21 | + { | ||
| 22 | + '深夜04时': [00, 30] | ||
| 23 | + }, | ||
| 24 | + { | ||
| 25 | + '深夜05时': [00, 30] | ||
| 26 | + }, | ||
| 27 | + { | ||
| 28 | + '早上06时': [00, 30] | ||
| 29 | + }, | ||
| 30 | + { | ||
| 31 | + '早上07时': [00, 30] | ||
| 32 | + }, | ||
| 33 | + { | ||
| 34 | + '早上08时': [00, 30] | ||
| 35 | + }, | ||
| 36 | + { | ||
| 37 | + '早上09时': [00, 30] | ||
| 38 | + }, | ||
| 39 | + { | ||
| 40 | + '中午10时': [00, 30] | ||
| 41 | + }, | ||
| 42 | + { | ||
| 43 | + '中午11时': [00, 30] | ||
| 44 | + }, | ||
| 45 | + { | ||
| 46 | + '中午12时': [00, 30] | ||
| 47 | + }, | ||
| 48 | + { | ||
| 49 | + '中午13时': [00, 30] | ||
| 50 | + }, | ||
| 51 | + { | ||
| 52 | + '中午14时': [00, 30] | ||
| 53 | + }, | ||
| 54 | + { | ||
| 55 | + '下午15时': [00, 30] | ||
| 56 | + }, | ||
| 57 | + { | ||
| 58 | + '下午16时': [00, 30] | ||
| 59 | + }, | ||
| 60 | + { | ||
| 61 | + '下午17时': [00, 30] | ||
| 62 | + }, | ||
| 63 | + { | ||
| 64 | + '下午18时': [00, 30] | ||
| 65 | + }, | ||
| 66 | + { | ||
| 67 | + '晚上19时': [00, 30] | ||
| 68 | + }, | ||
| 69 | + { | ||
| 70 | + '晚上20时': [00, 30] | ||
| 71 | + }, | ||
| 72 | + { | ||
| 73 | + '晚上21时': [00, 30] | ||
| 74 | + }, | ||
| 75 | + { | ||
| 76 | + '晚上22时': [00, 30] | ||
| 77 | + }, | ||
| 78 | + { | ||
| 79 | + '晚上23时': [00, 30] | ||
| 80 | + } | ||
| 81 | + ]; | ||
| 82 | + showTimeSelector(context, data, hourAndMinute, SetTimeCallback setTimeCallback) { | ||
| 83 | + DialogUtil.showSelectCusmanDialog(context, data, (value) { | ||
| 84 | + setTimeCallback(value); | ||
| 85 | + }, selecteds: [ | ||
| 86 | + _getFirSelected(hourAndMinute, data), | ||
| 87 | + _getSecSelected(hourAndMinute) | ||
| 88 | + ]).then((value) { | ||
| 89 | + print(value); | ||
| 90 | + }); | ||
| 91 | + } | ||
| 92 | + | ||
| 93 | + // 第一列当前选中第几个 | ||
| 94 | + _getFirSelected(String hourAndMinute, List data) { | ||
| 95 | + String hour = Utils.getHourFromhourAndMinute(hourAndMinute); | ||
| 96 | + for (int i = 0; i < data.length; i++) { | ||
| 97 | + Map map = data[i]; | ||
| 98 | + String key = map.keys.first; | ||
| 99 | + if (key.contains(hour)) { | ||
| 100 | + return i; | ||
| 101 | + } | ||
| 102 | + } | ||
| 103 | + return 0; | ||
| 104 | + } | ||
| 105 | + | ||
| 106 | + // 第二列当前选中第几个 | ||
| 107 | + _getSecSelected(String hourAndMinute) { | ||
| 108 | + String minute = Utils.getMinuteFromhourAndMinute(hourAndMinute); | ||
| 109 | + if (minute == '00') { | ||
| 110 | + return 0; | ||
| 111 | + } | ||
| 112 | + return 1; | ||
| 113 | + } | ||
| 114 | +} |
| 1 | - | ||
| 2 | import 'package:flutter/material.dart'; | 1 | import 'package:flutter/material.dart'; |
| 3 | import 'package:flutter_screenutil/screenutil.dart'; | 2 | import 'package:flutter_screenutil/screenutil.dart'; |
| 4 | import 'package:one_key/res/colors.dart'; | 3 | import 'package:one_key/res/colors.dart'; |
| @@ -16,9 +15,7 @@ class SystemAppBar extends StatelessWidget implements PreferredSizeWidget { | @@ -16,9 +15,7 @@ class SystemAppBar extends StatelessWidget implements PreferredSizeWidget { | ||
| 16 | return AppBar( | 15 | return AppBar( |
| 17 | elevation: 0, | 16 | elevation: 0, |
| 18 | leading: InkWell( | 17 | leading: InkWell( |
| 19 | - onTap: () { | ||
| 20 | - Navigator.of(context).pop(); | ||
| 21 | - }, | 18 | + onTap: onTap, |
| 22 | child: Padding( | 19 | child: Padding( |
| 23 | padding: EdgeInsets.symmetric( | 20 | padding: EdgeInsets.symmetric( |
| 24 | horizontal: ScreenUtil().setWidth(40), | 21 | horizontal: ScreenUtil().setWidth(40), |
-
Please register or login to post a comment