|
|
@@ -1,7 +1,10 @@
|
|
|
+import 'dart:async';
|
|
|
import 'dart:convert';
|
|
|
import 'dart:io';
|
|
|
|
|
|
import 'package:flutter/services.dart';
|
|
|
+import 'package:get/get.dart';
|
|
|
+import 'package:get/get_core/src/get_main.dart';
|
|
|
import 'package:location/data/consts/build_config.dart';
|
|
|
import 'package:location/data/consts/web_url.dart';
|
|
|
import 'package:location/resource/assets.gen.dart';
|
|
|
@@ -53,9 +56,47 @@ class QuickLoginHelper {
|
|
|
} else if (Platform.isAndroid) {
|
|
|
file = Assets.config.androidQuickLoginConfig;
|
|
|
}
|
|
|
- return rootBundle.loadString(file).then((value) {
|
|
|
- return {"uiConfig": json.decode(value)};
|
|
|
- });
|
|
|
+ dynamic configMap = json.decode(await rootBundle.loadString(file));
|
|
|
+ //自定义配置
|
|
|
+ if (Platform.isAndroid) {
|
|
|
+ configMap = getAndroidCustomConfigSetting(configMap);
|
|
|
+ } else if (Platform.isIOS) {
|
|
|
+ //TODO ios需参考UI完善自定义配置
|
|
|
+ }
|
|
|
+ return {"uiConfig": configMap};
|
|
|
+ }
|
|
|
+
|
|
|
+ static dynamic getAndroidCustomConfigSetting(dynamic configMap) {
|
|
|
+ final List<dynamic> rawWidgets = configMap['widgets'] ?? [];
|
|
|
+ final List<Map<String, dynamic>> widgetsMap =
|
|
|
+ rawWidgets.map((e) => Map<String, dynamic>.from(e)).toList();
|
|
|
+
|
|
|
+ //背景图
|
|
|
+ final Map<String, dynamic> bgHeaderMap = {};
|
|
|
+ bgHeaderMap['viewId'] = 'bg_header';
|
|
|
+ bgHeaderMap['type'] = 'ImageView';
|
|
|
+ bgHeaderMap['isGravityCenter'] = true;
|
|
|
+ bgHeaderMap['top'] = 0;
|
|
|
+ bgHeaderMap['backgroundImgPath'] = "bg_header";
|
|
|
+ bgHeaderMap['width'] = Get.width.toInt();
|
|
|
+ int height = (Get.width * (648 / 1083)).toInt();
|
|
|
+ bgHeaderMap['height'] = height;
|
|
|
+ widgetsMap.add(bgHeaderMap);
|
|
|
+ //自定义返回按钮
|
|
|
+ final Map<String, dynamic> backMap = {};
|
|
|
+ backMap['viewId'] = 'ic_back';
|
|
|
+ backMap['type'] = 'ImageView';
|
|
|
+ backMap['isGravityCenter'] = true;
|
|
|
+ backMap['top'] = 16;
|
|
|
+ backMap['left'] = 20;
|
|
|
+ backMap['backgroundImgPath'] = "icon_common_back";
|
|
|
+ backMap['width'] = 24;
|
|
|
+ backMap['height'] = 24;
|
|
|
+ backMap['action'] = 'back';
|
|
|
+ widgetsMap.add(backMap);
|
|
|
+
|
|
|
+ configMap['widgets'] = widgetsMap;
|
|
|
+ return configMap;
|
|
|
}
|
|
|
|
|
|
// 在初始化方法中添加测试代码(如 initState 或单独的测试按钮
|