Showing
13 changed files
with
47 additions
and
251 deletions
... | @@ -3,7 +3,6 @@ | ... | @@ -3,7 +3,6 @@ |
3 | package="pub.yiyan.parlando.Parlando"> | 3 | package="pub.yiyan.parlando.Parlando"> |
4 | 4 | ||
5 | <application | 5 | <application |
6 | - android:name=".MyApplication" | ||
7 | android:icon="@mipmap/ic_launcher" | 6 | android:icon="@mipmap/ic_launcher" |
8 | android:label="Parlando" | 7 | android:label="Parlando" |
9 | android:requestLegacyExternalStorage="true" | 8 | android:requestLegacyExternalStorage="true" |
... | @@ -54,11 +53,8 @@ | ... | @@ -54,11 +53,8 @@ |
54 | android:name="com.facebook.sdk.ClientToken" | 53 | android:name="com.facebook.sdk.ClientToken" |
55 | android:value="@string/facebook_client_token" /> | 54 | android:value="@string/facebook_client_token" /> |
56 | <meta-data | 55 | <meta-data |
57 | - android:name="com.amap.api.v2.apikey" | 56 | + android:name="com.google.android.geo.API_KEY" |
58 | - android:value="038a8a2d7280a244b5c51d517023ede3" /> | 57 | + android:value="AIzaSyBwkClNvPHwcuieSu7NJEZVCu6JDM-tkFQ" /> |
59 | - <meta-data | ||
60 | - android:name="com.baidu.lbsapi.API_KEY" | ||
61 | - android:value="WSVybPeSZqwIGLYXjN44mighexoFX6Dn" /> | ||
62 | </application> | 58 | </application> |
63 | 59 | ||
64 | <queries> | 60 | <queries> |
... | @@ -76,6 +72,8 @@ | ... | @@ -76,6 +72,8 @@ |
76 | <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> | 72 | <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> |
77 | <uses-permission android:name="android.permission.CAMERA" /> | 73 | <uses-permission android:name="android.permission.CAMERA" /> |
78 | <uses-permission android:name="android.permission.RECORD_AUDIO" /> | 74 | <uses-permission android:name="android.permission.RECORD_AUDIO" /> |
75 | + <uses-permission android:name="android.permission.FOREGROUND_SERVICE" /> | ||
76 | + <uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" /> | ||
79 | <uses-permission | 77 | <uses-permission |
80 | android:name="android.permission.QUERY_ALL_PACKAGES" | 78 | android:name="android.permission.QUERY_ALL_PACKAGES" |
81 | tools:node="remove" /> | 79 | tools:node="remove" /> | ... | ... |
... | @@ -25,8 +25,6 @@ import 'util/device_utils.dart'; | ... | @@ -25,8 +25,6 @@ import 'util/device_utils.dart'; |
25 | import 'util/handle_error_utils.dart'; | 25 | import 'util/handle_error_utils.dart'; |
26 | import 'util/log_utils.dart'; | 26 | import 'util/log_utils.dart'; |
27 | import 'util/theme_utils.dart'; | 27 | import 'util/theme_utils.dart'; |
28 | -import 'package:flutter_baidu_mapapi_base/flutter_baidu_mapapi_base.dart' | ||
29 | - show BMFMapSDK, BMF_COORD_TYPE; | ||
30 | import 'package:permission_handler/permission_handler.dart'; | 28 | import 'package:permission_handler/permission_handler.dart'; |
31 | 29 | ||
32 | /// | 30 | /// |
... | @@ -88,9 +86,6 @@ Future<void> main() async { | ... | @@ -88,9 +86,6 @@ Future<void> main() async { |
88 | 86 | ||
89 | /// 动态申请定位权限 | 87 | /// 动态申请定位权限 |
90 | requestPermission(); | 88 | requestPermission(); |
91 | - /// 设置用户是否同意SDK隐私协议 | ||
92 | - /// since 3.1.0 开发者必须设置 | ||
93 | - BMFMapSDK.setAgreePrivacy(true); | ||
94 | } | 89 | } |
95 | 90 | ||
96 | class MyApp extends StatelessWidget { | 91 | class MyApp extends StatelessWidget { | ... | ... |
lib/map/amap_2d_controller.dart
deleted
100644 → 0
1 | -import 'dart:convert'; | ||
2 | -import 'package:Parlando/map/poi_search_model.dart'; | ||
3 | -import 'package:flutter/services.dart'; | ||
4 | - | ||
5 | -import 'amap_2d_view.dart'; | ||
6 | -import 'interface/amap_2d_controller.dart'; | ||
7 | - | ||
8 | -class AMap2DMobileController extends AMap2DController { | ||
9 | - AMap2DMobileController( | ||
10 | - int id, | ||
11 | - this._widget, | ||
12 | - ) : _channel = MethodChannel('plugins.weilu/flutter_2d_amap_$id') { | ||
13 | - _channel.setMethodCallHandler(_handleMethod); | ||
14 | - } | ||
15 | - | ||
16 | - final MethodChannel _channel; | ||
17 | - | ||
18 | - final AMap2DView _widget; | ||
19 | - | ||
20 | - Future<dynamic> _handleMethod(MethodCall call) async { | ||
21 | - final String method = call.method; | ||
22 | - switch (method) { | ||
23 | - case 'poiSearchResult': | ||
24 | - { | ||
25 | - if (_widget.onPoiSearched != null) { | ||
26 | - final Map args = call.arguments as Map<dynamic, dynamic>; | ||
27 | - final List<PoiSearch> list = []; | ||
28 | - for (var value | ||
29 | - in (json.decode(args['poiSearchResult'] as String) as List)) { | ||
30 | - list.add(PoiSearch.fromJsonMap(value as Map<String, dynamic>)); | ||
31 | - } | ||
32 | - _widget.onPoiSearched!(list); | ||
33 | - } | ||
34 | - return Future<dynamic>.value(''); | ||
35 | - } | ||
36 | - } | ||
37 | - return Future<dynamic>.value(''); | ||
38 | - } | ||
39 | - | ||
40 | - /// city:cityName(中文或中文全拼)、cityCode均可 | ||
41 | - @override | ||
42 | - Future<void> search(String keyWord, {String city = ''}) async { | ||
43 | - return _channel.invokeMethod('search', <String, dynamic>{ | ||
44 | - 'keyWord': keyWord, | ||
45 | - 'city': city, | ||
46 | - }); | ||
47 | - } | ||
48 | - | ||
49 | - @override | ||
50 | - Future<void> move(String lat, String lon) async { | ||
51 | - return _channel | ||
52 | - .invokeMethod('move', <String, dynamic>{'lat': lat, 'lon': lon}); | ||
53 | - } | ||
54 | - | ||
55 | - @override | ||
56 | - Future<void> location() async { | ||
57 | - return _channel.invokeMethod('location'); | ||
58 | - } | ||
59 | -} |
lib/map/amap_2d_view.dart
deleted
100644 → 0
1 | -import 'package:flutter/material.dart'; | ||
2 | -import 'amap_2d_view_state.dart'; | ||
3 | -import 'interface/amap_2d_controller.dart'; | ||
4 | -import 'poi_search_model.dart'; | ||
5 | - | ||
6 | -typedef AMap2DViewCreatedCallback = void Function(AMap2DController controller); | ||
7 | - | ||
8 | -class AMap2DView extends StatefulWidget { | ||
9 | - const AMap2DView({ | ||
10 | - Key? key, | ||
11 | - this.isPoiSearch = true, | ||
12 | - this.onPoiSearched, | ||
13 | - this.onAMap2DViewCreated, | ||
14 | - }) : super(key: key); | ||
15 | - | ||
16 | - final bool isPoiSearch; | ||
17 | - final AMap2DViewCreatedCallback? onAMap2DViewCreated; | ||
18 | - final Function(List<PoiSearch>)? onPoiSearched; | ||
19 | - | ||
20 | - @override | ||
21 | - AMap2DViewState createState() => AMap2DViewState(); | ||
22 | -} |
lib/map/amap_2d_view_state.dart
deleted
100644 → 0
1 | -import 'package:flutter/foundation.dart'; | ||
2 | -import 'package:flutter/widgets.dart'; | ||
3 | - | ||
4 | -import 'amap_2d_view.dart'; | ||
5 | - | ||
6 | -class AMap2DViewState extends State<AMap2DView> { | ||
7 | - @override | ||
8 | - Widget build(BuildContext context) { | ||
9 | - return Text( | ||
10 | - '$defaultTargetPlatform is not yet supported by the flutter_2d_amap plugin'); | ||
11 | - } | ||
12 | -} |
lib/map/flutter_2d_amap.dart
deleted
100644 → 0
1 | -import 'dart:async'; | ||
2 | -import 'dart:io'; | ||
3 | - | ||
4 | -import 'package:flutter/foundation.dart'; | ||
5 | -import 'package:flutter_baidu_mapapi_base/flutter_baidu_mapapi_base.dart' | ||
6 | - show BMFMapSDK, BMF_COORD_TYPE; | ||
7 | - | ||
8 | -class Flutter2dAMap { | ||
9 | - static String _webKey = ''; | ||
10 | - | ||
11 | - static String get webKey => _webKey; | ||
12 | - | ||
13 | - static Future<bool?> setApiKey( | ||
14 | - {String iOSKey = '', String webKey = ''}) async { | ||
15 | - if (kIsWeb) { | ||
16 | - _webKey = webKey; | ||
17 | - } else { | ||
18 | - // 百度地图sdk初始化鉴权 | ||
19 | - if (Platform.isIOS) { | ||
20 | - BMFMapSDK.setApiKeyAndCoordType( | ||
21 | - 'rMsgMvYERM9zHDDdaipk34oBx7yoaGQh', BMF_COORD_TYPE.BD09LL); | ||
22 | - } else if (Platform.isAndroid) { | ||
23 | - // Android 目前不支持接口设置Apikey, | ||
24 | - // 请在主工程的Manifest文件里设置,详细配置方法请参考官网(https://lbsyun.baidu.com/)demo | ||
25 | - BMFMapSDK.setCoordType(BMF_COORD_TYPE.BD09LL); | ||
26 | - } | ||
27 | - } | ||
28 | - return Future.value(true); | ||
29 | - } | ||
30 | - | ||
31 | - /// 更新同意隐私状态,需要在初始化地图之前完成 | ||
32 | - static Future<void> updatePrivacy(bool isAgree) async { | ||
33 | - if (kIsWeb) { | ||
34 | - } else { | ||
35 | - if (Platform.isIOS || Platform.isAndroid) { | ||
36 | - BMFMapSDK.setAgreePrivacy(true); | ||
37 | - } | ||
38 | - } | ||
39 | - } | ||
40 | -} |
lib/map/poi_search_model.dart
deleted
100644 → 0
1 | -class PoiSearch { | ||
2 | - PoiSearch({ | ||
3 | - this.cityCode, | ||
4 | - this.cityName, | ||
5 | - this.provinceName, | ||
6 | - this.title, | ||
7 | - this.adName, | ||
8 | - this.provinceCode, | ||
9 | - this.latitude, | ||
10 | - this.longitude, | ||
11 | - }); | ||
12 | - | ||
13 | - PoiSearch.fromJsonMap(Map<String, dynamic> map) | ||
14 | - : cityCode = map['cityCode'] as String?, | ||
15 | - cityName = map['cityName'] as String?, | ||
16 | - provinceName = map['provinceName'] as String?, | ||
17 | - title = map['title'] as String?, | ||
18 | - adName = map['adName'] as String?, | ||
19 | - provinceCode = map['provinceCode'] as String?, | ||
20 | - latitude = map['latitude'] as String?, | ||
21 | - longitude = map['longitude'] as String?; | ||
22 | - | ||
23 | - String? cityCode; | ||
24 | - String? cityName; | ||
25 | - String? provinceName; | ||
26 | - String? title; | ||
27 | - String? adName; | ||
28 | - String? provinceCode; | ||
29 | - String? latitude; | ||
30 | - String? longitude; | ||
31 | - | ||
32 | - Map<String, dynamic> toJson() { | ||
33 | - final Map<String, dynamic> data = <String, dynamic>{}; | ||
34 | - data['cityCode'] = cityCode; | ||
35 | - data['cityName'] = cityName; | ||
36 | - data['provinceName'] = provinceName; | ||
37 | - data['title'] = title; | ||
38 | - data['adName'] = adName; | ||
39 | - data['provinceCode'] = provinceCode; | ||
40 | - data['latitude'] = latitude; | ||
41 | - data['longitude'] = longitude; | ||
42 | - return data; | ||
43 | - } | ||
44 | -} |
... | @@ -13,7 +13,6 @@ import 'package:Parlando/routers/routers.dart'; | ... | @@ -13,7 +13,6 @@ import 'package:Parlando/routers/routers.dart'; |
13 | import 'package:Parlando/widgets/my_app_bar.dart'; | 13 | import 'package:Parlando/widgets/my_app_bar.dart'; |
14 | 14 | ||
15 | import 'package:Parlando/extension/int_extension.dart'; | 15 | import 'package:Parlando/extension/int_extension.dart'; |
16 | -import 'package:flutter_baidu_mapapi_search/flutter_baidu_mapapi_search.dart'; | ||
17 | import 'package:getwidget/getwidget.dart'; | 16 | import 'package:getwidget/getwidget.dart'; |
18 | import 'package:path_provider/path_provider.dart'; | 17 | import 'package:path_provider/path_provider.dart'; |
19 | 18 | ||
... | @@ -110,12 +109,12 @@ class PoemPublishState extends State<PoemPublish> { | ... | @@ -110,12 +109,12 @@ class PoemPublishState extends State<PoemPublish> { |
110 | NavigatorUtils.pushResult( | 109 | NavigatorUtils.pushResult( |
111 | context, PoemRouter.addressSelectPage, (result) { | 110 | context, PoemRouter.addressSelectPage, (result) { |
112 | setState(() { | 111 | setState(() { |
113 | - final BMFSuggestionInfo model = | 112 | + // final BMFSuggestionInfo model = |
114 | - result as BMFSuggestionInfo; | 113 | + // result as BMFSuggestionInfo; |
115 | - _longitude = model.location!.longitude.toString(); | 114 | + // _longitude = model.location!.longitude.toString(); |
116 | - _latitude = model.location!.latitude.toString(); | 115 | + // _latitude = model.location!.latitude.toString(); |
117 | - _address = | 116 | + // _address = |
118 | - '${model.city!} ${model.district!} ${model.address!}'; | 117 | + // '${model.city!} ${model.district!} ${model.address!}'; |
119 | }); | 118 | }); |
120 | }); | 119 | }); |
121 | }, | 120 | }, | ... | ... |
This diff is collapsed. Click to expand it.
... | @@ -391,34 +391,6 @@ packages: | ... | @@ -391,34 +391,6 @@ packages: |
391 | description: flutter | 391 | description: flutter |
392 | source: sdk | 392 | source: sdk |
393 | version: "0.0.0" | 393 | version: "0.0.0" |
394 | - flutter_baidu_mapapi_base: | ||
395 | - dependency: transitive | ||
396 | - description: | ||
397 | - name: flutter_baidu_mapapi_base | ||
398 | - url: "https://pub.flutter-io.cn" | ||
399 | - source: hosted | ||
400 | - version: "3.2.0" | ||
401 | - flutter_baidu_mapapi_map: | ||
402 | - dependency: "direct main" | ||
403 | - description: | ||
404 | - name: flutter_baidu_mapapi_map | ||
405 | - url: "https://pub.flutter-io.cn" | ||
406 | - source: hosted | ||
407 | - version: "3.2.1" | ||
408 | - flutter_baidu_mapapi_search: | ||
409 | - dependency: "direct main" | ||
410 | - description: | ||
411 | - name: flutter_baidu_mapapi_search | ||
412 | - url: "https://pub.flutter-io.cn" | ||
413 | - source: hosted | ||
414 | - version: "3.2.0" | ||
415 | - flutter_baidu_mapapi_utils: | ||
416 | - dependency: "direct main" | ||
417 | - description: | ||
418 | - name: flutter_baidu_mapapi_utils | ||
419 | - url: "https://pub.flutter-io.cn" | ||
420 | - source: hosted | ||
421 | - version: "3.2.0" | ||
422 | flutter_blurhash: | 394 | flutter_blurhash: |
423 | dependency: transitive | 395 | dependency: transitive |
424 | description: | 396 | description: |
... | @@ -426,13 +398,6 @@ packages: | ... | @@ -426,13 +398,6 @@ packages: |
426 | url: "https://pub.flutter-io.cn" | 398 | url: "https://pub.flutter-io.cn" |
427 | source: hosted | 399 | source: hosted |
428 | version: "0.7.0" | 400 | version: "0.7.0" |
429 | - flutter_bmflocation: | ||
430 | - dependency: "direct main" | ||
431 | - description: | ||
432 | - name: flutter_bmflocation | ||
433 | - url: "https://pub.flutter-io.cn" | ||
434 | - source: hosted | ||
435 | - version: "3.2.0" | ||
436 | flutter_cache_manager: | 401 | flutter_cache_manager: |
437 | dependency: transitive | 402 | dependency: transitive |
438 | description: | 403 | description: |
... | @@ -612,6 +577,20 @@ packages: | ... | @@ -612,6 +577,20 @@ packages: |
612 | url: "https://pub.flutter-io.cn" | 577 | url: "https://pub.flutter-io.cn" |
613 | source: hosted | 578 | source: hosted |
614 | version: "3.0.1" | 579 | version: "3.0.1" |
580 | + google_maps_flutter: | ||
581 | + dependency: "direct main" | ||
582 | + description: | ||
583 | + name: google_maps_flutter | ||
584 | + url: "https://pub.flutter-io.cn" | ||
585 | + source: hosted | ||
586 | + version: "2.1.10" | ||
587 | + google_maps_flutter_platform_interface: | ||
588 | + dependency: transitive | ||
589 | + description: | ||
590 | + name: google_maps_flutter_platform_interface | ||
591 | + url: "https://pub.flutter-io.cn" | ||
592 | + source: hosted | ||
593 | + version: "2.2.2" | ||
615 | graphs: | 594 | graphs: |
616 | dependency: transitive | 595 | dependency: transitive |
617 | description: | 596 | description: |
... | @@ -785,6 +764,27 @@ packages: | ... | @@ -785,6 +764,27 @@ packages: |
785 | url: "https://pub.flutter-io.cn" | 764 | url: "https://pub.flutter-io.cn" |
786 | source: hosted | 765 | source: hosted |
787 | version: "2.0.0" | 766 | version: "2.0.0" |
767 | + location: | ||
768 | + dependency: "direct main" | ||
769 | + description: | ||
770 | + name: location | ||
771 | + url: "https://pub.flutter-io.cn" | ||
772 | + source: hosted | ||
773 | + version: "4.4.0" | ||
774 | + location_platform_interface: | ||
775 | + dependency: transitive | ||
776 | + description: | ||
777 | + name: location_platform_interface | ||
778 | + url: "https://pub.flutter-io.cn" | ||
779 | + source: hosted | ||
780 | + version: "2.3.0" | ||
781 | + location_web: | ||
782 | + dependency: transitive | ||
783 | + description: | ||
784 | + name: location_web | ||
785 | + url: "https://pub.flutter-io.cn" | ||
786 | + source: hosted | ||
787 | + version: "3.1.1" | ||
788 | logger: | 788 | logger: |
789 | dependency: transitive | 789 | dependency: transitive |
790 | description: | 790 | description: | ... | ... |
... | @@ -124,10 +124,8 @@ dependencies: | ... | @@ -124,10 +124,8 @@ dependencies: |
124 | 124 | ||
125 | google_fonts: ^3.0.1 | 125 | google_fonts: ^3.0.1 |
126 | wakelock: ^0.6.1+2 | 126 | wakelock: ^0.6.1+2 |
127 | - flutter_baidu_mapapi_map: ^3.2.1 | 127 | + location: ^4.4.0 |
128 | - flutter_baidu_mapapi_utils: ^3.2.0 | 128 | + google_maps_flutter: ^2.1.10 |
129 | - flutter_baidu_mapapi_search: ^3.2.0 | ||
130 | - flutter_bmflocation: ^3.2.0 | ||
131 | 129 | ||
132 | dependency_overrides: | 130 | dependency_overrides: |
133 | decimal: 1.5.0 | 131 | decimal: 1.5.0 | ... | ... |
-
Please register or login to post a comment