Showing
18 changed files
with
271 additions
and
142 deletions
| @@ -7,6 +7,8 @@ PODS: | @@ -7,6 +7,8 @@ PODS: | ||
| 7 | - Reachability | 7 | - Reachability |
| 8 | - connectivity_macos (0.0.1): | 8 | - connectivity_macos (0.0.1): |
| 9 | - Flutter | 9 | - Flutter |
| 10 | + - device_info (0.0.1): | ||
| 11 | + - Flutter | ||
| 10 | - Flutter (1.0.0) | 12 | - Flutter (1.0.0) |
| 11 | - flutter_bugly (0.0.1): | 13 | - flutter_bugly (0.0.1): |
| 12 | - Bugly | 14 | - Bugly |
| @@ -59,6 +61,7 @@ DEPENDENCIES: | @@ -59,6 +61,7 @@ DEPENDENCIES: | ||
| 59 | - audioplayers (from `.symlinks/plugins/audioplayers/ios`) | 61 | - audioplayers (from `.symlinks/plugins/audioplayers/ios`) |
| 60 | - connectivity (from `.symlinks/plugins/connectivity/ios`) | 62 | - connectivity (from `.symlinks/plugins/connectivity/ios`) |
| 61 | - connectivity_macos (from `.symlinks/plugins/connectivity_macos/ios`) | 63 | - connectivity_macos (from `.symlinks/plugins/connectivity_macos/ios`) |
| 64 | + - device_info (from `.symlinks/plugins/device_info/ios`) | ||
| 62 | - Flutter (from `Flutter`) | 65 | - Flutter (from `Flutter`) |
| 63 | - flutter_bugly (from `.symlinks/plugins/flutter_bugly/ios`) | 66 | - flutter_bugly (from `.symlinks/plugins/flutter_bugly/ios`) |
| 64 | - flutter_statusbarcolor (from `.symlinks/plugins/flutter_statusbarcolor/ios`) | 67 | - flutter_statusbarcolor (from `.symlinks/plugins/flutter_statusbarcolor/ios`) |
| @@ -94,6 +97,8 @@ EXTERNAL SOURCES: | @@ -94,6 +97,8 @@ EXTERNAL SOURCES: | ||
| 94 | :path: ".symlinks/plugins/connectivity/ios" | 97 | :path: ".symlinks/plugins/connectivity/ios" |
| 95 | connectivity_macos: | 98 | connectivity_macos: |
| 96 | :path: ".symlinks/plugins/connectivity_macos/ios" | 99 | :path: ".symlinks/plugins/connectivity_macos/ios" |
| 100 | + device_info: | ||
| 101 | + :path: ".symlinks/plugins/device_info/ios" | ||
| 97 | Flutter: | 102 | Flutter: |
| 98 | :path: Flutter | 103 | :path: Flutter |
| 99 | flutter_bugly: | 104 | flutter_bugly: |
| @@ -136,6 +141,7 @@ SPEC CHECKSUMS: | @@ -136,6 +141,7 @@ SPEC CHECKSUMS: | ||
| 136 | Bugly: 4edda9bb0e3017fd453612189069757195fa23ca | 141 | Bugly: 4edda9bb0e3017fd453612189069757195fa23ca |
| 137 | connectivity: 6e94255659cc86dcbef1d452ad3e0491bb1b3e75 | 142 | connectivity: 6e94255659cc86dcbef1d452ad3e0491bb1b3e75 |
| 138 | connectivity_macos: e2e9731b6b22dda39eb1b128f6969d574460e191 | 143 | connectivity_macos: e2e9731b6b22dda39eb1b128f6969d574460e191 |
| 144 | + device_info: d7d233b645a32c40dfdc212de5cf646ca482f175 | ||
| 139 | Flutter: 0e3d915762c693b495b44d77113d4970485de6ec | 145 | Flutter: 0e3d915762c693b495b44d77113d4970485de6ec |
| 140 | flutter_bugly: c9800f4d5bc5bdc27ffdde3417a26ba44266e0c3 | 146 | flutter_bugly: c9800f4d5bc5bdc27ffdde3417a26ba44266e0c3 |
| 141 | flutter_statusbarcolor: 8afb1071ed8c58be929f1e32b36c629771fd2259 | 147 | flutter_statusbarcolor: 8afb1071ed8c58be929f1e32b36c629771fd2259 |
| @@ -383,7 +383,7 @@ | @@ -383,7 +383,7 @@ | ||
| 383 | CLANG_ENABLE_MODULES = YES; | 383 | CLANG_ENABLE_MODULES = YES; |
| 384 | CODE_SIGN_ENTITLEMENTS = Runner/RunnerProfile.entitlements; | 384 | CODE_SIGN_ENTITLEMENTS = Runner/RunnerProfile.entitlements; |
| 385 | CODE_SIGN_STYLE = Manual; | 385 | CODE_SIGN_STYLE = Manual; |
| 386 | - CURRENT_PROJECT_VERSION = 3; | 386 | + CURRENT_PROJECT_VERSION = 4; |
| 387 | DEVELOPMENT_TEAM = 8J59HM8B82; | 387 | DEVELOPMENT_TEAM = 8J59HM8B82; |
| 388 | ENABLE_BITCODE = NO; | 388 | ENABLE_BITCODE = NO; |
| 389 | FRAMEWORK_SEARCH_PATHS = ( | 389 | FRAMEWORK_SEARCH_PATHS = ( |
| @@ -396,7 +396,7 @@ | @@ -396,7 +396,7 @@ | ||
| 396 | "$(inherited)", | 396 | "$(inherited)", |
| 397 | "$(PROJECT_DIR)/Flutter", | 397 | "$(PROJECT_DIR)/Flutter", |
| 398 | ); | 398 | ); |
| 399 | - MARKETING_VERSION = 1.0.3; | 399 | + MARKETING_VERSION = 1.0.4; |
| 400 | PRODUCT_BUNDLE_IDENTIFIER = com.naji.reserveLine; | 400 | PRODUCT_BUNDLE_IDENTIFIER = com.naji.reserveLine; |
| 401 | PRODUCT_NAME = "一键订"; | 401 | PRODUCT_NAME = "一键订"; |
| 402 | PROVISIONING_PROFILE_SPECIFIER = "OneKey Distribution Profile"; | 402 | PROVISIONING_PROFILE_SPECIFIER = "OneKey Distribution Profile"; |
| @@ -526,7 +526,7 @@ | @@ -526,7 +526,7 @@ | ||
| 526 | CLANG_ENABLE_MODULES = YES; | 526 | CLANG_ENABLE_MODULES = YES; |
| 527 | CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; | 527 | CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; |
| 528 | CODE_SIGN_STYLE = Manual; | 528 | CODE_SIGN_STYLE = Manual; |
| 529 | - CURRENT_PROJECT_VERSION = 3; | 529 | + CURRENT_PROJECT_VERSION = 4; |
| 530 | DEVELOPMENT_TEAM = 8J59HM8B82; | 530 | DEVELOPMENT_TEAM = 8J59HM8B82; |
| 531 | ENABLE_BITCODE = NO; | 531 | ENABLE_BITCODE = NO; |
| 532 | FRAMEWORK_SEARCH_PATHS = ( | 532 | FRAMEWORK_SEARCH_PATHS = ( |
| @@ -539,7 +539,7 @@ | @@ -539,7 +539,7 @@ | ||
| 539 | "$(inherited)", | 539 | "$(inherited)", |
| 540 | "$(PROJECT_DIR)/Flutter", | 540 | "$(PROJECT_DIR)/Flutter", |
| 541 | ); | 541 | ); |
| 542 | - MARKETING_VERSION = 1.0.3; | 542 | + MARKETING_VERSION = 1.0.4; |
| 543 | PRODUCT_BUNDLE_IDENTIFIER = com.naji.reserveLine; | 543 | PRODUCT_BUNDLE_IDENTIFIER = com.naji.reserveLine; |
| 544 | PRODUCT_NAME = "一键订"; | 544 | PRODUCT_NAME = "一键订"; |
| 545 | PROVISIONING_PROFILE_SPECIFIER = "Push Development Profile"; | 545 | PROVISIONING_PROFILE_SPECIFIER = "Push Development Profile"; |
| @@ -558,7 +558,7 @@ | @@ -558,7 +558,7 @@ | ||
| 558 | CLANG_ENABLE_MODULES = YES; | 558 | CLANG_ENABLE_MODULES = YES; |
| 559 | CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; | 559 | CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; |
| 560 | CODE_SIGN_STYLE = Manual; | 560 | CODE_SIGN_STYLE = Manual; |
| 561 | - CURRENT_PROJECT_VERSION = 3; | 561 | + CURRENT_PROJECT_VERSION = 4; |
| 562 | DEVELOPMENT_TEAM = 8J59HM8B82; | 562 | DEVELOPMENT_TEAM = 8J59HM8B82; |
| 563 | ENABLE_BITCODE = NO; | 563 | ENABLE_BITCODE = NO; |
| 564 | FRAMEWORK_SEARCH_PATHS = ( | 564 | FRAMEWORK_SEARCH_PATHS = ( |
| @@ -571,7 +571,7 @@ | @@ -571,7 +571,7 @@ | ||
| 571 | "$(inherited)", | 571 | "$(inherited)", |
| 572 | "$(PROJECT_DIR)/Flutter", | 572 | "$(PROJECT_DIR)/Flutter", |
| 573 | ); | 573 | ); |
| 574 | - MARKETING_VERSION = 1.0.3; | 574 | + MARKETING_VERSION = 1.0.4; |
| 575 | PRODUCT_BUNDLE_IDENTIFIER = com.naji.reserveLine; | 575 | PRODUCT_BUNDLE_IDENTIFIER = com.naji.reserveLine; |
| 576 | PRODUCT_NAME = "一键订"; | 576 | PRODUCT_NAME = "一键订"; |
| 577 | PROVISIONING_PROFILE_SPECIFIER = "OneKey Distribution Profile"; | 577 | PROVISIONING_PROFILE_SPECIFIER = "OneKey Distribution Profile"; |
| @@ -170,60 +170,70 @@ class DioUtil { | @@ -170,60 +170,70 @@ class DioUtil { | ||
| 170 | Future<BaseResp<T>> request<T>(BuildContext context,String method, String path, | 170 | Future<BaseResp<T>> request<T>(BuildContext context,String method, String path, |
| 171 | {data, Options options, CancelToken cancelToken,bool showLoading=true}) async { | 171 | {data, Options options, CancelToken cancelToken,bool showLoading=true}) async { |
| 172 | bool connectivity=await Utils.checkConnectiviy(); | 172 | bool connectivity=await Utils.checkConnectiviy(); |
| 173 | - if(!connectivity){ | ||
| 174 | - Utils.showToast("网络错误,请稍后重试"); | ||
| 175 | - return new Future.error("网络错误,请稍后重试"); | ||
| 176 | - } | 173 | +// if(!connectivity){ |
| 174 | +// Utils.showToast("网络错误,请稍后重试"); | ||
| 175 | +// return new Future.error("网络错误,请稍后重试"); | ||
| 176 | +// } | ||
| 177 | if(showLoading)Loading.showLoading(context); | 177 | if(showLoading)Loading.showLoading(context); |
| 178 | - Response response = await _dio.request(path, | ||
| 179 | - data: data, | ||
| 180 | - options: _checkOptions(method, options), | ||
| 181 | - cancelToken: cancelToken); | ||
| 182 | - _printHttpLog(response); | ||
| 183 | - String _status; | ||
| 184 | - int _code; | ||
| 185 | - String _msg; | ||
| 186 | - T _data; | ||
| 187 | - if (response.statusCode == HttpStatus.ok || | ||
| 188 | - response.statusCode == HttpStatus.created) { | ||
| 189 | - try { | ||
| 190 | - if (response.data is Map) { | ||
| 191 | - _status = (response.data[_statusKey] is int) | ||
| 192 | - ? response.data[_statusKey].toString() | ||
| 193 | - : response.data[_statusKey]; | ||
| 194 | - _code = (response.data[_codeKey] is String) | ||
| 195 | - ? int.tryParse(response.data[_codeKey]) | ||
| 196 | - : response.data[_codeKey]; | ||
| 197 | - _msg = response.data[_msgKey]; | ||
| 198 | - _data = response.data[_dataKey]; | ||
| 199 | - } else { | ||
| 200 | - Map<String, dynamic> _dataMap = _decodeData(response); | ||
| 201 | - _status = (_dataMap[_statusKey] is int) | ||
| 202 | - ? _dataMap[_statusKey].toString() | ||
| 203 | - : _dataMap[_statusKey]; | ||
| 204 | - _code = (_dataMap[_codeKey] is String) | ||
| 205 | - ? int.tryParse(_dataMap[_codeKey]) | ||
| 206 | - : _dataMap[_codeKey]; | ||
| 207 | - _msg = _dataMap[_msgKey]; | ||
| 208 | - _data = _dataMap[_dataKey]; | 178 | + try{ |
| 179 | + Response response = await _dio.request(path, | ||
| 180 | + data: data, | ||
| 181 | + options: _checkOptions(method, options), | ||
| 182 | + cancelToken: cancelToken); | ||
| 183 | + _printHttpLog(response); | ||
| 184 | + String _status; | ||
| 185 | + int _code; | ||
| 186 | + String _msg; | ||
| 187 | + T _data; | ||
| 188 | + if (response.statusCode == HttpStatus.ok || | ||
| 189 | + response.statusCode == HttpStatus.created) { | ||
| 190 | + try { | ||
| 191 | + if (response.data is Map) { | ||
| 192 | + _status = (response.data[_statusKey] is int) | ||
| 193 | + ? response.data[_statusKey].toString() | ||
| 194 | + : response.data[_statusKey]; | ||
| 195 | + _code = (response.data[_codeKey] is String) | ||
| 196 | + ? int.tryParse(response.data[_codeKey]) | ||
| 197 | + : response.data[_codeKey]; | ||
| 198 | + _msg = response.data[_msgKey]; | ||
| 199 | + _data = response.data[_dataKey]; | ||
| 200 | + } else { | ||
| 201 | + Map<String, dynamic> _dataMap = _decodeData(response); | ||
| 202 | + _status = (_dataMap[_statusKey] is int) | ||
| 203 | + ? _dataMap[_statusKey].toString() | ||
| 204 | + : _dataMap[_statusKey]; | ||
| 205 | + _code = (_dataMap[_codeKey] is String) | ||
| 206 | + ? int.tryParse(_dataMap[_codeKey]) | ||
| 207 | + : _dataMap[_codeKey]; | ||
| 208 | + _msg = _dataMap[_msgKey]; | ||
| 209 | + _data = _dataMap[_dataKey]; | ||
| 210 | + } | ||
| 211 | + Loading.hideLoading(context); | ||
| 212 | + return new BaseResp(_status, _code, _msg, _data); | ||
| 213 | + } catch (e) { | ||
| 214 | + Loading.hideLoading(context); | ||
| 215 | + return new Future.error(new DioError( | ||
| 216 | + response: response, | ||
| 217 | + message: "data parsing exception...", | ||
| 218 | + type: DioErrorType.RESPONSE, | ||
| 219 | + )); | ||
| 209 | } | 220 | } |
| 221 | + } | ||
| 222 | + Loading.hideLoading(context); | ||
| 223 | + return new Future.error(new DioError( | ||
| 224 | + response: response, | ||
| 225 | + message: "statusCode: $response.statusCode, service error", | ||
| 226 | + type: DioErrorType.RESPONSE, | ||
| 227 | + )); | ||
| 228 | + }on DioError catch(error){ | ||
| 229 | + if(showLoading){ | ||
| 210 | Loading.hideLoading(context); | 230 | Loading.hideLoading(context); |
| 211 | - return new BaseResp(_status, _code, _msg, _data); | ||
| 212 | - } catch (e) { | ||
| 213 | - Loading.hideLoading(context); | ||
| 214 | - return new Future.error(new DioError( | ||
| 215 | - response: response, | ||
| 216 | - message: "data parsing exception...", | ||
| 217 | - type: DioErrorType.RESPONSE, | ||
| 218 | - )); | ||
| 219 | } | 231 | } |
| 232 | + if(error is DioError &&error.type==DioErrorType.CONNECT_TIMEOUT){ | ||
| 233 | + Utils.showToast("网络链接超时,请稍后重试"); | ||
| 234 | + } | ||
| 235 | + throw error; | ||
| 220 | } | 236 | } |
| 221 | - Loading.hideLoading(context); | ||
| 222 | - return new Future.error(new DioError( | ||
| 223 | - response: response, | ||
| 224 | - message: "statusCode: $response.statusCode, service error", | ||
| 225 | - type: DioErrorType.RESPONSE, | ||
| 226 | - )); | ||
| 227 | } | 237 | } |
| 228 | 238 | ||
| 229 | /// Make http request with options. | 239 | /// Make http request with options. |
| @@ -14,4 +14,5 @@ class HttpUrl{ | @@ -14,4 +14,5 @@ class HttpUrl{ | ||
| 14 | static const String set_message_status="?service=Android.Advance.SetMessageStatus";//设置消息状态 | 14 | static const String set_message_status="?service=Android.Advance.SetMessageStatus";//设置消息状态 |
| 15 | static const String get_sms_content="?service=App.SendSMS.GetSmsContent";//获取短信内容 | 15 | static const String get_sms_content="?service=App.SendSMS.GetSmsContent";//获取短信内容 |
| 16 | static const String send_sms="?service=App.SendSMS.NewMessage";//发送短信 | 16 | static const String send_sms="?service=App.SendSMS.NewMessage";//发送短信 |
| 17 | +static const String check_update="http://xt03.colorcun.com/admin/api/compareversion?flat=3"; | ||
| 17 | } | 18 | } |
| @@ -78,7 +78,7 @@ class HomePageState extends State<HomePage>{ | @@ -78,7 +78,7 @@ class HomePageState extends State<HomePage>{ | ||
| 78 | // initXinge(); | 78 | // initXinge(); |
| 79 | WidgetsBinding.instance.addPostFrameCallback((_){ | 79 | WidgetsBinding.instance.addPostFrameCallback((_){ |
| 80 | if(widget.initialIndex==0)return; | 80 | if(widget.initialIndex==0)return; |
| 81 | - getUntreatedMessage(); | 81 | +// getUntreatedMessage(); |
| 82 | // UpdateModel updateModel=new UpdateModel(); | 82 | // UpdateModel updateModel=new UpdateModel(); |
| 83 | // updateModel.checkUpdate(context); | 83 | // updateModel.checkUpdate(context); |
| 84 | }); | 84 | }); |
| @@ -4,6 +4,7 @@ import 'package:one_key/pages/message/messsage_item.dart'; | @@ -4,6 +4,7 @@ import 'package:one_key/pages/message/messsage_item.dart'; | ||
| 4 | import 'package:one_key/provider/message_dialog_model.dart'; | 4 | import 'package:one_key/provider/message_dialog_model.dart'; |
| 5 | import 'package:one_key/provider/message_model.dart'; | 5 | import 'package:one_key/provider/message_model.dart'; |
| 6 | import 'package:one_key/provider/user_model.dart'; | 6 | import 'package:one_key/provider/user_model.dart'; |
| 7 | +import 'package:one_key/widgets/page_error.dart'; | ||
| 7 | import 'package:provider/provider.dart'; | 8 | import 'package:provider/provider.dart'; |
| 8 | import 'package:one_key/utils/event_bus.dart'; | 9 | import 'package:one_key/utils/event_bus.dart'; |
| 9 | 10 | ||
| @@ -52,21 +53,28 @@ class MessageLeftPageState extends State<MessageLeftPage> { | @@ -52,21 +53,28 @@ class MessageLeftPageState extends State<MessageLeftPage> { | ||
| 52 | @override | 53 | @override |
| 53 | Widget build(BuildContext context) { | 54 | Widget build(BuildContext context) { |
| 54 | // TODO: implement build | 55 | // TODO: implement build |
| 55 | - return Selector<MessageModel,List>( | ||
| 56 | - selector: (context,model)=>model.untreatedMsgs, | ||
| 57 | - builder: (context,messages,child){ | ||
| 58 | - return EasyRefresh.custom( | ||
| 59 | - controller: _controller, | ||
| 60 | - slivers: [ | ||
| 61 | - SliverList( | ||
| 62 | - delegate: | ||
| 63 | - SliverChildBuilderDelegate((BuildContext context, int index) { | ||
| 64 | - return MessageItem(messages[index]); | ||
| 65 | - },childCount: messages.length), | ||
| 66 | - ) | ||
| 67 | - ],onRefresh: () async { | ||
| 68 | - getUntreatedMessage(); | ||
| 69 | - },); | 56 | + return Consumer<MessageModel>( |
| 57 | + builder: (context,model,_){ | ||
| 58 | + if(!model.connect_timeout){ | ||
| 59 | + return Center( | ||
| 60 | + child: ErrorPage(callback: (){ | ||
| 61 | + getUntreatedMessage(); | ||
| 62 | + },), | ||
| 63 | + ); | ||
| 64 | + }else{ | ||
| 65 | + return EasyRefresh.custom( | ||
| 66 | + controller: _controller, | ||
| 67 | + slivers: [ | ||
| 68 | + SliverList( | ||
| 69 | + delegate: | ||
| 70 | + SliverChildBuilderDelegate((BuildContext context, int index) { | ||
| 71 | + return MessageItem(model.untreatedMsgs[index]); | ||
| 72 | + },childCount: model.untreatedMsgs.length), | ||
| 73 | + ) | ||
| 74 | + ],onRefresh: () async { | ||
| 75 | + getUntreatedMessage(); | ||
| 76 | + },); | ||
| 77 | + } | ||
| 70 | }, | 78 | }, |
| 71 | ); | 79 | ); |
| 72 | } | 80 | } |
| @@ -3,6 +3,7 @@ import 'package:flutter_easyrefresh/easy_refresh.dart'; | @@ -3,6 +3,7 @@ import 'package:flutter_easyrefresh/easy_refresh.dart'; | ||
| 3 | import 'package:one_key/pages/message/messsage_item.dart'; | 3 | import 'package:one_key/pages/message/messsage_item.dart'; |
| 4 | import 'package:one_key/provider/message_model.dart'; | 4 | import 'package:one_key/provider/message_model.dart'; |
| 5 | import 'package:one_key/provider/user_model.dart'; | 5 | import 'package:one_key/provider/user_model.dart'; |
| 6 | +import 'package:one_key/widgets/page_error.dart'; | ||
| 6 | import 'package:provider/provider.dart'; | 7 | import 'package:provider/provider.dart'; |
| 7 | 8 | ||
| 8 | class MessageRightPage extends StatefulWidget{ | 9 | class MessageRightPage extends StatefulWidget{ |
| @@ -47,26 +48,28 @@ class MessageRightPageState extends State<MessageRightPage>{ | @@ -47,26 +48,28 @@ class MessageRightPageState extends State<MessageRightPage>{ | ||
| 47 | @override | 48 | @override |
| 48 | Widget build(BuildContext context) { | 49 | Widget build(BuildContext context) { |
| 49 | // TODO: implement build | 50 | // TODO: implement build |
| 50 | - return Selector<MessageModel,List>( | ||
| 51 | - selector: (context,model)=>model.treatedMsgs, | ||
| 52 | - shouldRebuild: (pre,next)=>true, | ||
| 53 | - builder: (context,messages,child){ | ||
| 54 | - return EasyRefresh.custom( | ||
| 55 | - controller: _controller, | ||
| 56 | - slivers: [ | ||
| 57 | - SliverList( | ||
| 58 | - delegate: | ||
| 59 | - SliverChildBuilderDelegate((BuildContext context, int index) { | ||
| 60 | - return MessageItem(messages[index],isTreated: true,); | ||
| 61 | - },childCount: messages.length), | ||
| 62 | - ) | ||
| 63 | - ],onRefresh: () async { | ||
| 64 | - offset=1; | ||
| 65 | - getTreatedMessage(); | ||
| 66 | - },onLoad: () async { | ||
| 67 | - offset++; | ||
| 68 | - getTreatedMessage(); | ||
| 69 | - },); | 51 | + return Consumer<MessageModel>( |
| 52 | + builder: (context,model,_){ | ||
| 53 | + if(!model.connect_timeout){ | ||
| 54 | + return Center( | ||
| 55 | + child: ErrorPage(callback: (){ | ||
| 56 | + getTreatedMessage(); | ||
| 57 | + },), | ||
| 58 | + ); | ||
| 59 | + }else{ | ||
| 60 | + return EasyRefresh.custom( | ||
| 61 | + controller: _controller, | ||
| 62 | + slivers: [ | ||
| 63 | + SliverList( | ||
| 64 | + delegate: | ||
| 65 | + SliverChildBuilderDelegate((BuildContext context, int index) { | ||
| 66 | + return MessageItem(model.treatedMsgs[index]); | ||
| 67 | + },childCount: model.treatedMsgs.length), | ||
| 68 | + ) | ||
| 69 | + ],onRefresh: () async { | ||
| 70 | + getTreatedMessage(); | ||
| 71 | + },); | ||
| 72 | + } | ||
| 70 | }, | 73 | }, |
| 71 | ); | 74 | ); |
| 72 | } | 75 | } |
| @@ -37,8 +37,8 @@ class MyPageState extends State<MyPage>{ | @@ -37,8 +37,8 @@ class MyPageState extends State<MyPage>{ | ||
| 37 | 37 | ||
| 38 | //检查版本更新 | 38 | //检查版本更新 |
| 39 | checkUpdate(){ | 39 | checkUpdate(){ |
| 40 | - UpdateModel updateModel=new UpdateModel(); | ||
| 41 | - updateModel.checkUpdate(context); | 40 | +// UpdateModel updateModel=new UpdateModel(); |
| 41 | +// updateModel.checkUpdate(context); | ||
| 42 | } | 42 | } |
| 43 | 43 | ||
| 44 | @override | 44 | @override |
| 1 | +import 'package:dio/dio.dart'; | ||
| 1 | import 'package:flutter/material.dart'; | 2 | import 'package:flutter/material.dart'; |
| 2 | import 'package:flutter_easyrefresh/easy_refresh.dart'; | 3 | import 'package:flutter_easyrefresh/easy_refresh.dart'; |
| 3 | import 'package:flutter_screenutil/flutter_screenutil.dart'; | 4 | import 'package:flutter_screenutil/flutter_screenutil.dart'; |
| @@ -11,6 +12,7 @@ import 'package:one_key/utils/utils.dart'; | @@ -11,6 +12,7 @@ import 'package:one_key/utils/utils.dart'; | ||
| 11 | import 'package:one_key/widgets/MyDivider.dart'; | 12 | import 'package:one_key/widgets/MyDivider.dart'; |
| 12 | import 'package:one_key/widgets/app_bar.dart'; | 13 | import 'package:one_key/widgets/app_bar.dart'; |
| 13 | import 'package:one_key/widgets/common_button.dart'; | 14 | import 'package:one_key/widgets/common_button.dart'; |
| 15 | +import 'package:one_key/widgets/page_error.dart'; | ||
| 14 | import 'package:provider/provider.dart'; | 16 | import 'package:provider/provider.dart'; |
| 15 | 17 | ||
| 16 | class NoteBookPage extends StatefulWidget { | 18 | class NoteBookPage extends StatefulWidget { |
| @@ -391,26 +393,33 @@ class NoteBookPageState extends State<NoteBookPage> { | @@ -391,26 +393,33 @@ class NoteBookPageState extends State<NoteBookPage> { | ||
| 391 | ), | 393 | ), |
| 392 | _buildListTitle(), | 394 | _buildListTitle(), |
| 393 | Expanded( | 395 | Expanded( |
| 394 | - child: Selector<NoteBookModel, List>( | ||
| 395 | - selector: (context, model) => model.notebooks, | ||
| 396 | - builder: (context, notebooks, child) { | ||
| 397 | - return EasyRefresh.custom( | ||
| 398 | - controller: _controller, | ||
| 399 | - slivers: [ | ||
| 400 | - SliverFixedExtentList( | ||
| 401 | - delegate: SliverChildBuilderDelegate( | ||
| 402 | - (BuildContext context, int index) { | ||
| 403 | - return NoteBookItem(notebooks[index], index); | ||
| 404 | - }, childCount: notebooks.length), | ||
| 405 | - itemExtent: ScreenUtil().setHeight(112), | ||
| 406 | - ) | ||
| 407 | - ], | ||
| 408 | - onRefresh: () async { | ||
| 409 | - _getReserveList(); | 396 | + child: Consumer<NoteBookModel>( |
| 397 | + builder: (context,model,_){ | ||
| 398 | + if(model.connect_timeout){ | ||
| 399 | + return Center( | ||
| 400 | + child: ErrorPage(callback: (){ | ||
| 401 | + _getReserveList(); | ||
| 402 | + },), | ||
| 403 | + ); | ||
| 404 | + }else{ | ||
| 405 | + return EasyRefresh.custom( | ||
| 406 | + controller: _controller, | ||
| 407 | + slivers: [ | ||
| 408 | + SliverFixedExtentList( | ||
| 409 | + delegate: SliverChildBuilderDelegate( | ||
| 410 | + (BuildContext context, int index) { | ||
| 411 | + return NoteBookItem(model.notebooks[index], index); | ||
| 412 | + }, childCount: model.notebooks.length), | ||
| 413 | + itemExtent: ScreenUtil().setHeight(112), | ||
| 414 | + ) | ||
| 415 | + ], | ||
| 416 | + onRefresh: () async { | ||
| 417 | + _getReserveList(); | ||
| 418 | + }, | ||
| 419 | + ); | ||
| 420 | + } | ||
| 410 | }, | 421 | }, |
| 411 | - ); | ||
| 412 | - }, | ||
| 413 | - )) | 422 | + )) |
| 414 | ], | 423 | ], |
| 415 | ), | 424 | ), |
| 416 | ); | 425 | ); |
| @@ -52,7 +52,7 @@ class MessageDialogModel extends ChangeNotifier{ | @@ -52,7 +52,7 @@ class MessageDialogModel extends ChangeNotifier{ | ||
| 52 | .catchError((error) { | 52 | .catchError((error) { |
| 53 | print(error.toString()); | 53 | print(error.toString()); |
| 54 | }); | 54 | }); |
| 55 | - if (baseResp.code == Constant.status_success) { | 55 | + if (baseResp!=null&&baseResp.code == Constant.status_success) { |
| 56 | messages=baseResp.data.map<Message>((value){ | 56 | messages=baseResp.data.map<Message>((value){ |
| 57 | return Message.fromJson(value); | 57 | return Message.fromJson(value); |
| 58 | }).toList(); | 58 | }).toList(); |
| @@ -12,15 +12,21 @@ class MessageModel extends ChangeNotifier{ | @@ -12,15 +12,21 @@ class MessageModel extends ChangeNotifier{ | ||
| 12 | List<Message> untreatedMsgs=[];//未处理在线预订消息 | 12 | List<Message> untreatedMsgs=[];//未处理在线预订消息 |
| 13 | List<Message> treatedMsgs=[];//已处理在线预订消息 | 13 | List<Message> treatedMsgs=[];//已处理在线预订消息 |
| 14 | 14 | ||
| 15 | + bool connect_timeout=true; | ||
| 16 | + | ||
| 15 | //获取未处理在线预订消息 | 17 | //获取未处理在线预订消息 |
| 16 | getUntreatedMsg(BuildContext context,Map<String,String> params) async { | 18 | getUntreatedMsg(BuildContext context,Map<String,String> params) async { |
| 19 | + connect_timeout=true; | ||
| 20 | + notifyListeners(); | ||
| 17 | BaseResp<List> baseResp = await DioUtil() | 21 | BaseResp<List> baseResp = await DioUtil() |
| 18 | .request<List>(context, Method.get, HttpUrl.get_message_list, | 22 | .request<List>(context, Method.get, HttpUrl.get_message_list, |
| 19 | data: params) | 23 | data: params) |
| 20 | .catchError((error) { | 24 | .catchError((error) { |
| 21 | print(error.toString()); | 25 | print(error.toString()); |
| 26 | + connect_timeout=false; | ||
| 27 | + notifyListeners(); | ||
| 22 | }); | 28 | }); |
| 23 | - if (baseResp.code == Constant.status_success) { | 29 | + if (baseResp!=null&&baseResp.code == Constant.status_success) { |
| 24 | untreatedMsgs=baseResp.data.map<Message>((value){ | 30 | untreatedMsgs=baseResp.data.map<Message>((value){ |
| 25 | return Message.fromJson(value); | 31 | return Message.fromJson(value); |
| 26 | }).toList(); | 32 | }).toList(); |
| @@ -31,13 +37,17 @@ class MessageModel extends ChangeNotifier{ | @@ -31,13 +37,17 @@ class MessageModel extends ChangeNotifier{ | ||
| 31 | 37 | ||
| 32 | //获取未处理在线预订消息 | 38 | //获取未处理在线预订消息 |
| 33 | getTreatedMsg(BuildContext context,Map<String,String> params) async { | 39 | getTreatedMsg(BuildContext context,Map<String,String> params) async { |
| 40 | + connect_timeout=true; | ||
| 41 | + notifyListeners(); | ||
| 34 | BaseResp<List> baseResp = await DioUtil() | 42 | BaseResp<List> baseResp = await DioUtil() |
| 35 | .request<List>(context, Method.get, HttpUrl.get_message_list, | 43 | .request<List>(context, Method.get, HttpUrl.get_message_list, |
| 36 | data: params) | 44 | data: params) |
| 37 | .catchError((error) { | 45 | .catchError((error) { |
| 38 | print(error.toString()); | 46 | print(error.toString()); |
| 47 | + connect_timeout=false; | ||
| 48 | + notifyListeners(); | ||
| 39 | }); | 49 | }); |
| 40 | - if (baseResp.code == Constant.status_success) { | 50 | + if (baseResp!=null&&baseResp.code == Constant.status_success) { |
| 41 | if(params["offset"]=="0"){//第一页 | 51 | if(params["offset"]=="0"){//第一页 |
| 42 | treatedMsgs=baseResp.data.map<Message>((value){ | 52 | treatedMsgs=baseResp.data.map<Message>((value){ |
| 43 | return Message.fromJson(value); | 53 | return Message.fromJson(value); |
| @@ -14,14 +14,21 @@ class NoteBookModel extends ChangeNotifier{ | @@ -14,14 +14,21 @@ class NoteBookModel extends ChangeNotifier{ | ||
| 14 | 14 | ||
| 15 | String total="";//一天统计 | 15 | String total="";//一天统计 |
| 16 | 16 | ||
| 17 | + bool connect_timeout=false; | ||
| 18 | + | ||
| 17 | //获取已预订订单 | 19 | //获取已预订订单 |
| 18 | Future<List<Notebook>> getReserveList(BuildContext context,Map<String,String> params) async { | 20 | Future<List<Notebook>> getReserveList(BuildContext context,Map<String,String> params) async { |
| 21 | + connect_timeout=false; | ||
| 22 | + notifyListeners(); | ||
| 19 | BaseResp<List> baseResp = await DioUtil() | 23 | BaseResp<List> baseResp = await DioUtil() |
| 20 | .request<List>(context, Method.get, HttpUrl.get_reserve_list, | 24 | .request<List>(context, Method.get, HttpUrl.get_reserve_list, |
| 21 | data: params,showLoading: true) | 25 | data: params,showLoading: true) |
| 22 | .catchError((error) { | 26 | .catchError((error) { |
| 23 | print(error.toString()); | 27 | print(error.toString()); |
| 28 | + connect_timeout=true; | ||
| 29 | + notifyListeners(); | ||
| 24 | }); | 30 | }); |
| 31 | + if(baseResp==null)return null; | ||
| 25 | notebooks=[]; | 32 | notebooks=[]; |
| 26 | if (baseResp.code == Constant.status_success) { | 33 | if (baseResp.code == Constant.status_success) { |
| 27 | notebooks=baseResp.data.map<Notebook>((value){ | 34 | notebooks=baseResp.data.map<Notebook>((value){ |
| @@ -42,7 +49,7 @@ class NoteBookModel extends ChangeNotifier{ | @@ -42,7 +49,7 @@ class NoteBookModel extends ChangeNotifier{ | ||
| 42 | .catchError((error) { | 49 | .catchError((error) { |
| 43 | print(error.toString()); | 50 | print(error.toString()); |
| 44 | }); | 51 | }); |
| 45 | - if (baseResp.code == Constant.status_success) { | 52 | + if (baseResp!=null&&baseResp.code == Constant.status_success) { |
| 46 | int morning=int.parse(baseResp.data["morning"].toString()); | 53 | int morning=int.parse(baseResp.data["morning"].toString()); |
| 47 | int noon=int.parse(baseResp.data["noon"].toString()); | 54 | int noon=int.parse(baseResp.data["noon"].toString()); |
| 48 | int night=int.parse(baseResp.data["night"].toString()); | 55 | int night=int.parse(baseResp.data["night"].toString()); |
| 1 | +import 'dart:convert'; | ||
| 1 | import 'dart:io'; | 2 | import 'dart:io'; |
| 2 | import 'dart:math'; | 3 | import 'dart:math'; |
| 3 | 4 | ||
| 5 | +import 'package:dio/dio.dart'; | ||
| 4 | import 'package:flutter/material.dart'; | 6 | import 'package:flutter/material.dart'; |
| 5 | import 'package:flutter_screenutil/flutter_screenutil.dart'; | 7 | import 'package:flutter_screenutil/flutter_screenutil.dart'; |
| 6 | import 'package:install_plugin/install_plugin.dart'; | 8 | import 'package:install_plugin/install_plugin.dart'; |
| 9 | +import 'package:one_key/constant/constant.dart'; | ||
| 7 | import 'package:one_key/models/version.dart'; | 10 | import 'package:one_key/models/version.dart'; |
| 11 | +import 'package:one_key/net/base_resp.dart'; | ||
| 8 | import 'package:one_key/net/dio_util.dart'; | 12 | import 'package:one_key/net/dio_util.dart'; |
| 13 | +import 'package:one_key/net/http_url.dart'; | ||
| 14 | +import 'package:one_key/provider/user_model.dart'; | ||
| 9 | import 'package:one_key/res/colors.dart'; | 15 | import 'package:one_key/res/colors.dart'; |
| 16 | +import 'package:one_key/utils/log_util.dart'; | ||
| 17 | +import 'package:one_key/utils/utils.dart'; | ||
| 10 | import 'package:one_key/widgets/MyDivider.dart'; | 18 | import 'package:one_key/widgets/MyDivider.dart'; |
| 11 | import 'package:one_key/widgets/v_empty_view.dart'; | 19 | import 'package:one_key/widgets/v_empty_view.dart'; |
| 12 | import 'package:path_provider/path_provider.dart'; | 20 | import 'package:path_provider/path_provider.dart'; |
| 13 | import 'package:permission_handler/permission_handler.dart'; | 21 | import 'package:permission_handler/permission_handler.dart'; |
| 22 | +import 'package:provider/provider.dart'; | ||
| 14 | 23 | ||
| 15 | class UpdateModel { | 24 | class UpdateModel { |
| 16 | int _progress; //下载进度 | 25 | int _progress; //下载进度 |
| 17 | Function _setState; | 26 | Function _setState; |
| 18 | //检查更新 | 27 | //检查更新 |
| 19 | - checkUpdate(BuildContext context) { | ||
| 20 | - Future.delayed(new Duration(milliseconds: 1000), () { | ||
| 21 | - if (Random().nextInt(10) > 0) { | 28 | + checkUpdate(BuildContext context) async { |
| 29 | + String deviceId = await Utils.getUUID(); | ||
| 30 | + UserModel userModel = Provider.of<UserModel>(context, listen: false); | ||
| 31 | + int versionCode = await Utils.getCurrBuildNum(); | ||
| 32 | + Map<String, String> params = { | ||
| 33 | + "deviceId": deviceId, | ||
| 34 | + "sid": userModel.user.sellerid, | ||
| 35 | + "versionCode": versionCode.toString() | ||
| 36 | + }; | ||
| 37 | + BaseResp<List> baseResp = await DioUtil() | ||
| 38 | + .request<List>(context, Method.get, HttpUrl.check_update, data: params) | ||
| 39 | + .catchError((error) { | ||
| 40 | + print(error.toString()); | ||
| 41 | + }); | ||
| 42 | + if (baseResp.code == Constant.status_success) { | ||
| 43 | + LogUtil.v(baseResp.data); | ||
| 44 | + Map<String, String> dataMap = baseResp.data[0]; | ||
| 45 | + if (int.parse(dataMap["version"]) > versionCode) { | ||
| 22 | Version version = Version.fromJson({ | 46 | Version version = Version.fromJson({ |
| 23 | - "version": "v1.0.3", | ||
| 24 | - "file_url": | ||
| 25 | - "http://xt03.colorcun.com/uploads/20191105/67e38355c41528b24a97e9ac71a221ea.apk", | ||
| 26 | - "content": "1.bug修复;\n2.功能更新;" | 47 | + "version": dataMap["versionName"], |
| 48 | + "file_url":dataMap["file_url"], | ||
| 49 | + "content": dataMap["content"] | ||
| 27 | }); | 50 | }); |
| 28 | showUpdateDialog(context, version); | 51 | showUpdateDialog(context, version); |
| 29 | } | 52 | } |
| 30 | - }); | 53 | + } |
| 54 | +// if(Platform.isAndroid){ | ||
| 55 | +// | ||
| 56 | +// }else{ | ||
| 57 | +//// Response response=await DioUtil().getDio().get("http://itunes.apple.com/lookup?id=1510697490"); | ||
| 58 | +//// Map<String,dynamic> dataMap=jsonDecode(response.data); | ||
| 59 | +//// String version=((dataMap["results"] as List)[0] as Map)["version"] as String; | ||
| 60 | +//// String currVersion=await Utils.getCurrVersion(); | ||
| 61 | +//// if(version.compareTo(currVersion)>0){ | ||
| 62 | +//// Version version = Version.fromJson({ | ||
| 63 | +//// "version": "version", | ||
| 64 | +//// "file_url":dataMap["file_url"], | ||
| 65 | +//// "content": dataMap["content"] | ||
| 66 | +//// }); | ||
| 67 | +//// showUpdateDialog(context, version); | ||
| 68 | +//// } | ||
| 69 | +// } | ||
| 31 | } | 70 | } |
| 32 | 71 | ||
| 33 | //版本更新弹框 | 72 | //版本更新弹框 |
| @@ -90,7 +129,8 @@ class UpdateModel { | @@ -90,7 +129,8 @@ class UpdateModel { | ||
| 90 | ), | 129 | ), |
| 91 | ), | 130 | ), |
| 92 | ), | 131 | ), |
| 93 | - MyDivider(ScreenUtil().setWidth(1),ScreenUtil().setWidth(94)), | 132 | + MyDivider( |
| 133 | + ScreenUtil().setWidth(1), ScreenUtil().setWidth(94)), | ||
| 94 | Expanded( | 134 | Expanded( |
| 95 | child: GestureDetector( | 135 | child: GestureDetector( |
| 96 | onTap: () { | 136 | onTap: () { |
| @@ -117,16 +157,18 @@ class UpdateModel { | @@ -117,16 +157,18 @@ class UpdateModel { | ||
| 117 | ], | 157 | ], |
| 118 | ), | 158 | ), |
| 119 | ); | 159 | ); |
| 120 | - return Center(child: UnconstrainedBox( | ||
| 121 | - constrainedAxis: Axis.vertical, | ||
| 122 | - child: ConstrainedBox( | ||
| 123 | - constraints: BoxConstraints(maxWidth: ScreenUtil().setWidth(560)), | ||
| 124 | - child: DefaultTextStyle( | ||
| 125 | - style: TextStyle(decoration: TextDecoration.none), | ||
| 126 | - child: widget, | ||
| 127 | - ) | 160 | + return Center( |
| 161 | + child: UnconstrainedBox( | ||
| 162 | + constrainedAxis: Axis.vertical, | ||
| 163 | + child: ConstrainedBox( | ||
| 164 | + constraints: | ||
| 165 | + BoxConstraints(maxWidth: ScreenUtil().setWidth(560)), | ||
| 166 | + child: DefaultTextStyle( | ||
| 167 | + style: TextStyle(decoration: TextDecoration.none), | ||
| 168 | + child: widget, | ||
| 169 | + )), | ||
| 128 | ), | 170 | ), |
| 129 | - ),); | 171 | + ); |
| 130 | return AlertDialog( | 172 | return AlertDialog( |
| 131 | content: widget, | 173 | content: widget, |
| 132 | contentPadding: EdgeInsets.zero, | 174 | contentPadding: EdgeInsets.zero, |
| @@ -141,16 +183,17 @@ class UpdateModel { | @@ -141,16 +183,17 @@ class UpdateModel { | ||
| 141 | if (permissions[PermissionGroup.storage] == PermissionStatus.granted) { | 183 | if (permissions[PermissionGroup.storage] == PermissionStatus.granted) { |
| 142 | final dir = await getExternalStorageDirectory(); | 184 | final dir = await getExternalStorageDirectory(); |
| 143 | String savePath = dir.path + "/one_key"; | 185 | String savePath = dir.path + "/one_key"; |
| 144 | - Directory directory=new Directory(savePath); | ||
| 145 | - if(directory.existsSync()){//删除历史apk | ||
| 146 | - final List<FileSystemEntity> files=directory.listSync(); | ||
| 147 | - for(FileSystemEntity file in files){ | 186 | + Directory directory = new Directory(savePath); |
| 187 | + if (directory.existsSync()) { | ||
| 188 | + //删除历史apk | ||
| 189 | + final List<FileSystemEntity> files = directory.listSync(); | ||
| 190 | + for (FileSystemEntity file in files) { | ||
| 148 | file.deleteSync(); | 191 | file.deleteSync(); |
| 149 | } | 192 | } |
| 150 | } | 193 | } |
| 151 | showDownloadProgress(context); | 194 | showDownloadProgress(context); |
| 152 | DioUtil().download(file_url, savePath, onProgress: (received, total) { | 195 | DioUtil().download(file_url, savePath, onProgress: (received, total) { |
| 153 | - if(_progress!=100){ | 196 | + if (_progress != 100) { |
| 154 | int progress = ((received / total) * 100).round(); | 197 | int progress = ((received / total) * 100).round(); |
| 155 | _progress = progress; | 198 | _progress = progress; |
| 156 | _setState(() {}); | 199 | _setState(() {}); |
| @@ -171,7 +214,7 @@ class UpdateModel { | @@ -171,7 +214,7 @@ class UpdateModel { | ||
| 171 | builder: (ct) { | 214 | builder: (ct) { |
| 172 | return AlertDialog( | 215 | return AlertDialog( |
| 173 | content: StatefulBuilder(builder: (context, setState) { | 216 | content: StatefulBuilder(builder: (context, setState) { |
| 174 | - if (_progress==100) { | 217 | + if (_progress == 100) { |
| 175 | Navigator.of(ct).pop(); | 218 | Navigator.of(ct).pop(); |
| 176 | } | 219 | } |
| 177 | _setState = setState; | 220 | _setState = setState; |
| 1 | import 'dart:convert'; | 1 | import 'dart:convert'; |
| 2 | 2 | ||
| 3 | +import 'package:dio/dio.dart'; | ||
| 3 | import 'package:flutter/material.dart'; | 4 | import 'package:flutter/material.dart'; |
| 4 | import 'package:flutter_screenutil/flutter_screenutil.dart'; | 5 | import 'package:flutter_screenutil/flutter_screenutil.dart'; |
| 5 | import 'package:jpush_flutter/jpush_flutter.dart'; | 6 | import 'package:jpush_flutter/jpush_flutter.dart'; |
| @@ -118,7 +119,7 @@ class UserModel with ChangeNotifier { | @@ -118,7 +119,7 @@ class UserModel with ChangeNotifier { | ||
| 118 | .catchError((error) { | 119 | .catchError((error) { |
| 119 | print(error.toString()); | 120 | print(error.toString()); |
| 120 | }); | 121 | }); |
| 121 | - if (baseResp.code == Constant.status_success) { | 122 | + if (baseResp!=null&&baseResp.code == Constant.status_success) { |
| 122 | } | 123 | } |
| 123 | } | 124 | } |
| 124 | 125 |
| 1 | +import 'dart:io'; | ||
| 2 | + | ||
| 1 | import 'package:connectivity/connectivity.dart'; | 3 | import 'package:connectivity/connectivity.dart'; |
| 4 | +import 'package:device_info/device_info.dart'; | ||
| 2 | import 'package:extended_image/extended_image.dart'; | 5 | import 'package:extended_image/extended_image.dart'; |
| 3 | import 'package:flutter/cupertino.dart'; | 6 | import 'package:flutter/cupertino.dart'; |
| 4 | import 'package:flutter/material.dart'; | 7 | import 'package:flutter/material.dart'; |
| @@ -94,6 +97,24 @@ class Utils { | @@ -94,6 +97,24 @@ class Utils { | ||
| 94 | return version; | 97 | return version; |
| 95 | } | 98 | } |
| 96 | 99 | ||
| 100 | + //获取当前构建版本号 | ||
| 101 | + static Future<int> getCurrBuildNum() async { | ||
| 102 | + PackageInfo packageInfo=await PackageInfo.fromPlatform(); | ||
| 103 | + return int.parse(packageInfo.buildNumber); | ||
| 104 | + } | ||
| 105 | + | ||
| 106 | + //获取唯一标识 | ||
| 107 | + static Future<String> getUUID() async { | ||
| 108 | + DeviceInfoPlugin deviceInfoPlugin=DeviceInfoPlugin(); | ||
| 109 | + if(Platform.isAndroid){ | ||
| 110 | + AndroidDeviceInfo androidDeviceInfo=await deviceInfoPlugin.androidInfo; | ||
| 111 | + return androidDeviceInfo.androidId; | ||
| 112 | + }else{ | ||
| 113 | + IosDeviceInfo iosDeviceInfo=await deviceInfoPlugin.iosInfo; | ||
| 114 | + return iosDeviceInfo.identifierForVendor; | ||
| 115 | + } | ||
| 116 | + } | ||
| 117 | + | ||
| 97 | //比较两个日期是否同一天 | 118 | //比较两个日期是否同一天 |
| 98 | static isOneDay(DateTime one,DateTime two){ | 119 | static isOneDay(DateTime one,DateTime two){ |
| 99 | if(one.year==two.year&&one.month==two.month&&one.day==two.day)return true; | 120 | if(one.year==two.year&&one.month==two.month&&one.day==two.day)return true; |
| @@ -26,8 +26,9 @@ class ErrorPageState extends State<ErrorPage>{ | @@ -26,8 +26,9 @@ class ErrorPageState extends State<ErrorPage>{ | ||
| 26 | height: double.infinity, | 26 | height: double.infinity, |
| 27 | child: Center( | 27 | child: Center( |
| 28 | child: Column( | 28 | child: Column( |
| 29 | + mainAxisSize: MainAxisSize.min, | ||
| 29 | children: <Widget>[ | 30 | children: <Widget>[ |
| 30 | - Image.asset("assets/bg_error",width: ScreenUtil().setWidth(311),height: ScreenUtil().setWidth(215),), | 31 | + Image.asset("assets/bg_error.png",width: ScreenUtil().setWidth(311),height: ScreenUtil().setWidth(215),), |
| 31 | VEmptyView(40), | 32 | VEmptyView(40), |
| 32 | Text("哎呀~网络好像走失了呢",style: TextStyle(fontSize: ScreenUtil().setSp(32),color: MyColours.color_353535),), | 33 | Text("哎呀~网络好像走失了呢",style: TextStyle(fontSize: ScreenUtil().setSp(32),color: MyColours.color_353535),), |
| 33 | VEmptyView(20), | 34 | VEmptyView(20), |
| @@ -197,6 +197,13 @@ packages: | @@ -197,6 +197,13 @@ packages: | ||
| 197 | url: "https://pub.flutter-io.cn" | 197 | url: "https://pub.flutter-io.cn" |
| 198 | source: hosted | 198 | source: hosted |
| 199 | version: "1.2.9" | 199 | version: "1.2.9" |
| 200 | + device_info: | ||
| 201 | + dependency: "direct main" | ||
| 202 | + description: | ||
| 203 | + name: device_info | ||
| 204 | + url: "https://pub.flutter-io.cn" | ||
| 205 | + source: hosted | ||
| 206 | + version: "0.4.2+4" | ||
| 200 | dio: | 207 | dio: |
| 201 | dependency: "direct main" | 208 | dependency: "direct main" |
| 202 | description: | 209 | description: |
| @@ -77,6 +77,8 @@ dependencies: | @@ -77,6 +77,8 @@ dependencies: | ||
| 77 | install_plugin: ^2.0.1 | 77 | install_plugin: ^2.0.1 |
| 78 | # 获取应用版本信息 | 78 | # 获取应用版本信息 |
| 79 | package_info: ^0.4.0+18 | 79 | package_info: ^0.4.0+18 |
| 80 | +# 获取设备信息 | ||
| 81 | + device_info: ^0.4.2+4 | ||
| 80 | 82 | ||
| 81 | dev_dependencies: | 83 | dev_dependencies: |
| 82 | flutter_test: | 84 | flutter_test: |
-
Please register or login to post a comment