Parcourir la source

[fix]调整快捷方式处理

zk il y a 1 an
Parent
commit
da9fbb5cef
3 fichiers modifiés avec 57 ajouts et 38 suppressions
  1. 24 20
      lib/module/home/view.dart
  2. 22 0
      lib/module/main/controller.dart
  3. 11 18
      lib/module/splash/controller.dart

+ 24 - 20
lib/module/home/view.dart

@@ -308,26 +308,30 @@ class HomePage extends BasePage<HomePageController> {
             controller.onLoginClick();
           }
         },
-        child: Row(
-          children: [
-            SizedBox(
-                width: 36.w,
-                height: 36.w,
-                child: controller.isLogin
-                    ? Assets.images.iconHomeLogged.image()
-                    : Assets.images.iconHomeNoLogin.image()),
-            SizedBox(width: 8.w),
-            Text(controller.loginTxt,
-                style: TextStyle(
-                    fontWeight: FontWeight.bold,
-                    fontSize: 15.sp,
-                    color: ColorName.primaryTextColor)),
-            SizedBox(width: 6.w),
-            controller.isLogin
-                ? const SizedBox.shrink()
-                : SizedBox(
-                    height: 16.w, child: Assets.images.iconGoLoginArrow.image())
-          ],
+        child: Container(
+          color: ColorName.transparent,
+          child: Row(
+            children: [
+              SizedBox(
+                  width: 36.w,
+                  height: 36.w,
+                  child: controller.isLogin
+                      ? Assets.images.iconHomeLogged.image()
+                      : Assets.images.iconHomeNoLogin.image()),
+              SizedBox(width: 8.w),
+              Text(controller.loginTxt,
+                  style: TextStyle(
+                      fontWeight: FontWeight.bold,
+                      fontSize: 15.sp,
+                      color: ColorName.primaryTextColor)),
+              SizedBox(width: 6.w),
+              controller.isLogin
+                  ? const SizedBox.shrink()
+                  : SizedBox(
+                      height: 16.w,
+                      child: Assets.images.iconGoLoginArrow.image())
+            ],
+          ),
         ),
       );
     });

+ 22 - 0
lib/module/main/controller.dart

@@ -78,6 +78,28 @@ class MainController extends BaseController {
   void setLastPressedAt(lastPressedAt) {
     _lastPressedAt = lastPressedAt;
   }
+
+  @override
+  void onInit() {
+    super.onInit();
+    accountRepository;
+  }
+
+  @override
+  void onReady() {
+    super.onReady();
+    _initParameters();
+  }
+
+  void _initParameters() {
+    if (parameters == null) {
+      return;
+    }
+    String? action = parameters?[LaunchAction.key];
+    if (action == LaunchAction.recordAudioAction) {
+      Get.toNamed(RoutePath.record);
+    }
+  }
 }
 
 class TabBean {

+ 11 - 18
lib/module/splash/controller.dart

@@ -89,28 +89,21 @@ class SplashController extends BaseController {
 
   isAgreePrivacyNextStep() {
     //判断是否有额外操作执行
-    final routeMap = DesktopShortcutUtils.getRouteMap();
-    if (routeMap != null) {
-      _dealExistData(routeMap);
+    if (DesktopShortcutUtils.getRouteMap() != null) {
+      final routeMap = DesktopShortcutUtils.getRouteMap();
+      if (routeMap?[LaunchAction.key] == LaunchAction.recordAudioAction) {
+        _goMain(Duration.zero, arguments: routeMap);
+      } else {
+        _goMain(Duration(seconds: splashDelayedTime));
+      }
     } else {
-      _normalGoMain();
+      _goMain(Duration(seconds: splashDelayedTime));
     }
   }
 
-  _dealExistData(Map<String, dynamic> routeMap) {
-    if (routeMap[LaunchAction.key] == LaunchAction.recordAudioAction) {
-      //录音
-      Get.offNamed(RoutePath.mainTab);
-      Get.toNamed(RoutePath.record);
-      DesktopShortcutUtils.clearRouteMap();
-    } else {
-      _normalGoMain();
-    }
-  }
-
-  void _normalGoMain() {
-    Timer(Duration(seconds: splashDelayedTime), () {
-      Get.offNamed(RoutePath.mainTab);
+  void _goMain(Duration delayTime, {Map<String, dynamic>? arguments}) {
+    Timer(delayTime, () {
+      Get.offNamed(RoutePath.mainTab, arguments: arguments);
     });
   }
 }