Showing
10 changed files
with
62 additions
and
14 deletions
| @@ -28,7 +28,7 @@ apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" | @@ -28,7 +28,7 @@ apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" | ||
| 28 | apply plugin: 'com.huawei.agconnect' | 28 | apply plugin: 'com.huawei.agconnect' |
| 29 | 29 | ||
| 30 | android { | 30 | android { |
| 31 | - compileSdkVersion 31 | 31 | + compileSdkVersion 33 |
| 32 | 32 | ||
| 33 | 33 | ||
| 34 | sourceSets { | 34 | sourceSets { |
| @@ -109,7 +109,7 @@ | @@ -109,7 +109,7 @@ | ||
| 109 | <!-- End FlutterDownloader customization --> | 109 | <!-- End FlutterDownloader customization --> |
| 110 | <meta-data | 110 | <meta-data |
| 111 | android:name="com.amap.api.v2.apikey" | 111 | android:name="com.amap.api.v2.apikey" |
| 112 | - android:value="dbced781d0acd36184d5b4b54da7188d"/> | 112 | + android:value="13464ddadd6a5d825e79f90e10ba72d2"/> |
| 113 | 113 | ||
| 114 | </application> | 114 | </application> |
| 115 | </manifest> | 115 | </manifest> |
| @@ -44,5 +44,26 @@ end | @@ -44,5 +44,26 @@ end | ||
| 44 | post_install do |installer| | 44 | post_install do |installer| |
| 45 | installer.pods_project.targets.each do |target| | 45 | installer.pods_project.targets.each do |target| |
| 46 | flutter_additional_ios_build_settings(target) | 46 | flutter_additional_ios_build_settings(target) |
| 47 | + target.build_configurations.each do |config| | ||
| 48 | + config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= [ | ||
| 49 | + '$(inherited)', | ||
| 50 | + # dart: PermissionGroup.calendar | ||
| 51 | + 'PERMISSION_EVENTS=1', | ||
| 52 | + # dart: PermissionGroup.contacts | ||
| 53 | + 'PERMISSION_CONTACTS=1', | ||
| 54 | + | ||
| 55 | + # dart: PermissionGroup.camera | ||
| 56 | + 'PERMISSION_CAMERA=1', | ||
| 57 | + # dart: PermissionGroup.photos | ||
| 58 | + 'PERMISSION_PHOTOS=1', | ||
| 59 | + # dart: [PermissionGroup.location, PermissionGroup.locationAlways, PermissionGroup.locationWhenInUse] | ||
| 60 | + 'PERMISSION_LOCATION=1', | ||
| 61 | + # dart: PermissionGroup.notification | ||
| 62 | + 'PERMISSION_NOTIFICATIONS=1', | ||
| 63 | + # dart: PermissionGroup.mediaLibrary | ||
| 64 | + 'PERMISSION_MEDIA_LIBRARY=1', | ||
| 65 | + ] | ||
| 66 | + | ||
| 67 | + end | ||
| 47 | end | 68 | end |
| 48 | end | 69 | end |
| @@ -289,6 +289,6 @@ SPEC CHECKSUMS: | @@ -289,6 +289,6 @@ SPEC CHECKSUMS: | ||
| 289 | wakelock: d0fc7c864128eac40eba1617cb5264d9c940b46f | 289 | wakelock: d0fc7c864128eac40eba1617cb5264d9c940b46f |
| 290 | webview_flutter: 3603125dfd3bcbc9d8d418c3f80aeecf331c068b | 290 | webview_flutter: 3603125dfd3bcbc9d8d418c3f80aeecf331c068b |
| 291 | 291 | ||
| 292 | -PODFILE CHECKSUM: 5ec332e49a00fefb68bb9a3e9c76de96e5761cec | 292 | +PODFILE CHECKSUM: 1574ae4cc03174899add0135a43cdaf8019bd5fd |
| 293 | 293 | ||
| 294 | COCOAPODS: 1.11.3 | 294 | COCOAPODS: 1.11.3 |
| @@ -3,7 +3,7 @@ | @@ -3,7 +3,7 @@ | ||
| 3 | archiveVersion = 1; | 3 | archiveVersion = 1; |
| 4 | classes = { | 4 | classes = { |
| 5 | }; | 5 | }; |
| 6 | - objectVersion = 46; | 6 | + objectVersion = 50; |
| 7 | objects = { | 7 | objects = { |
| 8 | 8 | ||
| 9 | /* Begin PBXBuildFile section */ | 9 | /* Begin PBXBuildFile section */ |
| @@ -636,7 +636,7 @@ | @@ -636,7 +636,7 @@ | ||
| 636 | CURRENT_PROJECT_VERSION = 380; | 636 | CURRENT_PROJECT_VERSION = 380; |
| 637 | DEVELOPMENT_TEAM = 8J59HM8B82; | 637 | DEVELOPMENT_TEAM = 8J59HM8B82; |
| 638 | ENABLE_BITCODE = NO; | 638 | ENABLE_BITCODE = NO; |
| 639 | - FLUTTER_BUILD_MODE = release; | 639 | + FLUTTER_BUILD_MODE = debug; |
| 640 | FRAMEWORK_SEARCH_PATHS = ( | 640 | FRAMEWORK_SEARCH_PATHS = ( |
| 641 | "$(inherited)", | 641 | "$(inherited)", |
| 642 | "$(PROJECT_DIR)/Flutter", | 642 | "$(PROJECT_DIR)/Flutter", |
| @@ -122,9 +122,15 @@ Future<void> main() async { | @@ -122,9 +122,15 @@ Future<void> main() async { | ||
| 122 | )); | 122 | )); |
| 123 | }); | 123 | }); |
| 124 | // await App.initSp(); | 124 | // await App.initSp(); |
| 125 | + await AmapLocation.instance.updatePrivacyShow(true); | ||
| 126 | + await AmapLocation.instance.updatePrivacyAgree(true); | ||
| 125 | await AmapService.instance.init( | 127 | await AmapService.instance.init( |
| 126 | - iosKey: 'e373581528f8fd901c01dfbda236159e', | ||
| 127 | - androidKey: 'dbced781d0acd36184d5b4b54da7188d'); | 128 | + iosKey: '24fe3a700e69114a4328d4e46823dcda', |
| 129 | + androidKey: '13464ddadd6a5d825e79f90e10ba72d2'); | ||
| 130 | + | ||
| 131 | + await AmapLocation.instance.init( | ||
| 132 | + iosKey: '24fe3a700e69114a4328d4e46823dcda', | ||
| 133 | + ); | ||
| 128 | 134 | ||
| 129 | /// 如果你觉得引擎的日志太多, 可以关闭Fluttify引擎的日志 | 135 | /// 如果你觉得引擎的日志太多, 可以关闭Fluttify引擎的日志 |
| 130 | await enableFluttifyLog(false); // 关闭log | 136 | await enableFluttifyLog(false); // 关闭log |
| @@ -66,10 +66,14 @@ class _MapChoicePointPageState extends State<MapChoicePointPage> { | @@ -66,10 +66,14 @@ class _MapChoicePointPageState extends State<MapChoicePointPage> { | ||
| 66 | 66 | ||
| 67 | /// 获取定位权限 | 67 | /// 获取定位权限 |
| 68 | _requestLocationPermission() async { | 68 | _requestLocationPermission() async { |
| 69 | + await AmapLocation.instance.updatePrivacyShow(true); | ||
| 70 | + await AmapLocation.instance.updatePrivacyAgree(true); | ||
| 69 | bool canLocation = await requestPermission(Permission.location); | 71 | bool canLocation = await requestPermission(Permission.location); |
| 70 | // 单次定位 | 72 | // 单次定位 |
| 71 | if (canLocation) { | 73 | if (canLocation) { |
| 72 | Future.delayed(Duration(milliseconds: 200), () async { | 74 | Future.delayed(Duration(milliseconds: 200), () async { |
| 75 | + await AmapLocation.instance.updatePrivacyShow(true); | ||
| 76 | + await AmapLocation.instance.updatePrivacyAgree(true); | ||
| 73 | final location = await AmapLocation.instance.fetchLocation( | 77 | final location = await AmapLocation.instance.fetchLocation( |
| 74 | // needAddress: true, | 78 | // needAddress: true, |
| 75 | // mode: LocationAccuracy.High, | 79 | // mode: LocationAccuracy.High, |
| @@ -84,8 +88,11 @@ class _MapChoicePointPageState extends State<MapChoicePointPage> { | @@ -84,8 +88,11 @@ class _MapChoicePointPageState extends State<MapChoicePointPage> { | ||
| 84 | } else { | 88 | } else { |
| 85 | latitude = location.latLng.latitude; | 89 | latitude = location.latLng.latitude; |
| 86 | longitude = location.latLng.longitude; | 90 | longitude = location.latLng.longitude; |
| 87 | - _controller.setCenterCoordinate( | ||
| 88 | - LatLng(location.latLng.latitude, location.latLng.longitude)); | 91 | + if (_controller != null) { |
| 92 | + _controller.setCenterCoordinate( | ||
| 93 | + LatLng(location.latLng.latitude, location.latLng.longitude)); | ||
| 94 | + } | ||
| 95 | + | ||
| 89 | setState(() {}); | 96 | setState(() {}); |
| 90 | } | 97 | } |
| 91 | }); | 98 | }); |
| @@ -193,6 +200,8 @@ class _MapChoicePointPageState extends State<MapChoicePointPage> { | @@ -193,6 +200,8 @@ class _MapChoicePointPageState extends State<MapChoicePointPage> { | ||
| 193 | zoomLevel: 16, | 200 | zoomLevel: 16, |
| 194 | onMapCreated: (controller) async { | 201 | onMapCreated: (controller) async { |
| 195 | _controller = controller; | 202 | _controller = controller; |
| 203 | + _controller | ||
| 204 | + .setCenterCoordinate(LatLng(latitude, longitude)); | ||
| 196 | // if (await requestPermission(PermissionGroup.location)) { | 205 | // if (await requestPermission(PermissionGroup.location)) { |
| 197 | // await controller.showMyLocation(true); | 206 | // await controller.showMyLocation(true); |
| 198 | // await controller?.showLocateControl(true); | 207 | // await controller?.showLocateControl(true); |
| @@ -300,13 +309,18 @@ class _MapChoicePointPageState extends State<MapChoicePointPage> { | @@ -300,13 +309,18 @@ class _MapChoicePointPageState extends State<MapChoicePointPage> { | ||
| 300 | }); | 309 | }); |
| 301 | 310 | ||
| 302 | /// 逆地理编码(坐标转地址) | 311 | /// 逆地理编码(坐标转地址) |
| 312 | + /// | ||
| 313 | + /// | ||
| 314 | + await AmapLocation.instance.updatePrivacyShow(true); | ||
| 315 | + await AmapLocation.instance.updatePrivacyAgree(true); | ||
| 303 | ReGeocode reGeocodeList = await AmapSearch.instance.searchReGeocode( | 316 | ReGeocode reGeocodeList = await AmapSearch.instance.searchReGeocode( |
| 304 | latLng, | 317 | latLng, |
| 305 | ); | 318 | ); |
| 306 | 319 | ||
| 307 | // print(await reGeocodeList.toFutureString()); | 320 | // print(await reGeocodeList.toFutureString()); |
| 308 | - address = await reGeocodeList.formatAddress; | ||
| 309 | - | 321 | + address = reGeocodeList.formatAddress; |
| 322 | + await AmapLocation.instance.updatePrivacyShow(true); | ||
| 323 | + await AmapLocation.instance.updatePrivacyAgree(true); | ||
| 310 | final poiList = await AmapSearch.instance.searchKeyword( | 324 | final poiList = await AmapSearch.instance.searchKeyword( |
| 311 | address.toString(), | 325 | address.toString(), |
| 312 | city: "西安", | 326 | city: "西安", |
| @@ -334,6 +348,8 @@ class _MapChoicePointPageState extends State<MapChoicePointPage> { | @@ -334,6 +348,8 @@ class _MapChoicePointPageState extends State<MapChoicePointPage> { | ||
| 334 | } | 348 | } |
| 335 | 349 | ||
| 336 | void searchAroundAddress(String text) async { | 350 | void searchAroundAddress(String text) async { |
| 351 | + await AmapLocation.instance.updatePrivacyShow(true); | ||
| 352 | + await AmapLocation.instance.updatePrivacyAgree(true); | ||
| 337 | final poiList = await AmapSearch.instance.searchKeyword( | 353 | final poiList = await AmapSearch.instance.searchKeyword( |
| 338 | text, | 354 | text, |
| 339 | city: "西安", | 355 | city: "西安", |
| @@ -21,6 +21,11 @@ Future<bool> checkPermission(Permission permissionGroup) async { | @@ -21,6 +21,11 @@ Future<bool> checkPermission(Permission permissionGroup) async { | ||
| 21 | 21 | ||
| 22 | Future<bool> requestPermission(Permission permissionGroup) async { | 22 | Future<bool> requestPermission(Permission permissionGroup) async { |
| 23 | final permissions = await [permissionGroup].request(); | 23 | final permissions = await [permissionGroup].request(); |
| 24 | + if (await permissionGroup.request().isGranted) { | ||
| 25 | + print(true); | ||
| 26 | + // Either the permission was already granted before or the user just granted it. | ||
| 27 | + } | ||
| 28 | + | ||
| 24 | if (permissions[permissionGroup] == PermissionStatus.granted) { | 29 | if (permissions[permissionGroup] == PermissionStatus.granted) { |
| 25 | return true; | 30 | return true; |
| 26 | } else { | 31 | } else { |
| @@ -820,14 +820,14 @@ packages: | @@ -820,14 +820,14 @@ packages: | ||
| 820 | name: permission_handler | 820 | name: permission_handler |
| 821 | url: "https://pub.flutter-io.cn" | 821 | url: "https://pub.flutter-io.cn" |
| 822 | source: hosted | 822 | source: hosted |
| 823 | - version: "9.2.0" | 823 | + version: "10.0.0" |
| 824 | permission_handler_android: | 824 | permission_handler_android: |
| 825 | dependency: transitive | 825 | dependency: transitive |
| 826 | description: | 826 | description: |
| 827 | name: permission_handler_android | 827 | name: permission_handler_android |
| 828 | url: "https://pub.flutter-io.cn" | 828 | url: "https://pub.flutter-io.cn" |
| 829 | source: hosted | 829 | source: hosted |
| 830 | - version: "9.0.2+1" | 830 | + version: "10.0.0" |
| 831 | permission_handler_apple: | 831 | permission_handler_apple: |
| 832 | dependency: transitive | 832 | dependency: transitive |
| 833 | description: | 833 | description: |
| @@ -45,7 +45,7 @@ dependencies: | @@ -45,7 +45,7 @@ dependencies: | ||
| 45 | # fluttertoast: ^3.1.3 | 45 | # fluttertoast: ^3.1.3 |
| 46 | fluttertoast: ^8.0.9 | 46 | fluttertoast: ^8.0.9 |
| 47 | # 权限管理 | 47 | # 权限管理 |
| 48 | - permission_handler: ^9.2.0 | 48 | + permission_handler: ^10.0.0 |
| 49 | # permission_handler: ^5.0.1 | 49 | # permission_handler: ^5.0.1 |
| 50 | # permission_handler: ^5.0.1+1 ^6.1.1 4.4.0 | 50 | # permission_handler: ^5.0.1+1 ^6.1.1 4.4.0 |
| 51 | # 文件系统访问 | 51 | # 文件系统访问 |
-
Please register or login to post a comment