diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index e7c17d5..16d70ea 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -20,16 +20,10 @@
-
-
-
-
-
-
-
-
+
+
@@ -464,10 +458,17 @@
+
+
+
+
+
+
+
+
-
@@ -478,7 +479,6 @@
-
@@ -489,7 +489,6 @@
-
@@ -500,7 +499,6 @@
-
@@ -508,10 +506,6 @@
-
-
-
-
@@ -519,8 +513,19 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/lib/util/application.dart b/lib/util/application.dart
index 6ee6174..4db473d 100644
--- a/lib/util/application.dart
+++ b/lib/util/application.dart
@@ -1,5 +1,7 @@
typedef Future InitMethod();
+typedef Future StringParamsMethod(data);
+
class Application {
// 初始化方法
static List _initMethods = List();
@@ -7,6 +9,8 @@ class Application {
///有标签的方法用于没有页面的第三模块调用
static Map _initStringMethods = Map();
+ static Map _initStringParamsMethods = Map();
+
static Future init() async {
for (InitMethod method in _initMethods) {
await method();
@@ -20,22 +24,38 @@ class Application {
}
static addStringMethod({String type, InitMethod method}) {
- if(type==null||method==null){
+ if (type == null || method == null) {
return;
}
_initStringMethods[type] = method;
}
- static bool hasStringMethod(String type){
- return _initStringMethods.containsKey(type);
+ static bool hasStringMethod(String type) {
+ return _initStringMethods.containsKey(type);
}
- static doStringMethod(String type){
- if(_initStringMethods.containsKey(type)){
- print("存在方法"+type);
+ static doStringMethod(String type) {
+ if (_initStringMethods.containsKey(type)) {
+ print("存在方法" + type);
_initStringMethods[type]();
- }else{
- print("不存在方法"+type);
+ } else {
+ print("不存在方法" + type);
+ }
+ }
+
+ static addStringParamsMethod({String type , StringParamsMethod method}) {
+ if (type == null || method == null) {
+ return;
+ }
+ _initStringParamsMethods[type] = method;
+ }
+
+ static doStringParamsMethod(String type, {Map data}) {
+ if (_initStringParamsMethods.containsKey(type)) {
+ print("存在方法" + type);
+ _initStringParamsMethods[type](data);
+ } else {
+ print("不存在方法" + type);
}
}
}
diff --git a/lib/util/router_util.dart b/lib/util/router_util.dart
index 9f0edbc..97e1bc9 100644
--- a/lib/util/router_util.dart
+++ b/lib/util/router_util.dart
@@ -16,7 +16,6 @@ class RouterUtil {
* data 额外参数
* */
static Future route(SkipModel skipModel, Map data, BuildContext context) async {
-
if (skipModel.skipIdentifier == null || skipModel.skipIdentifier == '') {
print('skipIdentifier 参数不存在,无法跳转页面');
return Future.error('skipIdentifier 参数不存在,无法跳转页面');
@@ -37,8 +36,7 @@ class RouterUtil {
}
if (skipModel?.requiredTaobaoAuth == '1') {
- UserInfoModel user =
- await Provider.of(context, listen: false).getUserInfoModel();
+ UserInfoModel user = await Provider.of(context, listen: false).getUserInfoModel();
if (!user?.isTBAuth ?? false) {
TaobaoAuth.auth(context);
return;
@@ -47,7 +45,7 @@ class RouterUtil {
// webView
if (skipModel?.skipIdentifier == 'pub.flutter.url') {
- this.openWebview(skipModel?.url, context);
+ RouterUtil.openWebview(skipModel?.url, context);
return;
}
@@ -86,9 +84,14 @@ class RouterUtil {
Logger.error('跳转链接不能为空');
return Future.error('跳转链接不能为空');
}
+
SkipModel model = SkipModel();
model.skipIdentifier = 'pub.flutter.url';
model.url = url;
+ if (Platform.isAndroid) {
+ Application.doStringParamsMethod("openUrl", data: {"url": model.url});
+ return null;
+ }
RouterUtil.route(model, model.toJson(), context);
}