李志伟 3 lat temu
rodzic
commit
53890268b6

+ 29
- 3
android/app/build.gradle Wyświetl plik

@@ -26,7 +26,7 @@ apply plugin: 'kotlin-android'
26 26
 apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
27 27
 
28 28
 android {
29
-    compileSdkVersion flutter.compileSdkVersion
29
+    compileSdkVersion 31
30 30
 
31 31
     compileOptions {
32 32
         sourceCompatibility JavaVersion.VERSION_1_8
@@ -36,17 +36,41 @@ android {
36 36
     defaultConfig {
37 37
         // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
38 38
         applicationId "com.example.worker_client"
39
-        minSdkVersion flutter.minSdkVersion
40
-        targetSdkVersion flutter.targetSdkVersion
39
+        minSdkVersion 21
40
+        targetSdkVersion 28
41 41
         versionCode flutterVersionCode.toInteger()
42 42
         versionName flutterVersionName
43 43
     }
44
+    signingConfigs {
45
+        debug {
46
+            //keystore中key的别名
47
+            keyAlias 'mykey'
48
+            //keystore中key的密码
49
+            keyPassword 'SJPrpy7yF8XdkXHY'
50
+            //keystore的文件路径,可以是绝对路径也可以是相对路径
51
+            storeFile file('../machinery.keystore')
52
+            //keystore的密码l
53
+            storePassword 'Op4CCmT20L0c0fLP'
54
+        }
55
+    }
56
+
57
+    dependencies {
58
+        implementation('com.amap.api:3dmap:9.1.0')
59
+        implementation('com.amap.api:location:6.1.0')
60
+    }
44 61
 
45 62
     buildTypes {
63
+        debug {
64
+            minifyEnabled false
65
+        }
46 66
         release {
47 67
             // TODO: Add your own signing config for the release build.
48 68
             // Signing with the debug keys for now, so `flutter run --release` works.
49 69
             signingConfig signingConfigs.debug
70
+
71
+            //关闭混淆, 否则在运行release包后可能出现运行崩溃, TODO后续进行混淆配置
72
+            minifyEnabled false //删除无用代码
73
+            shrinkResources false //删除无用资源
50 74
         }
51 75
     }
52 76
 }
@@ -54,3 +78,5 @@ android {
54 78
 flutter {
55 79
     source '../..'
56 80
 }
81
+
82
+

+ 30
- 0
android/app/src/main/AndroidManifest.xml Wyświetl plik

@@ -1,5 +1,30 @@
1 1
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
2
+    xmlns:tools="http://schemas.android.com/tools"
2 3
     package="com.example.worker_client">
4
+    <uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
5
+    <!--允许获取精确位置,精准定位必选-->
6
+    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
7
+    <!--允许获取粗略位置,粗略定位必选-->
8
+    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
9
+    <!--允许获取设备和运营商信息,用于问题排查和网络定位(无gps情况下的定位),若需网络定位功能则必选-->
10
+    <uses-permission android:name="android.permission.READ_PHONE_STATE" />
11
+    <!--允许获取网络状态,用于网络定位(无gps情况下的定位),若需网络定位功能则必选-->
12
+    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
13
+    <!--允许获取wifi网络信息,用于网络定位(无gps情况下的定位),若需网络定位功能则必选-->
14
+    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
15
+    <!--允许获取wifi状态改变,用于网络定位(无gps情况下的定位),若需网络定位功能则必选-->
16
+    <uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
17
+    <!--后台获取位置信息,若需后台定位则必选-->
18
+    <uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" />
19
+    <!--用于申请调用A-GPS模块,卫星定位加速-->
20
+    <uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" />
21
+    <!--允许写设备缓存,用于问题排查-->
22
+    <uses-permission android:name="android.permission.WRITE_SETTINGS" tools:ignore="ProtectedPermissions" />
23
+    <!--允许写入扩展存储,用于写入缓存定位数据-->
24
+    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
25
+    <!--允许读设备等信息,用于问题排查-->
26
+    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
27
+
3 28
    <application
4 29
         android:label="worker_client"
5 30
         android:name="${applicationName}"
@@ -30,5 +55,10 @@
30 55
         <meta-data
31 56
             android:name="flutterEmbedding"
32 57
             android:value="2" />
58
+       <meta-data
59
+           android:name="com.amap.api.v2.apikey"
60
+           android:value="b481b4187e24e625fa0056fd0530e663"/>
61
+       <service android:name="com.amap.api.location.APSService"
62
+           tools:ignore="MissingClass" />
33 63
     </application>
34 64
 </manifest>

+ 0
- 6
android/app/src/main/java/com/example/worker_client/MainActivity.java Wyświetl plik

@@ -1,6 +0,0 @@
1
-package com.example.worker_client;
2
-
3
-import io.flutter.embedding.android.FlutterActivity;
4
-
5
-public class MainActivity extends FlutterActivity {
6
-}

+ 6
- 0
android/app/src/main/kotlin/com/example/worker_client/MainActivity.kt Wyświetl plik

@@ -0,0 +1,6 @@
1
+package com.example.worker_client
2
+
3
+import io.flutter.embedding.android.FlutterActivity
4
+
5
+class MainActivity: FlutterActivity() {
6
+}

BIN
android/app/src/main/res/drawable/launch_image.png Wyświetl plik


+ 1
- 1
android/app/src/main/res/values/styles.xml Wyświetl plik

@@ -4,7 +4,7 @@
4 4
     <style name="LaunchTheme" parent="@android:style/Theme.Light.NoTitleBar">
5 5
         <!-- Show a splash screen on the activity. Automatically removed when
6 6
              Flutter draws its first frame -->
7
-        <item name="android:windowBackground">@drawable/launch_background</item>
7
+        <item name="android:windowBackground">@drawable/launch_image</item>
8 8
     </style>
9 9
     <!-- Theme applied to the Android Window as soon as the process has started.
10 10
          This theme determines the color of the Android Window while your

+ 36
- 35
lib/models/app.dart Wyświetl plik

@@ -1,11 +1,11 @@
1 1
 
2 2
 import 'dart:io';
3 3
 
4
-// import 'package:amap_flutter_location/amap_flutter_location.dart';
4
+import 'package:amap_flutter_location/amap_flutter_location.dart';
5 5
 import '/models/entities/person.dart';
6
-// import '/widgets/Modal.dart';
6
+import '/widgets/Modal.dart';
7 7
 import 'package:get/get.dart';
8
-// import '../utils/location.dart';
8
+import '../utils/location.dart';
9 9
 
10 10
 class AppController extends GetxController {
11 11
   // 有了这句, 可以直接 AppController.t 调用
@@ -15,37 +15,38 @@ class AppController extends GetxController {
15 15
   final location = Rxn<Map<String, Object>>();
16 16
   final testInt = 1.obs;
17 17
 
18
-  // AMapFlutterLocation? _location;
19
-  //
20
-  // get locationStr {
21
-  //   if (null == location.value) return null;
22
-  //
23
-  //   double longitude = location.value!['longitude'] as double;
24
-  //   double latitude = location.value!['latitude'] as double;
25
-  //
26
-  //   return longitude.toString() + "," + latitude.toString();
27
-  // }
28
-  //
29
-  // void onLocationChange (Map<String, Object> result) {
30
-  //   location(result);
31
-  // }
18
+  AMapFlutterLocation? _location;
19
+
20
+  get locationStr {
21
+    if (null == location.value) return null;
22
+
23
+    double longitude = location.value!['longitude'] as double;
24
+    double latitude = location.value!['latitude'] as double;
25
+
26
+    return longitude.toString() + "," + latitude.toString();
27
+  }
28
+
29
+  void onLocationChange (Map<String, Object> result) {
30
+
31
+    location(result);
32
+  }
32 33
 
33 34
   @override
34 35
   void onInit() {
35 36
     super.onInit();
36 37
 
37
-    // 尝试获取 location
38
-    // requireLocation(onLocationChange).then((loc) {
39
-    //   _location = loc;
40
-    // }).catchError((e) {
41
-    //   print(e);
42
-    //
43
-    //   showAlert(
44
-    //     title: '获取定位失败',
45
-    //     message: e.message,
46
-    //     onConfirm: () => exit(1),
47
-    //   );
48
-    // });
38
+    //尝试获取 location
39
+    requireLocation(onLocationChange).then((loc) {
40
+      _location = loc;
41
+    }).catchError((e) {
42
+      print(e);
43
+
44
+      showAlert(
45
+        title: '获取定位失败',
46
+        message: e.message,
47
+        onConfirm: () => exit(1),
48
+      );
49
+    });
49 50
 
50 51
     // // 尝试获取一次人员信息
51 52
     // getCurrent().then((person) {
@@ -55,11 +56,11 @@ class AppController extends GetxController {
55 56
     // });
56 57
   }
57 58
 
58
-  // @override
59
-  // void onClose() {
60
-  //   if (null != _location) {
61
-  //     _location?.destroy();
62
-  //   }
63
-  // }
59
+  @override
60
+  void onClose() {
61
+    if (null != _location) {
62
+      _location?.destroy();
63
+    }
64
+  }
64 65
 
65 66
 }

+ 1
- 2
lib/pages/Login/index.dart Wyświetl plik

@@ -8,7 +8,6 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
8 8
 import 'package:get/get.dart';
9 9
 import 'package:worker_client/widgets/Cell.dart';
10 10
 import 'package:worker_client/widgets/GradientButton.dart';
11
-import 'package:worker_client/pages/home/index.dart';
12 11
 import 'package:worker_client/widgets/MyButton/index.dart';
13 12
 import '../../models/entities/person.dart';
14 13
 import '../../services/user.dart';
@@ -85,7 +84,7 @@ class _Login extends State<Login> {
85 84
           userLogin(phone, qCode).then((res) {
86 85
             userInfo(Person.fromJson(res['person']));
87 86
             Fluttertoast.showToast(msg: '登录成功!');
88
-            Get.off(Home());
87
+            Get.offNamed('/home');
89 88
           }).catchError((err) {
90 89
             Fluttertoast.showToast(msg: err);
91 90
           });

+ 30
- 31
lib/pages/home/index.dart Wyświetl plik

@@ -115,14 +115,14 @@ class Home extends BasicPage {
115 115
                         required bool haveMore}) {
116 116
                       return RefreshBuilder(
117 117
                         fetch: (params) => getJobList(params),
118
-                        useState: (value) {jobList(GetList(value.records));},
118
+                        useState: (value) {
119
+                          jobList(GetList(value.records));
120
+                        },
119 121
                         builder: (
120 122
                             {required BuildContext context,
121 123
                             required Function toggle}) {
122 124
                           Refresh = toggle;
123
-                          return
124
-
125
-                                ListView.builder(
125
+                          return ListView.builder(
126 126
                               controller: scrollController,
127 127
                               itemCount: 1,
128 128
                               itemBuilder:
@@ -131,34 +131,33 @@ class Home extends BasicPage {
131 131
                                   ...jobList.value,
132 132
                                   ...GetList(data.records)
133 133
                                 ]);
134
-                                return Obx((){if (jobList.value != []) {
135
-                                  return Column(
136
-                                    children: jobList.value
137
-                                        .map(
138
-                                          (item) => MyCard(
139
-                                            item: item,
140
-                                            job: true,
141
-                                            detail: false,
142
-                                            onClick: () {
143
-                                              changeJob(item);
144
-                                            },
145
-                                            goDetail: () {
146
-                                              goDetail(item);
147
-                                            },
148
-                                            buttomText: item.status == 0
149
-                                                ? '开始作业'
150
-                                                : '完成作业',
151
-                                          ),
152
-                                        )
153
-                                        .toList(),
154
-                                  );
155
-                                } else {
156
-                                  return const Text('暂无数据');
157
-                                }
158
-                                }
134
+                                return Obx(() {
135
+                                  if (jobList.value != []) {
136
+                                    return Column(
137
+                                      children: jobList.value
138
+                                          .map(
139
+                                            (item) => MyCard(
140
+                                              item: item,
141
+                                              job: true,
142
+                                              detail: false,
143
+                                              onClick: () {
144
+                                                changeJob(item);
145
+                                              },
146
+                                              goDetail: () {
147
+                                                goDetail(item);
148
+                                              },
149
+                                              buttomText: item.status == 0
150
+                                                  ? '开始作业'
151
+                                                  : '完成作业',
152
+                                            ),
153
+                                          )
154
+                                          .toList(),
159 155
                                     );
160
-                              })
161
-                          ;
156
+                                  } else {
157
+                                    return const Text('暂无数据');
158
+                                  }
159
+                                });
160
+                              });
162 161
                         },
163 162
                         onError: () {},
164 163
                       );

+ 1
- 0
lib/pages/jobDetail/index.dart Wyświetl plik

@@ -8,6 +8,7 @@ import 'package:worker_client/widgets/layout/BasicPage.dart';
8 8
 import '/widgets/MyDialog.dart' as modal;
9 9
 
10 10
 class JobDetail extends BasicPage {
11
+
11 12
   final job = Rx<Job>(Job());
12 13
   @override
13 14
   void beforeShow() {

+ 22
- 0
lib/utils/amap/const_config.dart Wyświetl plik

@@ -0,0 +1,22 @@
1
+import 'package:amap_flutter_base/amap_flutter_base.dart';
2
+import 'package:amap_flutter_map/amap_flutter_map.dart';
3
+
4
+class ConstConfig {
5
+  ///配置您申请的apikey,在此处配置之后,可以在初始化[AMapWidget]时,通过`apiKey`属性设置
6
+  ///
7
+  ///注意:使用[AMapWidget]的`apiKey`属性设置的key的优先级高于通过Native配置key的优先级,
8
+  ///使用[AMapWidget]的`apiKey`属性配置后Native配置的key将失效,请根据实际情况选择使用
9
+  static const AMapApiKey amapApiKeys = AMapApiKey(
10
+      androidKey: 'b481b4187e24e625fa0056fd0530e663',
11
+      iosKey: '您申请的iOS平台的key');
12
+
13
+  ///高德隐私合规声明,这里只是示例,实际使用中请按照实际参数设置[AMapPrivacyStatement]的'hasContains''hasShow''hasAgree'这三个参数
14
+  ///
15
+  /// 注意:[AMapPrivacyStatement]的'hasContains''hasShow''hasAgree'这三个参数中有一个为false,高德SDK均不会工作,会造成地图白屏等现象
16
+  ///
17
+  /// 高德开发者合规指南请参考:https://lbs.amap.com/agreement/compliance
18
+  ///
19
+  /// 高德SDK合规使用方案请参考:https://lbs.amap.com/news/sdkhgsy
20
+  static const AMapPrivacyStatement amapPrivacyStatement =
21
+  AMapPrivacyStatement(hasContains: true, hasShow: true, hasAgree: true);
22
+}

+ 134
- 0
lib/utils/location.dart Wyświetl plik

@@ -0,0 +1,134 @@
1
+import 'dart:async';
2
+
3
+import 'package:amap_flutter_location/amap_flutter_location.dart';
4
+import 'package:amap_flutter_location/amap_location_option.dart';
5
+import 'package:permission_handler/permission_handler.dart';
6
+
7
+import 'amap/const_config.dart';
8
+
9
+typedef AMAPListener = void Function (Map<String, Object>);
10
+
11
+void showPrivacy() {
12
+  /// 设置是否已经包含高德隐私政策并弹窗展示显示用户查看,如果未包含或者没有弹窗展示,高德定位SDK将不会工作
13
+  ///
14
+  /// 高德SDK合规使用方案请参考官网地址:https://lbs.amap.com/news/sdkhgsy
15
+  /// <b>必须保证在调用定位功能之前调用, 建议首次启动App时弹出《隐私政策》并取得用户同意</b>
16
+  ///
17
+  /// 高德SDK合规使用方案请参考官网地址:https://lbs.amap.com/news/sdkhgsy
18
+  ///
19
+  /// [hasContains] 隐私声明中是否包含高德隐私政策说明
20
+  ///
21
+  /// [hasShow] 隐私权政策是否弹窗展示告知用户
22
+  AMapFlutterLocation.updatePrivacyShow(true, true);
23
+
24
+  /// 设置是否已经取得用户同意,如果未取得用户同意,高德定位SDK将不会工作
25
+  ///
26
+  /// 高德SDK合规使用方案请参考官网地址:https://lbs.amap.com/news/sdkhgsy
27
+  ///
28
+  /// <b>必须保证在调用定位功能之前调用, 建议首次启动App时弹出《隐私政策》并取得用户同意</b>
29
+  ///
30
+  /// [hasAgree] 隐私权政策是否已经取得用户同意
31
+  AMapFlutterLocation.updatePrivacyAgree(true);
32
+}
33
+
34
+// 判断定位权限
35
+Future _requirePermission() async {
36
+  PermissionStatus _permissionGranted = await Permission.location.status;
37
+  if (_permissionGranted == PermissionStatus.denied) {
38
+    // 如果未允许, 尝试申请一次
39
+    _permissionGranted = await Permission.location.request();
40
+    if (_permissionGranted != PermissionStatus.granted) {
41
+      throw Exception("请设置允许当前程序定位功能");
42
+    }
43
+  }
44
+}
45
+
46
+Future requireLocation(AMAPListener listener) async {
47
+  AMapFlutterLocation.setApiKey(ConstConfig.amapApiKeys.androidKey!, ConstConfig.amapApiKeys.iosKey!);
48
+  showPrivacy();
49
+  await _requirePermission();
50
+  final AMapFlutterLocation location = AMapFlutterLocation();
51
+  location.onLocationChanged().listen(listener);
52
+  location.setLocationOption(_getAMapLocationOption());
53
+  location.startLocation();
54
+
55
+  return location;
56
+}
57
+
58
+_getAMapLocationOption() {
59
+  AMapLocationOption locationOption = new AMapLocationOption();
60
+
61
+  ///是否单次定位
62
+  locationOption.onceLocation = false;
63
+
64
+  ///是否需要返回逆地理信息
65
+  locationOption.needAddress = true;
66
+
67
+  ///逆地理信息的语言类型
68
+  locationOption.geoLanguage = GeoLanguage.DEFAULT;
69
+
70
+  locationOption.desiredLocationAccuracyAuthorizationMode =
71
+      AMapLocationAccuracyAuthorizationMode.ReduceAccuracy;
72
+
73
+  locationOption.fullAccuracyPurposeKey = "AMapLocationScene";
74
+
75
+  ///设置Android端连续定位的定位间隔
76
+  locationOption.locationInterval = 2000;
77
+
78
+  ///设置Android端的定位模式<br>
79
+  ///可选值:<br>
80
+  ///<li>[AMapLocationMode.Battery_Saving]</li>
81
+  ///<li>[AMapLocationMode.Device_Sensors]</li>
82
+  ///<li>[AMapLocationMode.Hight_Accuracy]</li>
83
+  locationOption.locationMode = AMapLocationMode.Hight_Accuracy;
84
+
85
+  ///设置iOS端的定位最小更新距离<br>
86
+  locationOption.distanceFilter = -1;
87
+
88
+  ///设置iOS端期望的定位精度
89
+  /// 可选值:<br>
90
+  /// <li>[DesiredAccuracy.Best] 最高精度</li>
91
+  /// <li>[DesiredAccuracy.BestForNavigation] 适用于导航场景的高精度 </li>
92
+  /// <li>[DesiredAccuracy.NearestTenMeters] 10米 </li>
93
+  /// <li>[DesiredAccuracy.Kilometer] 1000米</li>
94
+  /// <li>[DesiredAccuracy.ThreeKilometers] 3000米</li>
95
+  locationOption.desiredAccuracy = DesiredAccuracy.Best;
96
+
97
+  ///设置iOS端是否允许系统暂停定位
98
+  locationOption.pausesLocationUpdatesAutomatically = false;
99
+
100
+  return locationOption;
101
+}
102
+
103
+
104
+// import 'dart:io';
105
+//
106
+// import 'package:flutter_baidu_mapapi_base/flutter_baidu_mapapi_base.dart'
107
+//     show BMFMapSDK, BMF_COORD_TYPE;
108
+// import 'package:flutter_bmflocation/flutter_bmflocation.dart';
109
+// import 'package:permission_handler/permission_handler.dart';
110
+//
111
+// Future requireLocation() async {
112
+//   // 判断定位权限
113
+//   PermissionStatus _permissionGranted = await Permission.location.status;
114
+//   if (_permissionGranted == PermissionStatus.denied) {
115
+//     // 如果未允许, 尝试申请一次
116
+//     _permissionGranted = await Permission.location.request();
117
+//     if (_permissionGranted != PermissionStatus.granted) {
118
+//       throw Exception("请设置允许当前程序定位功能");
119
+//     }
120
+//   }
121
+//
122
+//   final LocationFlutterPlugin location = LocationFlutterPlugin();
123
+//
124
+//   // 设置是否隐私政策
125
+//   location.setAgreePrivacy(true);
126
+//   BMFMapSDK.setAgreePrivacy(true);
127
+//   if (Platform.isAndroid) {
128
+//     // Android 目前不支持接口设置Apikey,
129
+//     // 请在主工程的Manifest文件里设置,详细配置方法请参考官网(https://lbsyun.baidu.com/)demo
130
+//     BMFMapSDK.setCoordType(BMF_COORD_TYPE.COMMON);
131
+//   }
132
+//
133
+//   return location;
134
+// }

+ 4
- 8
lib/widgets/MyCard/index.dart Wyświetl plik

@@ -244,16 +244,12 @@ class MyCard extends StatelessWidget {
244 244
                 Visibility(
245 245
                     child: CardCell(
246 246
                         lable: '作业时间',
247
-                        content: item is Job ? item.startDate.toString() : '',
247
+                        content: item.startDate.toString() +
248
+                            (item.endDate != null
249
+                                ? '\n' + item.endDate.toString()
250
+                                : ''),
248 251
                         size: 2),
249 252
                     visible: job),
250
-                Visibility(
251
-                    child: CardCell(
252
-                        lable: '',
253
-                        content:
254
-                            (item is Job ? item.endDate ?? '' : '').toString(),
255
-                        size: 2),
256
-                    visible: job&&item.endDate!=null),
257 253
                 CardCell(
258 254
                     lable: '订单费用',
259 255
                     content: ((item.charges ?? 0) / 100).toString(),

+ 42
- 0
lib/widgets/amap/amap.dart Wyświetl plik

@@ -0,0 +1,42 @@
1
+import 'package:amap_flutter_map/amap_flutter_map.dart';
2
+import 'package:amap_flutter_base/amap_flutter_base.dart';
3
+import 'package:flutter/widgets.dart';
4
+
5
+import '/utils/amap/const_config.dart';
6
+
7
+// https://developer.amap.com/api/flutter/guide/map-flutter-plug-in/map-flutter-info
8
+class AMap extends StatelessWidget {
9
+  late AMapController _mapController;
10
+  final LatLng? position;
11
+  final Map<String, Marker> _markers = Map<String, Marker>();
12
+
13
+  AMap({Key? key,  this.position }): super(key: key);
14
+
15
+  void onMapCreated(AMapController controller) {
16
+    _mapController = controller;
17
+  }
18
+
19
+  void _initMarkers() {
20
+    if (null != position) {
21
+      Marker marker = Marker(
22
+        position: position!,
23
+        icon: BitmapDescriptor.fromIconPath("images/locationImage.png")
24
+      );
25
+      _markers[marker.id] = marker;
26
+    }
27
+  }
28
+
29
+  @override
30
+  Widget build(BuildContext context) {
31
+    _initMarkers();
32
+
33
+    return AMapWidget(
34
+      privacyStatement: ConstConfig.amapPrivacyStatement,
35
+      apiKey: ConstConfig.amapApiKeys,
36
+      markers: Set<Marker>.of(_markers.values),
37
+      // 默认是邓州市中心
38
+      initialCameraPosition: const CameraPosition(target: LatLng(32.687732, 112.08745)),
39
+    );
40
+  }
41
+
42
+}

+ 22
- 0
lib/widgets/amap/const_config.dart Wyświetl plik

@@ -0,0 +1,22 @@
1
+import 'package:amap_flutter_base/amap_flutter_base.dart';
2
+import 'package:amap_flutter_map/amap_flutter_map.dart';
3
+
4
+class ConstConfig {
5
+  ///配置您申请的apikey,在此处配置之后,可以在初始化[AMapWidget]时,通过`apiKey`属性设置
6
+  ///
7
+  ///注意:使用[AMapWidget]的`apiKey`属性设置的key的优先级高于通过Native配置key的优先级,
8
+  ///使用[AMapWidget]的`apiKey`属性配置后Native配置的key将失效,请根据实际情况选择使用
9
+  static const AMapApiKey amapApiKeys = AMapApiKey(
10
+      androidKey: 'b481b4187e24e625fa0056fd0530e663',
11
+      iosKey: '您申请的iOS平台的key');
12
+
13
+  ///高德隐私合规声明,这里只是示例,实际使用中请按照实际参数设置[AMapPrivacyStatement]的'hasContains''hasShow''hasAgree'这三个参数
14
+  ///
15
+  /// 注意:[AMapPrivacyStatement]的'hasContains''hasShow''hasAgree'这三个参数中有一个为false,高德SDK均不会工作,会造成地图白屏等现象
16
+  ///
17
+  /// 高德开发者合规指南请参考:https://lbs.amap.com/agreement/compliance
18
+  ///
19
+  /// 高德SDK合规使用方案请参考:https://lbs.amap.com/news/sdkhgsy
20
+  static const AMapPrivacyStatement amapPrivacyStatement =
21
+  AMapPrivacyStatement(hasContains: true, hasShow: true, hasAgree: true);
22
+}

+ 210
- 0
pubspec.lock Wyświetl plik

@@ -1,6 +1,48 @@
1 1
 # Generated by pub
2 2
 # See https://dart.dev/tools/pub/glossary#lockfile
3 3
 packages:
4
+  _fe_analyzer_shared:
5
+    dependency: transitive
6
+    description:
7
+      name: _fe_analyzer_shared
8
+      url: "https://pub.flutter-io.cn"
9
+    source: hosted
10
+    version: "39.0.0"
11
+  amap_flutter_base:
12
+    dependency: transitive
13
+    description:
14
+      name: amap_flutter_base
15
+      url: "https://pub.flutter-io.cn"
16
+    source: hosted
17
+    version: "3.0.0"
18
+  amap_flutter_location:
19
+    dependency: "direct main"
20
+    description:
21
+      name: amap_flutter_location
22
+      url: "https://pub.flutter-io.cn"
23
+    source: hosted
24
+    version: "3.0.0"
25
+  amap_flutter_map:
26
+    dependency: "direct main"
27
+    description:
28
+      name: amap_flutter_map
29
+      url: "https://pub.flutter-io.cn"
30
+    source: hosted
31
+    version: "3.0.0"
32
+  analyzer:
33
+    dependency: transitive
34
+    description:
35
+      name: analyzer
36
+      url: "https://pub.flutter-io.cn"
37
+    source: hosted
38
+    version: "4.0.0"
39
+  args:
40
+    dependency: transitive
41
+    description:
42
+      name: args
43
+      url: "https://pub.flutter-io.cn"
44
+    source: hosted
45
+    version: "2.3.0"
4 46
   async:
5 47
     dependency: transitive
6 48
     description:
@@ -15,6 +57,20 @@ packages:
15 57
       url: "https://pub.flutter-io.cn"
16 58
     source: hosted
17 59
     version: "2.1.0"
60
+  build:
61
+    dependency: transitive
62
+    description:
63
+      name: build
64
+      url: "https://pub.flutter-io.cn"
65
+    source: hosted
66
+    version: "2.3.0"
67
+  build_config:
68
+    dependency: transitive
69
+    description:
70
+      name: build_config
71
+      url: "https://pub.flutter-io.cn"
72
+    source: hosted
73
+    version: "1.0.0"
18 74
   carousel_slider:
19 75
     dependency: "direct main"
20 76
     description:
@@ -36,6 +92,13 @@ packages:
36 92
       url: "https://pub.flutter-io.cn"
37 93
     source: hosted
38 94
     version: "1.3.1"
95
+  checked_yaml:
96
+    dependency: transitive
97
+    description:
98
+      name: checked_yaml
99
+      url: "https://pub.flutter-io.cn"
100
+    source: hosted
101
+    version: "2.0.1"
39 102
   clock:
40 103
     dependency: transitive
41 104
     description:
@@ -50,6 +113,20 @@ packages:
50 113
       url: "https://pub.flutter-io.cn"
51 114
     source: hosted
52 115
     version: "1.15.0"
116
+  convert:
117
+    dependency: transitive
118
+    description:
119
+      name: convert
120
+      url: "https://pub.flutter-io.cn"
121
+    source: hosted
122
+    version: "3.0.1"
123
+  crypto:
124
+    dependency: transitive
125
+    description:
126
+      name: crypto
127
+      url: "https://pub.flutter-io.cn"
128
+    source: hosted
129
+    version: "3.0.2"
53 130
   cupertino_icons:
54 131
     dependency: "direct main"
55 132
     description:
@@ -57,6 +134,13 @@ packages:
57 134
       url: "https://pub.flutter-io.cn"
58 135
     source: hosted
59 136
     version: "1.0.4"
137
+  dart_style:
138
+    dependency: transitive
139
+    description:
140
+      name: dart_style
141
+      url: "https://pub.flutter-io.cn"
142
+    source: hosted
143
+    version: "2.2.3"
60 144
   dio:
61 145
     dependency: "direct main"
62 146
     description:
@@ -97,6 +181,13 @@ packages:
97 181
       url: "https://pub.flutter-io.cn"
98 182
     source: hosted
99 183
     version: "1.0.4"
184
+  flutter_plugin_android_lifecycle:
185
+    dependency: transitive
186
+    description:
187
+      name: flutter_plugin_android_lifecycle
188
+      url: "https://pub.flutter-io.cn"
189
+    source: hosted
190
+    version: "2.0.5"
100 191
   flutter_screenutil:
101 192
     dependency: "direct main"
102 193
     description:
@@ -135,6 +226,13 @@ packages:
135 226
       url: "https://pub.flutter-io.cn"
136 227
     source: hosted
137 228
     version: "2.0.3"
229
+  glob:
230
+    dependency: transitive
231
+    description:
232
+      name: glob
233
+      url: "https://pub.flutter-io.cn"
234
+    source: hosted
235
+    version: "2.0.2"
138 236
   http_parser:
139 237
     dependency: transitive
140 238
     description:
@@ -149,6 +247,20 @@ packages:
149 247
       url: "https://pub.flutter-io.cn"
150 248
     source: hosted
151 249
     version: "0.6.3"
250
+  json_annotation:
251
+    dependency: transitive
252
+    description:
253
+      name: json_annotation
254
+      url: "https://pub.flutter-io.cn"
255
+    source: hosted
256
+    version: "4.5.0"
257
+  json_serializable:
258
+    dependency: "direct main"
259
+    description:
260
+      name: json_serializable
261
+      url: "https://pub.flutter-io.cn"
262
+    source: hosted
263
+    version: "6.2.0"
152 264
   lints:
153 265
     dependency: transitive
154 266
     description:
@@ -156,6 +268,13 @@ packages:
156 268
       url: "https://pub.flutter-io.cn"
157 269
     source: hosted
158 270
     version: "1.0.1"
271
+  logging:
272
+    dependency: transitive
273
+    description:
274
+      name: logging
275
+      url: "https://pub.flutter-io.cn"
276
+    source: hosted
277
+    version: "1.0.2"
159 278
   matcher:
160 279
     dependency: transitive
161 280
     description:
@@ -177,6 +296,13 @@ packages:
177 296
       url: "https://pub.flutter-io.cn"
178 297
     source: hosted
179 298
     version: "1.7.0"
299
+  package_config:
300
+    dependency: transitive
301
+    description:
302
+      name: package_config
303
+      url: "https://pub.flutter-io.cn"
304
+    source: hosted
305
+    version: "2.0.2"
180 306
   path:
181 307
     dependency: transitive
182 308
     description:
@@ -233,6 +359,41 @@ packages:
233 359
       url: "https://pub.flutter-io.cn"
234 360
     source: hosted
235 361
     version: "2.0.5"
362
+  permission_handler:
363
+    dependency: "direct main"
364
+    description:
365
+      name: permission_handler
366
+      url: "https://pub.flutter-io.cn"
367
+    source: hosted
368
+    version: "9.2.0"
369
+  permission_handler_android:
370
+    dependency: transitive
371
+    description:
372
+      name: permission_handler_android
373
+      url: "https://pub.flutter-io.cn"
374
+    source: hosted
375
+    version: "9.0.2+1"
376
+  permission_handler_apple:
377
+    dependency: transitive
378
+    description:
379
+      name: permission_handler_apple
380
+      url: "https://pub.flutter-io.cn"
381
+    source: hosted
382
+    version: "9.0.4"
383
+  permission_handler_platform_interface:
384
+    dependency: transitive
385
+    description:
386
+      name: permission_handler_platform_interface
387
+      url: "https://pub.flutter-io.cn"
388
+    source: hosted
389
+    version: "3.7.0"
390
+  permission_handler_windows:
391
+    dependency: transitive
392
+    description:
393
+      name: permission_handler_windows
394
+      url: "https://pub.flutter-io.cn"
395
+    source: hosted
396
+    version: "0.1.0"
236 397
   platform:
237 398
     dependency: transitive
238 399
     description:
@@ -254,11 +415,39 @@ packages:
254 415
       url: "https://pub.flutter-io.cn"
255 416
     source: hosted
256 417
     version: "4.2.4"
418
+  pub_semver:
419
+    dependency: transitive
420
+    description:
421
+      name: pub_semver
422
+      url: "https://pub.flutter-io.cn"
423
+    source: hosted
424
+    version: "2.1.1"
425
+  pubspec_parse:
426
+    dependency: transitive
427
+    description:
428
+      name: pubspec_parse
429
+      url: "https://pub.flutter-io.cn"
430
+    source: hosted
431
+    version: "1.2.0"
257 432
   sky_engine:
258 433
     dependency: transitive
259 434
     description: flutter
260 435
     source: sdk
261 436
     version: "0.0.99"
437
+  source_gen:
438
+    dependency: transitive
439
+    description:
440
+      name: source_gen
441
+      url: "https://pub.flutter-io.cn"
442
+    source: hosted
443
+    version: "1.2.2"
444
+  source_helper:
445
+    dependency: transitive
446
+    description:
447
+      name: source_helper
448
+      url: "https://pub.flutter-io.cn"
449
+    source: hosted
450
+    version: "1.3.2"
262 451
   source_span:
263 452
     dependency: transitive
264 453
     description:
@@ -280,6 +469,13 @@ packages:
280 469
       url: "https://pub.flutter-io.cn"
281 470
     source: hosted
282 471
     version: "2.1.0"
472
+  stream_transform:
473
+    dependency: transitive
474
+    description:
475
+      name: stream_transform
476
+      url: "https://pub.flutter-io.cn"
477
+    source: hosted
478
+    version: "2.0.0"
283 479
   string_scanner:
284 480
     dependency: transitive
285 481
     description:
@@ -315,6 +511,13 @@ packages:
315 511
       url: "https://pub.flutter-io.cn"
316 512
     source: hosted
317 513
     version: "2.1.1"
514
+  watcher:
515
+    dependency: transitive
516
+    description:
517
+      name: watcher
518
+      url: "https://pub.flutter-io.cn"
519
+    source: hosted
520
+    version: "1.0.1"
318 521
   win32:
319 522
     dependency: transitive
320 523
     description:
@@ -329,6 +532,13 @@ packages:
329 532
       url: "https://pub.flutter-io.cn"
330 533
     source: hosted
331 534
     version: "0.2.0+1"
535
+  yaml:
536
+    dependency: transitive
537
+    description:
538
+      name: yaml
539
+      url: "https://pub.flutter-io.cn"
540
+    source: hosted
541
+    version: "3.1.0"
332 542
 sdks:
333 543
   dart: ">=2.16.1 <3.0.0"
334 544
   flutter: ">=2.8.1"

+ 7
- 0
pubspec.yaml Wyświetl plik

@@ -40,7 +40,11 @@ dependencies:
40 40
   get_storage: ^2.0.3
41 41
   fluttertoast: ^8.0.9
42 42
   carousel_slider: ^4.0.0
43
+  amap_flutter_map: ^3.0.0
44
+  amap_flutter_location: ^3.0.0
45
+  permission_handler: ^9.2.0
43 46
 
47
+  json_serializable: ^6.1.5
44 48
 
45 49
 dev_dependencies:
46 50
   flutter_test:
@@ -53,6 +57,9 @@ dev_dependencies:
53 57
   # rules and activating additional ones.
54 58
   flutter_lints: ^1.0.0
55 59
   fluttertoast: ^8.0.9
60
+
61
+  json_serializable: ^6.1.5
62
+  flutter_screenutil: ^5.3.1
56 63
 # For information on the generic Dart part of this file, see the
57 64
 # following pages: https://dart.dev/tools/pub/pubspec
58 65