├── .gitignore
├── .metadata
├── README.md
├── android
├── app
│ ├── build.gradle
│ ├── libs
│ │ └── BaiduLBS_Android.jar
│ └── src
│ │ ├── debug
│ │ └── AndroidManifest.xml
│ │ ├── main
│ │ ├── AndroidManifest.xml
│ │ ├── java
│ │ │ └── com
│ │ │ │ └── example
│ │ │ │ └── mymapshow
│ │ │ │ ├── MainActivity.java
│ │ │ │ ├── MainApplication.java
│ │ │ │ ├── MapRegistrant.java
│ │ │ │ └── MapViewFactory.java
│ │ ├── jniLibs
│ │ │ ├── arm64-v8a
│ │ │ │ ├── libBaiduMapSDK_base_v5_3_0.so
│ │ │ │ └── libBaiduMapSDK_map_v5_3_0.so
│ │ │ ├── armeabi-v7a
│ │ │ │ ├── libBaiduMapSDK_base_v5_3_0.so
│ │ │ │ └── libBaiduMapSDK_map_v5_3_0.so
│ │ │ ├── armeabi
│ │ │ │ ├── libBaiduMapSDK_base_v5_3_0.so
│ │ │ │ └── libBaiduMapSDK_map_v5_3_0.so
│ │ │ ├── x86
│ │ │ │ ├── libBaiduMapSDK_base_v5_3_0.so
│ │ │ │ └── libBaiduMapSDK_map_v5_3_0.so
│ │ │ └── x86_64
│ │ │ │ ├── libBaiduMapSDK_base_v5_3_0.so
│ │ │ │ └── libBaiduMapSDK_map_v5_3_0.so
│ │ └── res
│ │ │ ├── drawable
│ │ │ └── launch_background.xml
│ │ │ ├── mipmap-hdpi
│ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-mdpi
│ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-xhdpi
│ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-xxhdpi
│ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-xxxhdpi
│ │ │ └── ic_launcher.png
│ │ │ └── values
│ │ │ └── styles.xml
│ │ └── profile
│ │ └── AndroidManifest.xml
├── build.gradle
├── gradle.properties
├── gradle
│ └── wrapper
│ │ └── gradle-wrapper.properties
└── settings.gradle
├── ios
├── Flutter
│ ├── AppFrameworkInfo.plist
│ ├── Debug.xcconfig
│ └── Release.xcconfig
├── Runner.xcodeproj
│ ├── project.pbxproj
│ ├── project.xcworkspace
│ │ └── contents.xcworkspacedata
│ └── xcshareddata
│ │ └── xcschemes
│ │ └── Runner.xcscheme
├── Runner.xcworkspace
│ └── contents.xcworkspacedata
└── Runner
│ ├── AppDelegate.h
│ ├── AppDelegate.m
│ ├── Assets.xcassets
│ ├── AppIcon.appiconset
│ │ ├── Contents.json
│ │ ├── Icon-App-1024x1024@1x.png
│ │ ├── Icon-App-20x20@1x.png
│ │ ├── Icon-App-20x20@2x.png
│ │ ├── Icon-App-20x20@3x.png
│ │ ├── Icon-App-29x29@1x.png
│ │ ├── Icon-App-29x29@2x.png
│ │ ├── Icon-App-29x29@3x.png
│ │ ├── Icon-App-40x40@1x.png
│ │ ├── Icon-App-40x40@2x.png
│ │ ├── Icon-App-40x40@3x.png
│ │ ├── Icon-App-60x60@2x.png
│ │ ├── Icon-App-60x60@3x.png
│ │ ├── Icon-App-76x76@1x.png
│ │ ├── Icon-App-76x76@2x.png
│ │ └── Icon-App-83.5x83.5@2x.png
│ └── LaunchImage.imageset
│ │ ├── Contents.json
│ │ ├── LaunchImage.png
│ │ ├── LaunchImage@2x.png
│ │ ├── LaunchImage@3x.png
│ │ └── README.md
│ ├── Base.lproj
│ ├── LaunchScreen.storyboard
│ └── Main.storyboard
│ ├── Info.plist
│ └── main.m
├── lib
└── main.dart
├── pubspec.lock
├── pubspec.yaml
└── test
└── widget_test.dart
/.gitignore:
--------------------------------------------------------------------------------
1 | # Miscellaneous
2 | *.class
3 | *.log
4 | *.pyc
5 | *.swp
6 | .DS_Store
7 | .atom/
8 | .buildlog/
9 | .history
10 | .svn/
11 |
12 | # IntelliJ related
13 | *.iml
14 | *.ipr
15 | *.iws
16 | .idea/
17 |
18 | # Visual Studio Code related
19 | .vscode/
20 |
21 | # Flutter/Dart/Pub related
22 | **/doc/api/
23 | .dart_tool/
24 | .flutter-plugins
25 | .packages
26 | .pub-cache/
27 | .pub/
28 | /build/
29 |
30 | # Android related
31 | **/android/**/gradle-wrapper.jar
32 | **/android/.gradle
33 | **/android/captures/
34 | **/android/gradlew
35 | **/android/gradlew.bat
36 | **/android/local.properties
37 | **/android/**/GeneratedPluginRegistrant.java
38 |
39 | # iOS/XCode related
40 | **/ios/**/*.mode1v3
41 | **/ios/**/*.mode2v3
42 | **/ios/**/*.moved-aside
43 | **/ios/**/*.pbxuser
44 | **/ios/**/*.perspectivev3
45 | **/ios/**/*sync/
46 | **/ios/**/.sconsign.dblite
47 | **/ios/**/.tags*
48 | **/ios/**/.vagrant/
49 | **/ios/**/DerivedData/
50 | **/ios/**/Icon?
51 | **/ios/**/Pods/
52 | **/ios/**/.symlinks/
53 | **/ios/**/profile
54 | **/ios/**/xcuserdata
55 | **/ios/.generated/
56 | **/ios/Flutter/App.framework
57 | **/ios/Flutter/Flutter.framework
58 | **/ios/Flutter/Generated.xcconfig
59 | **/ios/Flutter/app.flx
60 | **/ios/Flutter/app.zip
61 | **/ios/Flutter/flutter_assets/
62 | **/ios/ServiceDefinitions.json
63 | **/ios/Runner/GeneratedPluginRegistrant.*
64 |
65 | # Exceptions to above rules.
66 | !**/ios/**/default.mode1v3
67 | !**/ios/**/default.mode2v3
68 | !**/ios/**/default.pbxuser
69 | !**/ios/**/default.perspectivev3
70 | !/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages
71 |
--------------------------------------------------------------------------------
/.metadata:
--------------------------------------------------------------------------------
1 | # This file tracks properties of this Flutter project.
2 | # Used by Flutter tool to assess capabilities and perform upgrades etc.
3 | #
4 | # This file should be version controlled and should not be manually edited.
5 |
6 | version:
7 | revision: e5b1ed7a7f7b85c1877e09a9495681f719be5578
8 | channel: beta
9 |
10 | project_type: app
11 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Flutter_BaiduMap
2 |
3 | Flutter集成百度地图api
4 |
5 | 这个demo是Flutter项目集成百度地图api 显示地图
6 |
7 |
8 | 编写不易,给一个star吧
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/android/app/build.gradle:
--------------------------------------------------------------------------------
1 | def localProperties = new Properties()
2 | def localPropertiesFile = rootProject.file('local.properties')
3 | if (localPropertiesFile.exists()) {
4 | localPropertiesFile.withReader('UTF-8') { reader ->
5 | localProperties.load(reader)
6 | }
7 | }
8 |
9 | def flutterRoot = localProperties.getProperty('flutter.sdk')
10 | if (flutterRoot == null) {
11 | throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
12 | }
13 |
14 | def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
15 | if (flutterVersionCode == null) {
16 | flutterVersionCode = '1'
17 | }
18 |
19 | def flutterVersionName = localProperties.getProperty('flutter.versionName')
20 | if (flutterVersionName == null) {
21 | flutterVersionName = '1.0'
22 | }
23 |
24 | apply plugin: 'com.android.application'
25 | apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
26 |
27 | android {
28 | compileSdkVersion 28
29 |
30 | lintOptions {
31 | disable 'InvalidPackage'
32 | }
33 |
34 | defaultConfig {
35 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
36 | applicationId "com.example.mymapshow"
37 | minSdkVersion 16
38 | targetSdkVersion 28
39 | versionCode flutterVersionCode.toInteger()
40 | versionName flutterVersionName
41 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
42 | }
43 |
44 | buildTypes {
45 | release {
46 | // TODO: Add your own signing config for the release build.
47 | // Signing with the debug keys for now, so `flutter run --release` works.
48 | signingConfig signingConfigs.debug
49 | }
50 | }
51 | }
52 |
53 | flutter {
54 | source '../..'
55 | }
56 |
57 | dependencies {
58 | testImplementation 'junit:junit:4.12'
59 | androidTestImplementation 'com.android.support.test:runner:1.0.2'
60 | androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
61 | implementation files('libs/BaiduLBS_Android.jar')
62 | }
63 |
--------------------------------------------------------------------------------
/android/app/libs/BaiduLBS_Android.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/1144075799/Flutter_integration_map/b8b2508671db24c8da2a9312455aabfdea4ffb3e/android/app/libs/BaiduLBS_Android.jar
--------------------------------------------------------------------------------
/android/app/src/debug/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/android/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
10 |
11 |
12 | //获取设备网络状态,禁用后无法获取网络状态
13 |
14 | //网络权限,当禁用后,无法进行检索等相关业务
15 |
16 | //读取设备硬件信息,统计数据
17 |
18 | //读取系统信息,包含系统版本等信息,用作统计
19 |
20 | //获取设备的网络状态,鉴权所需网络代理
21 |
22 | //允许sd卡写权限,需写入地图数据,禁用后无法显示地图
23 |
25 | //获取统计数据
26 |
27 |
28 |
29 |
33 |
40 |
44 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
57 |
58 |
59 |
60 |
--------------------------------------------------------------------------------
/android/app/src/main/java/com/example/mymapshow/MainActivity.java:
--------------------------------------------------------------------------------
1 | package com.example.mymapshow;
2 |
3 | import android.os.Bundle;
4 |
5 | import com.baidu.mapapi.map.MapView;
6 |
7 | import io.flutter.app.FlutterActivity;
8 | import io.flutter.plugins.GeneratedPluginRegistrant;
9 |
10 | public class MainActivity extends FlutterActivity {
11 | @Override
12 | protected void onCreate(Bundle savedInstanceState) {
13 | super.onCreate(savedInstanceState);
14 | // GeneratedPluginRegistrant.registerWith(this);
15 | MapView mapView = new MapView(this);
16 | MapRegistrant.registerWith(this, mapView);
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/android/app/src/main/java/com/example/mymapshow/MainApplication.java:
--------------------------------------------------------------------------------
1 | package com.example.mymapshow;
2 |
3 | import com.baidu.mapapi.CoordType;
4 | import com.baidu.mapapi.SDKInitializer;
5 |
6 | import io.flutter.app.FlutterApplication;
7 |
8 | public class MainApplication extends FlutterApplication {
9 | @Override
10 | public void onCreate() {
11 | super.onCreate();
12 | // 初始化百度地图 SDK
13 | SDKInitializer.initialize(this);
14 | SDKInitializer.setCoordType(CoordType.BD09LL);
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/android/app/src/main/java/com/example/mymapshow/MapRegistrant.java:
--------------------------------------------------------------------------------
1 | package com.example.mymapshow;
2 |
3 | import com.baidu.mapapi.map.MapView;
4 |
5 | import io.flutter.plugin.common.PluginRegistry;
6 | import io.flutter.plugin.common.StandardMessageCodec;
7 |
8 | public final class MapRegistrant {
9 | public static void registerWith(PluginRegistry registry, MapView mapView) {
10 | final String key = MapRegistrant.class.getCanonicalName();
11 |
12 | if (registry.hasPlugin(key)) return;
13 |
14 | PluginRegistry.Registrar registrar = registry.registrarFor(key); //注册
15 | //返回百度地图api
16 | registrar.platformViewRegistry().registerViewFactory("MyMap", new MapViewFactory(new StandardMessageCodec(), mapView));
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/android/app/src/main/java/com/example/mymapshow/MapViewFactory.java:
--------------------------------------------------------------------------------
1 | package com.example.mymapshow;
2 |
3 | import android.content.Context;
4 | import android.view.View;
5 |
6 | import com.baidu.mapapi.map.MapView;
7 |
8 | import io.flutter.plugin.common.MessageCodec;
9 | import io.flutter.plugin.platform.PlatformView;
10 | import io.flutter.plugin.platform.PlatformViewFactory;
11 |
12 | public class MapViewFactory extends PlatformViewFactory {
13 | private MapView mapView;
14 |
15 | public MapViewFactory(MessageCodec