Bladeren bron

[new]优化ios端检查定位权限弹窗按钮

zk 7 maanden geleden
bovenliggende
commit
b70a1cdf32
1 gewijzigde bestanden met toevoegingen van 61 en 42 verwijderingen
  1. 61 42
      lib/dialog/check_loation_permission_dialog.dart

+ 61 - 42
lib/dialog/check_loation_permission_dialog.dart

@@ -1,8 +1,10 @@
+import 'dart:io';
 import 'dart:ui';
 
 import 'package:flutter/material.dart';
 import 'package:flutter_screenutil/flutter_screenutil.dart';
 import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
+import 'package:location/resource/colors.gen.dart';
 import 'package:location/utils/common_expand.dart';
 
 import '../resource/assets.gen.dart';
@@ -36,8 +38,8 @@ class CheckLocationPermissionView extends Dialog {
   Widget build(BuildContext context) {
     //图片当做背景
     return Container(
-      width: 289.w,
-      height: 223.w,
+      width: 290.w,
+      height: 230.w,
       decoration: BoxDecoration(
         image: DecorationImage(
           image: Assets.images.bgCheckLocationPermission.provider(),
@@ -56,48 +58,65 @@ class CheckLocationPermissionView extends Dialog {
           Text(StringName.dialogRecordLocationHasPermission,
               style: TextStyle(fontSize: 15.sp, color: '#404040'.color)),
           SizedBox(height: 20.6.w),
-          Row(
-            mainAxisAlignment: MainAxisAlignment.center,
-            children: [
-              GestureDetector(
-                onTap: () {
-                  CheckLocationPermissionDialog.dismiss();
-                },
-                child: Container(
-                  decoration: BoxDecoration(
-                    border: Border.all(color: '#AAAAAA'.color, width: 1.w),
-                    borderRadius: BorderRadius.circular(54.w),
-                  ),
-                  width: 109.w,
-                  height: 40.w,
-                  child: Center(
-                    child: Text(
-                      StringName.dialogRecordLocationNotRequest,
-                      style: TextStyle(fontSize: 14.sp, color: '#AAAAAA'.color),
-                    ),
-                  ),
-                ),
-              ),
-              SizedBox(width: 16.w),
-              GestureDetector(
-                onTap: () {
-                  onRequestPermissionClick.call();
-                  CheckLocationPermissionDialog.dismiss();
-                },
-                child: Container(
-                  decoration: getPrimaryBtnDecoration(54.w),
-                  width: 109.w,
-                  height: 40.w,
-                  child: Center(
-                    child: Text(StringName.dialogRecordLocationRequest,
-                        style: TextStyle(fontSize: 14.sp, color: Colors.white)),
-                  ),
-                ),
-              )
-            ],
-          )
+          if (Platform.isIOS) buildIosBtnView() else buildAndroidBtnView(),
         ],
       ),
     );
   }
+
+  Widget buildIosBtnView() {
+    return Container(
+        width: 229.w,
+        height: 40.w,
+        decoration: BoxDecoration(
+          color: ColorName.colorPrimary,
+          borderRadius: BorderRadius.circular(54.w),
+        ),
+        child: Center(
+            child: Text(StringName.nextStep,
+                style: TextStyle(fontSize: 14.sp, color: ColorName.white))));
+  }
+
+  Widget buildAndroidBtnView() {
+    return Row(
+      mainAxisAlignment: MainAxisAlignment.center,
+      children: [
+        GestureDetector(
+          onTap: () {
+            CheckLocationPermissionDialog.dismiss();
+          },
+          child: Container(
+            decoration: BoxDecoration(
+              border: Border.all(color: '#AAAAAA'.color, width: 1.w),
+              borderRadius: BorderRadius.circular(54.w),
+            ),
+            width: 109.w,
+            height: 40.w,
+            child: Center(
+              child: Text(
+                StringName.dialogRecordLocationNotRequest,
+                style: TextStyle(fontSize: 14.sp, color: '#AAAAAA'.color),
+              ),
+            ),
+          ),
+        ),
+        SizedBox(width: 16.w),
+        GestureDetector(
+          onTap: () {
+            onRequestPermissionClick.call();
+            CheckLocationPermissionDialog.dismiss();
+          },
+          child: Container(
+            decoration: getPrimaryBtnDecoration(54.w),
+            width: 109.w,
+            height: 40.w,
+            child: Center(
+              child: Text(StringName.dialogRecordLocationRequest,
+                  style: TextStyle(fontSize: 14.sp, color: Colors.white)),
+            ),
+          ),
+        )
+      ],
+    );
+  }
 }