@@ -1,6 +1,20 @@ | |||||
# Generated by pub | # Generated by pub | ||||
# See https://dart.dev/tools/pub/glossary#lockfile | # See https://dart.dev/tools/pub/glossary#lockfile | ||||
packages: | packages: | ||||
_fe_analyzer_shared: | |||||
dependency: transitive | |||||
description: | |||||
name: _fe_analyzer_shared | |||||
url: "https://pub.flutter-io.cn" | |||||
source: hosted | |||||
version: "7.0.0" | |||||
analyzer: | |||||
dependency: transitive | |||||
description: | |||||
name: analyzer | |||||
url: "https://pub.flutter-io.cn" | |||||
source: hosted | |||||
version: "0.39.17" | |||||
archive: | archive: | ||||
dependency: transitive | dependency: transitive | ||||
description: | description: | ||||
@@ -29,6 +43,62 @@ packages: | |||||
url: "https://pub.flutter-io.cn" | url: "https://pub.flutter-io.cn" | ||||
source: hosted | source: hosted | ||||
version: "1.0.5" | version: "1.0.5" | ||||
build: | |||||
dependency: transitive | |||||
description: | |||||
name: build | |||||
url: "https://pub.flutter-io.cn" | |||||
source: hosted | |||||
version: "1.3.0" | |||||
build_config: | |||||
dependency: transitive | |||||
description: | |||||
name: build_config | |||||
url: "https://pub.flutter-io.cn" | |||||
source: hosted | |||||
version: "0.4.2" | |||||
build_daemon: | |||||
dependency: transitive | |||||
description: | |||||
name: build_daemon | |||||
url: "https://pub.flutter-io.cn" | |||||
source: hosted | |||||
version: "2.1.4" | |||||
build_resolvers: | |||||
dependency: transitive | |||||
description: | |||||
name: build_resolvers | |||||
url: "https://pub.flutter-io.cn" | |||||
source: hosted | |||||
version: "1.3.11" | |||||
build_runner: | |||||
dependency: transitive | |||||
description: | |||||
name: build_runner | |||||
url: "https://pub.flutter-io.cn" | |||||
source: hosted | |||||
version: "1.10.0" | |||||
build_runner_core: | |||||
dependency: transitive | |||||
description: | |||||
name: build_runner_core | |||||
url: "https://pub.flutter-io.cn" | |||||
source: hosted | |||||
version: "5.2.0" | |||||
built_collection: | |||||
dependency: transitive | |||||
description: | |||||
name: built_collection | |||||
url: "https://pub.flutter-io.cn" | |||||
source: hosted | |||||
version: "4.3.2" | |||||
built_value: | |||||
dependency: transitive | |||||
description: | |||||
name: built_value | |||||
url: "https://pub.flutter-io.cn" | |||||
source: hosted | |||||
version: "7.1.0" | |||||
cached_network_image: | cached_network_image: | ||||
dependency: transitive | dependency: transitive | ||||
description: | description: | ||||
@@ -43,6 +113,20 @@ packages: | |||||
url: "https://pub.flutter-io.cn" | url: "https://pub.flutter-io.cn" | ||||
source: hosted | source: hosted | ||||
version: "1.1.2" | version: "1.1.2" | ||||
checked_yaml: | |||||
dependency: transitive | |||||
description: | |||||
name: checked_yaml | |||||
url: "https://pub.flutter-io.cn" | |||||
source: hosted | |||||
version: "1.0.2" | |||||
cli_util: | |||||
dependency: transitive | |||||
description: | |||||
name: cli_util | |||||
url: "https://pub.flutter-io.cn" | |||||
source: hosted | |||||
version: "0.2.0" | |||||
clock: | clock: | ||||
dependency: transitive | dependency: transitive | ||||
description: | description: | ||||
@@ -50,6 +134,13 @@ packages: | |||||
url: "https://pub.flutter-io.cn" | url: "https://pub.flutter-io.cn" | ||||
source: hosted | source: hosted | ||||
version: "1.0.1" | version: "1.0.1" | ||||
code_builder: | |||||
dependency: transitive | |||||
description: | |||||
name: code_builder | |||||
url: "https://pub.flutter-io.cn" | |||||
source: hosted | |||||
version: "3.4.1" | |||||
collection: | collection: | ||||
dependency: transitive | dependency: transitive | ||||
description: | description: | ||||
@@ -71,6 +162,13 @@ packages: | |||||
url: "https://pub.flutter-io.cn" | url: "https://pub.flutter-io.cn" | ||||
source: hosted | source: hosted | ||||
version: "2.1.3" | version: "2.1.3" | ||||
csslib: | |||||
dependency: transitive | |||||
description: | |||||
name: csslib | |||||
url: "https://pub.flutter-io.cn" | |||||
source: hosted | |||||
version: "0.16.2" | |||||
cupertino_icons: | cupertino_icons: | ||||
dependency: "direct main" | dependency: "direct main" | ||||
description: | description: | ||||
@@ -78,6 +176,13 @@ packages: | |||||
url: "https://pub.flutter-io.cn" | url: "https://pub.flutter-io.cn" | ||||
source: hosted | source: hosted | ||||
version: "0.1.3" | version: "0.1.3" | ||||
dart_style: | |||||
dependency: transitive | |||||
description: | |||||
name: dart_style | |||||
url: "https://pub.flutter-io.cn" | |||||
source: hosted | |||||
version: "1.3.6" | |||||
device_info: | device_info: | ||||
dependency: transitive | dependency: transitive | ||||
description: | description: | ||||
@@ -99,6 +204,13 @@ packages: | |||||
url: "https://pub.flutter-io.cn" | url: "https://pub.flutter-io.cn" | ||||
source: hosted | source: hosted | ||||
version: "3.0.10" | version: "3.0.10" | ||||
equatable: | |||||
dependency: transitive | |||||
description: | |||||
name: equatable | |||||
url: "https://pub.flutter-io.cn" | |||||
source: hosted | |||||
version: "1.2.4" | |||||
file: | file: | ||||
dependency: transitive | dependency: transitive | ||||
description: | description: | ||||
@@ -106,6 +218,13 @@ packages: | |||||
url: "https://pub.flutter-io.cn" | url: "https://pub.flutter-io.cn" | ||||
source: hosted | source: hosted | ||||
version: "5.2.1" | version: "5.2.1" | ||||
fixnum: | |||||
dependency: transitive | |||||
description: | |||||
name: fixnum | |||||
url: "https://pub.flutter-io.cn" | |||||
source: hosted | |||||
version: "0.10.11" | |||||
flutter: | flutter: | ||||
dependency: "direct main" | dependency: "direct main" | ||||
description: flutter | description: flutter | ||||
@@ -149,6 +268,27 @@ packages: | |||||
url: "https://pub.flutter-io.cn" | url: "https://pub.flutter-io.cn" | ||||
source: hosted | source: hosted | ||||
version: "7.0.4" | version: "7.0.4" | ||||
glob: | |||||
dependency: transitive | |||||
description: | |||||
name: glob | |||||
url: "https://pub.flutter-io.cn" | |||||
source: hosted | |||||
version: "1.2.0" | |||||
graphs: | |||||
dependency: transitive | |||||
description: | |||||
name: graphs | |||||
url: "https://pub.flutter-io.cn" | |||||
source: hosted | |||||
version: "0.2.0" | |||||
html: | |||||
dependency: transitive | |||||
description: | |||||
name: html | |||||
url: "https://pub.flutter-io.cn" | |||||
source: hosted | |||||
version: "0.14.0+3" | |||||
http: | http: | ||||
dependency: transitive | dependency: transitive | ||||
description: | description: | ||||
@@ -156,6 +296,13 @@ packages: | |||||
url: "https://pub.flutter-io.cn" | url: "https://pub.flutter-io.cn" | ||||
source: hosted | source: hosted | ||||
version: "0.12.2" | version: "0.12.2" | ||||
http_multi_server: | |||||
dependency: transitive | |||||
description: | |||||
name: http_multi_server | |||||
url: "https://pub.flutter-io.cn" | |||||
source: hosted | |||||
version: "2.2.0" | |||||
http_parser: | http_parser: | ||||
dependency: transitive | dependency: transitive | ||||
description: | description: | ||||
@@ -177,6 +324,41 @@ packages: | |||||
url: "https://pub.flutter-io.cn" | url: "https://pub.flutter-io.cn" | ||||
source: hosted | source: hosted | ||||
version: "0.16.1" | version: "0.16.1" | ||||
io: | |||||
dependency: transitive | |||||
description: | |||||
name: io | |||||
url: "https://pub.flutter-io.cn" | |||||
source: hosted | |||||
version: "0.3.4" | |||||
js: | |||||
dependency: transitive | |||||
description: | |||||
name: js | |||||
url: "https://pub.flutter-io.cn" | |||||
source: hosted | |||||
version: "0.6.2" | |||||
json_annotation: | |||||
dependency: transitive | |||||
description: | |||||
name: json_annotation | |||||
url: "https://pub.flutter-io.cn" | |||||
source: hosted | |||||
version: "3.0.1" | |||||
json_serializable: | |||||
dependency: transitive | |||||
description: | |||||
name: json_serializable | |||||
url: "https://pub.flutter-io.cn" | |||||
source: hosted | |||||
version: "3.4.1" | |||||
logging: | |||||
dependency: transitive | |||||
description: | |||||
name: logging | |||||
url: "https://pub.flutter-io.cn" | |||||
source: hosted | |||||
version: "0.11.4" | |||||
matcher: | matcher: | ||||
dependency: transitive | dependency: transitive | ||||
description: | description: | ||||
@@ -191,6 +373,34 @@ packages: | |||||
url: "https://pub.flutter-io.cn" | url: "https://pub.flutter-io.cn" | ||||
source: hosted | source: hosted | ||||
version: "1.1.8" | version: "1.1.8" | ||||
mime: | |||||
dependency: transitive | |||||
description: | |||||
name: mime | |||||
url: "https://pub.flutter-io.cn" | |||||
source: hosted | |||||
version: "0.9.7" | |||||
node_interop: | |||||
dependency: transitive | |||||
description: | |||||
name: node_interop | |||||
url: "https://pub.flutter-io.cn" | |||||
source: hosted | |||||
version: "1.1.1" | |||||
node_io: | |||||
dependency: transitive | |||||
description: | |||||
name: node_io | |||||
url: "https://pub.flutter-io.cn" | |||||
source: hosted | |||||
version: "1.1.1" | |||||
package_config: | |||||
dependency: transitive | |||||
description: | |||||
name: package_config | |||||
url: "https://pub.flutter-io.cn" | |||||
source: hosted | |||||
version: "1.9.3" | |||||
package_info: | package_info: | ||||
dependency: transitive | dependency: transitive | ||||
description: | description: | ||||
@@ -261,6 +471,13 @@ packages: | |||||
url: "https://pub.flutter-io.cn" | url: "https://pub.flutter-io.cn" | ||||
source: hosted | source: hosted | ||||
version: "1.0.2" | version: "1.0.2" | ||||
pool: | |||||
dependency: transitive | |||||
description: | |||||
name: pool | |||||
url: "https://pub.flutter-io.cn" | |||||
source: hosted | |||||
version: "1.4.0" | |||||
process: | process: | ||||
dependency: transitive | dependency: transitive | ||||
description: | description: | ||||
@@ -268,6 +485,20 @@ packages: | |||||
url: "https://pub.flutter-io.cn" | url: "https://pub.flutter-io.cn" | ||||
source: hosted | source: hosted | ||||
version: "3.0.13" | version: "3.0.13" | ||||
pub_semver: | |||||
dependency: transitive | |||||
description: | |||||
name: pub_semver | |||||
url: "https://pub.flutter-io.cn" | |||||
source: hosted | |||||
version: "1.4.4" | |||||
pubspec_parse: | |||||
dependency: transitive | |||||
description: | |||||
name: pubspec_parse | |||||
url: "https://pub.flutter-io.cn" | |||||
source: hosted | |||||
version: "0.1.5" | |||||
quiver: | quiver: | ||||
dependency: transitive | dependency: transitive | ||||
description: | description: | ||||
@@ -317,11 +548,32 @@ packages: | |||||
url: "https://pub.flutter-io.cn" | url: "https://pub.flutter-io.cn" | ||||
source: hosted | source: hosted | ||||
version: "0.1.2+7" | version: "0.1.2+7" | ||||
shelf: | |||||
dependency: transitive | |||||
description: | |||||
name: shelf | |||||
url: "https://pub.flutter-io.cn" | |||||
source: hosted | |||||
version: "0.7.9" | |||||
shelf_web_socket: | |||||
dependency: transitive | |||||
description: | |||||
name: shelf_web_socket | |||||
url: "https://pub.flutter-io.cn" | |||||
source: hosted | |||||
version: "0.2.3" | |||||
sky_engine: | sky_engine: | ||||
dependency: transitive | dependency: transitive | ||||
description: flutter | description: flutter | ||||
source: sdk | source: sdk | ||||
version: "0.0.99" | version: "0.0.99" | ||||
source_gen: | |||||
dependency: transitive | |||||
description: | |||||
name: source_gen | |||||
url: "https://pub.flutter-io.cn" | |||||
source: hosted | |||||
version: "0.9.6" | |||||
source_span: | source_span: | ||||
dependency: transitive | dependency: transitive | ||||
description: | description: | ||||
@@ -357,6 +609,13 @@ packages: | |||||
url: "https://pub.flutter-io.cn" | url: "https://pub.flutter-io.cn" | ||||
source: hosted | source: hosted | ||||
version: "2.0.0" | version: "2.0.0" | ||||
stream_transform: | |||||
dependency: transitive | |||||
description: | |||||
name: stream_transform | |||||
url: "https://pub.flutter-io.cn" | |||||
source: hosted | |||||
version: "1.2.0" | |||||
string_scanner: | string_scanner: | ||||
dependency: transitive | dependency: transitive | ||||
description: | description: | ||||
@@ -385,6 +644,13 @@ packages: | |||||
url: "https://pub.flutter-io.cn" | url: "https://pub.flutter-io.cn" | ||||
source: hosted | source: hosted | ||||
version: "0.2.11" | version: "0.2.11" | ||||
timing: | |||||
dependency: transitive | |||||
description: | |||||
name: timing | |||||
url: "https://pub.flutter-io.cn" | |||||
source: hosted | |||||
version: "0.1.1+2" | |||||
typed_data: | typed_data: | ||||
dependency: transitive | dependency: transitive | ||||
description: | description: | ||||
@@ -406,6 +672,20 @@ packages: | |||||
url: "https://pub.flutter-io.cn" | url: "https://pub.flutter-io.cn" | ||||
source: hosted | source: hosted | ||||
version: "2.0.8" | version: "2.0.8" | ||||
watcher: | |||||
dependency: transitive | |||||
description: | |||||
name: watcher | |||||
url: "https://pub.flutter-io.cn" | |||||
source: hosted | |||||
version: "0.9.7+15" | |||||
web_socket_channel: | |||||
dependency: transitive | |||||
description: | |||||
name: web_socket_channel | |||||
url: "https://pub.flutter-io.cn" | |||||
source: hosted | |||||
version: "1.1.0" | |||||
xdg_directories: | xdg_directories: | ||||
dependency: transitive | dependency: transitive | ||||
description: | description: | ||||
@@ -420,6 +700,13 @@ packages: | |||||
url: "https://pub.flutter-io.cn" | url: "https://pub.flutter-io.cn" | ||||
source: hosted | source: hosted | ||||
version: "3.5.0" | version: "3.5.0" | ||||
yaml: | |||||
dependency: transitive | |||||
description: | |||||
name: yaml | |||||
url: "https://pub.flutter-io.cn" | |||||
source: hosted | |||||
version: "2.2.1" | |||||
zhiying_comm: | zhiying_comm: | ||||
dependency: "direct dev" | dependency: "direct dev" | ||||
description: | description: | ||||
@@ -0,0 +1,106 @@ | |||||
import 'package:equatable/equatable.dart'; | |||||
import 'package:json_annotation/json_annotation.dart'; | |||||
part 'widget_model.g.dart'; | |||||
@JsonSerializable() | |||||
// ignore: must_be_immutable | |||||
class WidgetModel extends Object implements Equatable { | |||||
@JsonKey(name: 'aspect_ratio') | |||||
String aspectRatio; | |||||
@JsonKey(name: 'badge') | |||||
String badge; | |||||
@JsonKey(name: 'bg_color') | |||||
String bgColor; | |||||
@JsonKey(name: 'bg_color_t') | |||||
String bgColorT; | |||||
@JsonKey(name: 'bg_img') | |||||
String bgImg; | |||||
@JsonKey(name: 'components') | |||||
List<WidgetModel> components; | |||||
@JsonKey(name: 'data') | |||||
String data; | |||||
@JsonKey(name: 'font_color') | |||||
String fontColor; | |||||
@JsonKey(name: 'icon') | |||||
String icon; | |||||
@JsonKey(name: 'img') | |||||
String img; | |||||
@JsonKey(name: 'is_global') | |||||
int isGlobal; | |||||
@JsonKey(name: 'margin') | |||||
String margin; | |||||
@JsonKey(name: 'mod_id') | |||||
int modId; | |||||
@JsonKey(name: 'mod_name') | |||||
String modName; | |||||
@JsonKey(name: 'mod_pid') | |||||
int modPid; | |||||
@JsonKey(name: 'path') | |||||
String path; | |||||
@JsonKey(name: 'position') | |||||
String position; | |||||
@JsonKey(name: 'sort') | |||||
int sort; | |||||
@JsonKey(name: 'subtitle') | |||||
String subtitle; | |||||
@JsonKey(name: 'title') | |||||
String title; | |||||
@JsonKey(name: 'url') | |||||
String url; | |||||
WidgetModel( | |||||
this.aspectRatio, | |||||
this.badge, | |||||
this.bgColor, | |||||
this.bgColorT, | |||||
this.bgImg, | |||||
this.components, | |||||
this.data, | |||||
this.fontColor, | |||||
this.icon, | |||||
this.img, | |||||
this.isGlobal, | |||||
this.margin, | |||||
this.modId, | |||||
this.modName, | |||||
this.modPid, | |||||
this.path, | |||||
this.position, | |||||
this.sort, | |||||
this.subtitle, | |||||
this.title, | |||||
this.url, | |||||
); | |||||
factory WidgetModel.fromJson(Map<String, dynamic> srcJson) => | |||||
_$WidgetModelFromJson(srcJson); | |||||
Map<String, dynamic> toJson() => _$WidgetModelToJson(this); | |||||
@override | |||||
List<Object> get props => [modId]; | |||||
@override | |||||
bool get stringify => null; | |||||
} |
@@ -0,0 +1,61 @@ | |||||
// GENERATED CODE - DO NOT MODIFY BY HAND | |||||
part of 'widget_model.dart'; | |||||
// ************************************************************************** | |||||
// JsonSerializableGenerator | |||||
// ************************************************************************** | |||||
WidgetModel _$WidgetModelFromJson(Map<String, dynamic> json) { | |||||
return WidgetModel( | |||||
json['aspect_ratio'] as String, | |||||
json['badge'] as String, | |||||
json['bg_color'] as String, | |||||
json['bg_color_t'] as String, | |||||
json['bg_img'] as String, | |||||
(json['components'] as List) | |||||
?.map((e) => | |||||
e == null ? null : WidgetModel.fromJson(e as Map<String, dynamic>)) | |||||
?.toList(), | |||||
json['data'] as String, | |||||
json['font_color'] as String, | |||||
json['icon'] as String, | |||||
json['img'] as String, | |||||
json['is_global'] as int, | |||||
json['margin'] as String, | |||||
json['mod_id'] as int, | |||||
json['mod_name'] as String, | |||||
json['mod_pid'] as int, | |||||
json['path'] as String, | |||||
json['position'] as String, | |||||
json['sort'] as int, | |||||
json['subtitle'] as String, | |||||
json['title'] as String, | |||||
json['url'] as String, | |||||
); | |||||
} | |||||
Map<String, dynamic> _$WidgetModelToJson(WidgetModel instance) => | |||||
<String, dynamic>{ | |||||
'aspect_ratio': instance.aspectRatio, | |||||
'badge': instance.badge, | |||||
'bg_color': instance.bgColor, | |||||
'bg_color_t': instance.bgColorT, | |||||
'bg_img': instance.bgImg, | |||||
'components': instance.components, | |||||
'data': instance.data, | |||||
'font_color': instance.fontColor, | |||||
'icon': instance.icon, | |||||
'img': instance.img, | |||||
'is_global': instance.isGlobal, | |||||
'margin': instance.margin, | |||||
'mod_id': instance.modId, | |||||
'mod_name': instance.modName, | |||||
'mod_pid': instance.modPid, | |||||
'path': instance.path, | |||||
'position': instance.position, | |||||
'sort': instance.sort, | |||||
'subtitle': instance.subtitle, | |||||
'title': instance.title, | |||||
'url': instance.url, | |||||
}; |
@@ -0,0 +1,43 @@ | |||||
// Generic Interface for all BLoCs | |||||
import 'package:flutter/material.dart'; | |||||
// 用法参考 https://www.dazhuanlan.com/2019/10/05/5d9835e2149ec/?__cf_chl_jschl_tk__=c887a5bbcade5b1c4e512e339d6456adc0a9e1e8-1589771890-0-AaeNBGzxeReSfKWxA7TZlNbvVfXjv759gU0mNNvmcB14JVlRVGLhl1cVJAVapb4Nc6W_mcSvPtAJQQ8okAWy4d9SdnrUcUJmZQJq2XP59oNFEEAg5oP9GhCHMvR2bqpWQzZXIKgIn3m_GvRMZ1B5lpGP-HPtkjjpb4vO4NHzRgnwwRJtm3-HEeknIa53PShS5wY4EEPXI4i8UdtJRc8oXlzYdNFzVJ_QteCKS6v2jsmP4LzGFo3zFspPF63dj5px-6nMLQlz2sKFSimTI7DQD4baHMDDSZr_4G_vohZjy7Ye1Qy_JHWTT_2TkW60f99AwA | |||||
abstract class BlocBase { | |||||
void dispose(); | |||||
} | |||||
// Generic BLoC provider | |||||
class BlocProvider<T extends BlocBase> extends StatefulWidget { | |||||
BlocProvider({ | |||||
Key key, | |||||
@required this.child, | |||||
@required this.bloc, | |||||
}) : super(key: key); | |||||
final T bloc; | |||||
final Widget child; | |||||
@override | |||||
_BlocProviderState<T> createState() => _BlocProviderState<T>(); | |||||
static T of<T extends BlocBase>(BuildContext context) { | |||||
final type = _typeOf<BlocProvider<T>>(); | |||||
BlocProvider<T> provider = context.ancestorWidgetOfExactType(type); | |||||
return provider.bloc; | |||||
} | |||||
static Type _typeOf<T>() => T; | |||||
} | |||||
class _BlocProviderState<T> extends State<BlocProvider<BlocBase>> { | |||||
@override | |||||
void dispose() { | |||||
widget.bloc.dispose(); | |||||
super.dispose(); | |||||
} | |||||
@override | |||||
Widget build(BuildContext context) { | |||||
return widget.child; | |||||
} | |||||
} |
@@ -61,7 +61,7 @@ class NetUtil { | |||||
receiveTimeout: 15000, | receiveTimeout: 15000, | ||||
contentType: Headers.jsonContentType, | contentType: Headers.jsonContentType, | ||||
followRedirects: true, | followRedirects: true, | ||||
headers: {'device': 'wx_applet'}, | |||||
headers: {'device': 'wx_applet', 'Platform': 'wx_applet'}, | |||||
)); | )); | ||||
_dio.interceptors.add(_NetInterceptors()); | _dio.interceptors.add(_NetInterceptors()); | ||||
_dio.interceptors.add(LogInterceptor()); | _dio.interceptors.add(LogInterceptor()); | ||||
@@ -146,29 +146,35 @@ class NetUtil { | |||||
// 根据请求参数,获取缓存的Key | // 根据请求参数,获取缓存的Key | ||||
String cacheKey = _getRequestParamsCachedKey(params, path); | String cacheKey = _getRequestParamsCachedKey(params, path); | ||||
// // 读取缓存回调 | // // 读取缓存回调 | ||||
await _onCallBackCacheData(onCache, cacheKey); | |||||
if (onCache != null) { | |||||
await _onCallBackCacheData(onCache, cacheKey); | |||||
} | |||||
// 参数签名 | // 参数签名 | ||||
Map<String, dynamic> sign = await signParams(params); | Map<String, dynamic> sign = await signParams(params); | ||||
Response response; | Response response; | ||||
try { | try { | ||||
Dio dio = await NetUtil.getInstance().dio; | Dio dio = await NetUtil.getInstance().dio; | ||||
response = await dio.request(path, data: sign, options: Options(method: enumToString(method))); | |||||
response = await dio.request(path, | |||||
data: sign, options: Options(method: enumToString(method))); | |||||
} on DioError catch (e) { | } on DioError catch (e) { | ||||
_formatError(e); | _formatError(e); | ||||
} | } | ||||
try{ | |||||
var result = response.data is Map ? response.data : jsonDecode(response.data); | |||||
try { | |||||
var result = | |||||
response.data is Map ? response.data : jsonDecode(response.data); | |||||
// TODO 解密? | // TODO 解密? | ||||
if (result[GlobalConfig.HTTP_RESPONSE_KEY_CODE] == | if (result[GlobalConfig.HTTP_RESPONSE_KEY_CODE] == | ||||
GlobalConfig.RESPONSE_SUCCESS_CODE || | |||||
GlobalConfig.RESPONSE_SUCCESS_CODE || | |||||
result[GlobalConfig.HTTP_RESPONSE_KEY_CODE] == | result[GlobalConfig.HTTP_RESPONSE_KEY_CODE] == | ||||
'${GlobalConfig.RESPONSE_SUCCESS_CODE}') { | '${GlobalConfig.RESPONSE_SUCCESS_CODE}') { | ||||
if (onSuccess != null) { | if (onSuccess != null) { | ||||
onSuccess(result[GlobalConfig.HTTP_RESPONSE_KEY_DATA]); | onSuccess(result[GlobalConfig.HTTP_RESPONSE_KEY_DATA]); | ||||
// 缓存返回的数据 | // 缓存返回的数据 | ||||
_setCallBackCacheData(cacheKey, response.data is Map ? jsonEncode(response.data) : response.data); | |||||
_setCallBackCacheData(cacheKey, | |||||
response.data is Map ? jsonEncode(response.data) : response.data); | |||||
} | } | ||||
return; | return; | ||||
} | } | ||||
@@ -182,7 +188,7 @@ class NetUtil { | |||||
if (onError != null) { | if (onError != null) { | ||||
onError(result[GlobalConfig.HTTP_RESPONSE_KEY_MSG] ?? '未知错误'); | onError(result[GlobalConfig.HTTP_RESPONSE_KEY_MSG] ?? '未知错误'); | ||||
} | } | ||||
}catch (e){ | |||||
} catch (e) { | |||||
if (onError != null) { | if (onError != null) { | ||||
onError(e?.toString() ?? '未知错误'); | onError(e?.toString() ?? '未知错误'); | ||||
} | } | ||||
@@ -278,8 +284,10 @@ class NetUtil { | |||||
if (!EmptyUtil.isEmpty(cacheMap) && | if (!EmptyUtil.isEmpty(cacheMap) && | ||||
cacheMap.containsKey(GlobalConfig.HTTP_RESPONSE_KEY_CODE) && | cacheMap.containsKey(GlobalConfig.HTTP_RESPONSE_KEY_CODE) && | ||||
(cacheMap[GlobalConfig.HTTP_RESPONSE_KEY_CODE] == GlobalConfig.RESPONSE_SUCCESS_CODE || | |||||
cacheMap[GlobalConfig.HTTP_RESPONSE_KEY_CODE] == '${GlobalConfig.RESPONSE_SUCCESS_CODE}') && | |||||
(cacheMap[GlobalConfig.HTTP_RESPONSE_KEY_CODE] == | |||||
GlobalConfig.RESPONSE_SUCCESS_CODE || | |||||
cacheMap[GlobalConfig.HTTP_RESPONSE_KEY_CODE] == | |||||
'${GlobalConfig.RESPONSE_SUCCESS_CODE}') && | |||||
null != cacheMap[GlobalConfig.HTTP_RESPONSE_KEY_DATA]) { | null != cacheMap[GlobalConfig.HTTP_RESPONSE_KEY_DATA]) { | ||||
onCache(cacheMap[GlobalConfig.HTTP_RESPONSE_KEY_DATA]); | onCache(cacheMap[GlobalConfig.HTTP_RESPONSE_KEY_DATA]); | ||||
return; | return; | ||||
@@ -20,3 +20,6 @@ export 'util/encode_util.dart'; | |||||
// native | // native | ||||
export 'native/native_router.dart'; | export 'native/native_router.dart'; | ||||
// model | |||||
export 'models/base/widget_model.dart'; |
@@ -1,6 +1,20 @@ | |||||
# Generated by pub | # Generated by pub | ||||
# See https://dart.dev/tools/pub/glossary#lockfile | # See https://dart.dev/tools/pub/glossary#lockfile | ||||
packages: | packages: | ||||
_fe_analyzer_shared: | |||||
dependency: transitive | |||||
description: | |||||
name: _fe_analyzer_shared | |||||
url: "https://pub.flutter-io.cn" | |||||
source: hosted | |||||
version: "6.0.0" | |||||
analyzer: | |||||
dependency: transitive | |||||
description: | |||||
name: analyzer | |||||
url: "https://pub.flutter-io.cn" | |||||
source: hosted | |||||
version: "0.39.14" | |||||
archive: | archive: | ||||
dependency: transitive | dependency: transitive | ||||
description: | description: | ||||
@@ -29,6 +43,62 @@ packages: | |||||
url: "https://pub.flutter-io.cn" | url: "https://pub.flutter-io.cn" | ||||
source: hosted | source: hosted | ||||
version: "1.0.5" | version: "1.0.5" | ||||
build: | |||||
dependency: transitive | |||||
description: | |||||
name: build | |||||
url: "https://pub.flutter-io.cn" | |||||
source: hosted | |||||
version: "1.3.0" | |||||
build_config: | |||||
dependency: transitive | |||||
description: | |||||
name: build_config | |||||
url: "https://pub.flutter-io.cn" | |||||
source: hosted | |||||
version: "0.4.2" | |||||
build_daemon: | |||||
dependency: transitive | |||||
description: | |||||
name: build_daemon | |||||
url: "https://pub.flutter-io.cn" | |||||
source: hosted | |||||
version: "2.1.4" | |||||
build_resolvers: | |||||
dependency: transitive | |||||
description: | |||||
name: build_resolvers | |||||
url: "https://pub.flutter-io.cn" | |||||
source: hosted | |||||
version: "1.3.11" | |||||
build_runner: | |||||
dependency: "direct main" | |||||
description: | |||||
name: build_runner | |||||
url: "https://pub.flutter-io.cn" | |||||
source: hosted | |||||
version: "1.10.1" | |||||
build_runner_core: | |||||
dependency: transitive | |||||
description: | |||||
name: build_runner_core | |||||
url: "https://pub.flutter-io.cn" | |||||
source: hosted | |||||
version: "6.0.1" | |||||
built_collection: | |||||
dependency: transitive | |||||
description: | |||||
name: built_collection | |||||
url: "https://pub.flutter-io.cn" | |||||
source: hosted | |||||
version: "4.3.2" | |||||
built_value: | |||||
dependency: transitive | |||||
description: | |||||
name: built_value | |||||
url: "https://pub.flutter-io.cn" | |||||
source: hosted | |||||
version: "7.1.0" | |||||
cached_network_image: | cached_network_image: | ||||
dependency: "direct main" | dependency: "direct main" | ||||
description: | description: | ||||
@@ -43,6 +113,20 @@ packages: | |||||
url: "https://pub.flutter-io.cn" | url: "https://pub.flutter-io.cn" | ||||
source: hosted | source: hosted | ||||
version: "1.1.2" | version: "1.1.2" | ||||
checked_yaml: | |||||
dependency: transitive | |||||
description: | |||||
name: checked_yaml | |||||
url: "https://pub.flutter-io.cn" | |||||
source: hosted | |||||
version: "1.0.2" | |||||
cli_util: | |||||
dependency: transitive | |||||
description: | |||||
name: cli_util | |||||
url: "https://pub.flutter-io.cn" | |||||
source: hosted | |||||
version: "0.1.4" | |||||
clock: | clock: | ||||
dependency: transitive | dependency: transitive | ||||
description: | description: | ||||
@@ -50,6 +134,13 @@ packages: | |||||
url: "https://pub.flutter-io.cn" | url: "https://pub.flutter-io.cn" | ||||
source: hosted | source: hosted | ||||
version: "1.0.1" | version: "1.0.1" | ||||
code_builder: | |||||
dependency: transitive | |||||
description: | |||||
name: code_builder | |||||
url: "https://pub.flutter-io.cn" | |||||
source: hosted | |||||
version: "3.4.1" | |||||
collection: | collection: | ||||
dependency: transitive | dependency: transitive | ||||
description: | description: | ||||
@@ -71,6 +162,20 @@ packages: | |||||
url: "https://pub.flutter-io.cn" | url: "https://pub.flutter-io.cn" | ||||
source: hosted | source: hosted | ||||
version: "2.1.3" | version: "2.1.3" | ||||
csslib: | |||||
dependency: transitive | |||||
description: | |||||
name: csslib | |||||
url: "https://pub.flutter-io.cn" | |||||
source: hosted | |||||
version: "0.16.2" | |||||
dart_style: | |||||
dependency: transitive | |||||
description: | |||||
name: dart_style | |||||
url: "https://pub.flutter-io.cn" | |||||
source: hosted | |||||
version: "1.3.6" | |||||
device_info: | device_info: | ||||
dependency: "direct main" | dependency: "direct main" | ||||
description: | description: | ||||
@@ -92,6 +197,13 @@ packages: | |||||
url: "https://pub.flutter-io.cn" | url: "https://pub.flutter-io.cn" | ||||
source: hosted | source: hosted | ||||
version: "3.0.10" | version: "3.0.10" | ||||
equatable: | |||||
dependency: "direct main" | |||||
description: | |||||
name: equatable | |||||
url: "https://pub.flutter-io.cn" | |||||
source: hosted | |||||
version: "1.2.4" | |||||
file: | file: | ||||
dependency: transitive | dependency: transitive | ||||
description: | description: | ||||
@@ -99,6 +211,13 @@ packages: | |||||
url: "https://pub.flutter-io.cn" | url: "https://pub.flutter-io.cn" | ||||
source: hosted | source: hosted | ||||
version: "5.2.1" | version: "5.2.1" | ||||
fixnum: | |||||
dependency: transitive | |||||
description: | |||||
name: fixnum | |||||
url: "https://pub.flutter-io.cn" | |||||
source: hosted | |||||
version: "0.10.11" | |||||
flutter: | flutter: | ||||
dependency: "direct main" | dependency: "direct main" | ||||
description: flutter | description: flutter | ||||
@@ -142,6 +261,27 @@ packages: | |||||
url: "https://pub.flutter-io.cn" | url: "https://pub.flutter-io.cn" | ||||
source: hosted | source: hosted | ||||
version: "7.0.4" | version: "7.0.4" | ||||
glob: | |||||
dependency: transitive | |||||
description: | |||||
name: glob | |||||
url: "https://pub.flutter-io.cn" | |||||
source: hosted | |||||
version: "1.2.0" | |||||
graphs: | |||||
dependency: transitive | |||||
description: | |||||
name: graphs | |||||
url: "https://pub.flutter-io.cn" | |||||
source: hosted | |||||
version: "0.2.0" | |||||
html: | |||||
dependency: transitive | |||||
description: | |||||
name: html | |||||
url: "https://pub.flutter-io.cn" | |||||
source: hosted | |||||
version: "0.14.0+3" | |||||
http: | http: | ||||
dependency: transitive | dependency: transitive | ||||
description: | description: | ||||
@@ -149,6 +289,13 @@ packages: | |||||
url: "https://pub.flutter-io.cn" | url: "https://pub.flutter-io.cn" | ||||
source: hosted | source: hosted | ||||
version: "0.12.2" | version: "0.12.2" | ||||
http_multi_server: | |||||
dependency: transitive | |||||
description: | |||||
name: http_multi_server | |||||
url: "https://pub.flutter-io.cn" | |||||
source: hosted | |||||
version: "2.2.0" | |||||
http_parser: | http_parser: | ||||
dependency: transitive | dependency: transitive | ||||
description: | description: | ||||
@@ -170,6 +317,41 @@ packages: | |||||
url: "https://pub.flutter-io.cn" | url: "https://pub.flutter-io.cn" | ||||
source: hosted | source: hosted | ||||
version: "0.16.1" | version: "0.16.1" | ||||
io: | |||||
dependency: transitive | |||||
description: | |||||
name: io | |||||
url: "https://pub.flutter-io.cn" | |||||
source: hosted | |||||
version: "0.3.4" | |||||
js: | |||||
dependency: transitive | |||||
description: | |||||
name: js | |||||
url: "https://pub.flutter-io.cn" | |||||
source: hosted | |||||
version: "0.6.2" | |||||
json_annotation: | |||||
dependency: transitive | |||||
description: | |||||
name: json_annotation | |||||
url: "https://pub.flutter-io.cn" | |||||
source: hosted | |||||
version: "3.0.1" | |||||
json_serializable: | |||||
dependency: "direct main" | |||||
description: | |||||
name: json_serializable | |||||
url: "https://pub.flutter-io.cn" | |||||
source: hosted | |||||
version: "3.4.1" | |||||
logging: | |||||
dependency: transitive | |||||
description: | |||||
name: logging | |||||
url: "https://pub.flutter-io.cn" | |||||
source: hosted | |||||
version: "0.11.4" | |||||
matcher: | matcher: | ||||
dependency: transitive | dependency: transitive | ||||
description: | description: | ||||
@@ -184,6 +366,34 @@ packages: | |||||
url: "https://pub.flutter-io.cn" | url: "https://pub.flutter-io.cn" | ||||
source: hosted | source: hosted | ||||
version: "1.1.8" | version: "1.1.8" | ||||
mime: | |||||
dependency: transitive | |||||
description: | |||||
name: mime | |||||
url: "https://pub.flutter-io.cn" | |||||
source: hosted | |||||
version: "0.9.7" | |||||
node_interop: | |||||
dependency: transitive | |||||
description: | |||||
name: node_interop | |||||
url: "https://pub.flutter-io.cn" | |||||
source: hosted | |||||
version: "1.1.1" | |||||
node_io: | |||||
dependency: transitive | |||||
description: | |||||
name: node_io | |||||
url: "https://pub.flutter-io.cn" | |||||
source: hosted | |||||
version: "1.1.1" | |||||
package_config: | |||||
dependency: transitive | |||||
description: | |||||
name: package_config | |||||
url: "https://pub.flutter-io.cn" | |||||
source: hosted | |||||
version: "1.9.3" | |||||
package_info: | package_info: | ||||
dependency: "direct main" | dependency: "direct main" | ||||
description: | description: | ||||
@@ -254,6 +464,13 @@ packages: | |||||
url: "https://pub.flutter-io.cn" | url: "https://pub.flutter-io.cn" | ||||
source: hosted | source: hosted | ||||
version: "1.0.2" | version: "1.0.2" | ||||
pool: | |||||
dependency: transitive | |||||
description: | |||||
name: pool | |||||
url: "https://pub.flutter-io.cn" | |||||
source: hosted | |||||
version: "1.4.0" | |||||
process: | process: | ||||
dependency: transitive | dependency: transitive | ||||
description: | description: | ||||
@@ -261,6 +478,20 @@ packages: | |||||
url: "https://pub.flutter-io.cn" | url: "https://pub.flutter-io.cn" | ||||
source: hosted | source: hosted | ||||
version: "3.0.13" | version: "3.0.13" | ||||
pub_semver: | |||||
dependency: transitive | |||||
description: | |||||
name: pub_semver | |||||
url: "https://pub.flutter-io.cn" | |||||
source: hosted | |||||
version: "1.4.4" | |||||
pubspec_parse: | |||||
dependency: transitive | |||||
description: | |||||
name: pubspec_parse | |||||
url: "https://pub.flutter-io.cn" | |||||
source: hosted | |||||
version: "0.1.5" | |||||
quiver: | quiver: | ||||
dependency: transitive | dependency: transitive | ||||
description: | description: | ||||
@@ -310,11 +541,32 @@ packages: | |||||
url: "https://pub.flutter-io.cn" | url: "https://pub.flutter-io.cn" | ||||
source: hosted | source: hosted | ||||
version: "0.1.2+7" | version: "0.1.2+7" | ||||
shelf: | |||||
dependency: transitive | |||||
description: | |||||
name: shelf | |||||
url: "https://pub.flutter-io.cn" | |||||
source: hosted | |||||
version: "0.7.9" | |||||
shelf_web_socket: | |||||
dependency: transitive | |||||
description: | |||||
name: shelf_web_socket | |||||
url: "https://pub.flutter-io.cn" | |||||
source: hosted | |||||
version: "0.2.3" | |||||
sky_engine: | sky_engine: | ||||
dependency: transitive | dependency: transitive | ||||
description: flutter | description: flutter | ||||
source: sdk | source: sdk | ||||
version: "0.0.99" | version: "0.0.99" | ||||
source_gen: | |||||
dependency: transitive | |||||
description: | |||||
name: source_gen | |||||
url: "https://pub.flutter-io.cn" | |||||
source: hosted | |||||
version: "0.9.6" | |||||
source_span: | source_span: | ||||
dependency: transitive | dependency: transitive | ||||
description: | description: | ||||
@@ -350,6 +602,13 @@ packages: | |||||
url: "https://pub.flutter-io.cn" | url: "https://pub.flutter-io.cn" | ||||
source: hosted | source: hosted | ||||
version: "2.0.0" | version: "2.0.0" | ||||
stream_transform: | |||||
dependency: transitive | |||||
description: | |||||
name: stream_transform | |||||
url: "https://pub.flutter-io.cn" | |||||
source: hosted | |||||
version: "1.2.0" | |||||
string_scanner: | string_scanner: | ||||
dependency: transitive | dependency: transitive | ||||
description: | description: | ||||
@@ -378,6 +637,13 @@ packages: | |||||
url: "https://pub.flutter-io.cn" | url: "https://pub.flutter-io.cn" | ||||
source: hosted | source: hosted | ||||
version: "0.2.11" | version: "0.2.11" | ||||
timing: | |||||
dependency: transitive | |||||
description: | |||||
name: timing | |||||
url: "https://pub.flutter-io.cn" | |||||
source: hosted | |||||
version: "0.1.1+2" | |||||
typed_data: | typed_data: | ||||
dependency: transitive | dependency: transitive | ||||
description: | description: | ||||
@@ -399,6 +665,20 @@ packages: | |||||
url: "https://pub.flutter-io.cn" | url: "https://pub.flutter-io.cn" | ||||
source: hosted | source: hosted | ||||
version: "2.0.8" | version: "2.0.8" | ||||
watcher: | |||||
dependency: transitive | |||||
description: | |||||
name: watcher | |||||
url: "https://pub.flutter-io.cn" | |||||
source: hosted | |||||
version: "0.9.7+15" | |||||
web_socket_channel: | |||||
dependency: transitive | |||||
description: | |||||
name: web_socket_channel | |||||
url: "https://pub.flutter-io.cn" | |||||
source: hosted | |||||
version: "1.1.0" | |||||
xdg_directories: | xdg_directories: | ||||
dependency: transitive | dependency: transitive | ||||
description: | description: | ||||
@@ -413,6 +693,13 @@ packages: | |||||
url: "https://pub.flutter-io.cn" | url: "https://pub.flutter-io.cn" | ||||
source: hosted | source: hosted | ||||
version: "3.5.0" | version: "3.5.0" | ||||
yaml: | |||||
dependency: transitive | |||||
description: | |||||
name: yaml | |||||
url: "https://pub.flutter-io.cn" | |||||
source: hosted | |||||
version: "2.2.1" | |||||
sdks: | sdks: | ||||
dart: ">=2.7.0 <3.0.0" | dart: ">=2.7.0 <3.0.0" | ||||
flutter: ">=1.12.13+hotfix.5 <2.0.0" | flutter: ">=1.12.13+hotfix.5 <2.0.0" |
@@ -17,6 +17,9 @@ dependencies: | |||||
flutter_native_image: ^0.0.5 | flutter_native_image: ^0.0.5 | ||||
fluttertoast: ^7.0.4 | fluttertoast: ^7.0.4 | ||||
cached_network_image: ^2.2.0+1 | cached_network_image: ^2.2.0+1 | ||||
equatable: ^1.2.0 | |||||
json_serializable: ^3.3.0 | |||||
build_runner: ^1.10.0 | |||||
# 屏幕适配 | # 屏幕适配 | ||||
flutter_screenutil: ^1.1.0 | flutter_screenutil: ^1.1.0 | ||||
# 缓存 | # 缓存 | ||||