├── .gitignore
├── CHANGELOG.md
├── README.md
├── android
├── .gitignore
├── build.gradle
├── gradle.properties
├── settings.gradle
└── src
│ └── main
│ ├── AndroidManifest.xml
│ └── java
│ └── com
│ └── amap
│ └── maps
│ └── amapmapsflutter
│ ├── AMapController.java
│ ├── AMapFactory.java
│ ├── AmapMapsFlutterPlugin.java
│ └── Convert.java
├── example
├── .gitignore
├── .metadata
├── README.md
├── android
│ ├── app
│ │ ├── build.gradle
│ │ └── src
│ │ │ └── main
│ │ │ ├── AndroidManifest.xml
│ │ │ ├── java
│ │ │ └── com
│ │ │ │ └── amap
│ │ │ │ └── maps
│ │ │ │ └── amapmapsflutterexample
│ │ │ │ └── MainActivity.java
│ │ │ └── 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
│ ├── build.gradle
│ ├── gradle.properties
│ ├── gradle
│ │ └── wrapper
│ │ │ └── gradle-wrapper.properties
│ └── settings.gradle
├── ios
│ ├── Flutter
│ │ ├── AppFrameworkInfo.plist
│ │ ├── Debug.xcconfig
│ │ ├── Flutter.podspec
│ │ └── Release.xcconfig
│ ├── Podfile
│ ├── 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.yaml
└── test
│ └── widget_test.dart
├── ios
├── .gitignore
├── Assets
│ └── .gitkeep
├── Classes
│ ├── AMapController.h
│ ├── AMapController.m
│ ├── AMapFactory.h
│ ├── AMapFactory.m
│ ├── AmapMapsFlutterPlugin.h
│ ├── AmapMapsFlutterPlugin.m
│ ├── Constants.h
│ └── Constants.m
└── amap_maps_flutter.podspec
├── lib
├── amap_maps_flutter.dart
└── src
│ ├── AMap.dart
│ ├── AMapController.dart
│ ├── BitmapDescriptor.dart
│ ├── Callbacks.dart
│ ├── CameraPosition.dart
│ ├── LatLng.dart
│ └── Marker.dart
└── pubspec.yaml
/.gitignore:
--------------------------------------------------------------------------------
1 | # Built application files
2 | *.apk
3 | *.ap_
4 | .DS_Store
5 | .dart_tool/
6 |
7 | # Files for the ART/Dalvik VM
8 | *.dex
9 | .packages
10 | .pub/
11 | pubspec.lock
12 |
13 | # Java class files
14 | *.class
15 |
16 | # Generated files
17 | bin/
18 | gen/
19 | out/
20 |
21 | # Gradle files
22 | .gradle/
23 | build/
24 |
25 | # Local configuration file (sdk path, etc)
26 | local.properties
27 |
28 | # Proguard folder generated by Eclipse
29 | proguard/
30 |
31 | # Log Files
32 | *.log
33 |
34 | # Android Studio Navigation editor temp files
35 | .navigation/
36 |
37 | # Android Studio captures folder
38 | captures/
39 |
40 | # IntelliJ
41 | *.iml
42 | .idea/workspace.xml
43 | .idea/tasks.xml
44 | .idea/gradle.xml
45 | .idea/assetWizardSettings.xml
46 | .idea/dictionaries
47 | .idea/libraries
48 | .idea/caches
49 |
50 | # Keystore files
51 | # Uncomment the following line if you do not want to check your keystore files in.
52 | #*.jks
53 |
54 | # External native build folder generated in Android Studio 2.2 and later
55 | .externalNativeBuild
56 |
57 | # Google Services (e.g. APIs or Firebase)
58 | google-services.json
59 |
60 | # Freeline
61 | freeline.py
62 | freeline/
63 | freeline_project_description.json
64 |
65 | # fastlane
66 | fastlane/report.xml
67 | fastlane/Preview.html
68 | fastlane/screenshots
69 | fastlane/test_output
70 | fastlane/readme.md
71 |
72 | .idea/
73 |
74 | example/.flutter-plugins-dependencies
75 | example/ios/Flutter/.last_build_id
76 | example/ios/Flutter/flutter_export_environment.sh
77 |
78 |
--------------------------------------------------------------------------------
/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | ## 0.0.1
2 |
3 | * TODO: Describe initial release.
4 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # amap-maps-flutter
2 | Flutter 使用高德地图SDK示例
3 |
4 |
5 |
6 |
7 |
8 | iOS 使用注意事项
9 |
10 | ~~~
11 | Trying to embed a platform view but the PrerollContext does not support embedding
12 | ~~~
13 |
14 | Info.plist io.flutter.embedded_views_preview YES
--------------------------------------------------------------------------------
/android/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea/workspace.xml
5 | /.idea/libraries
6 | .DS_Store
7 | /build
8 | /captures
9 |
--------------------------------------------------------------------------------
/android/build.gradle:
--------------------------------------------------------------------------------
1 | group 'com.amap.maps.amapmapsflutter'
2 | version '1.0-SNAPSHOT'
3 |
4 | buildscript {
5 | repositories {
6 | google()
7 | jcenter()
8 | }
9 |
10 | dependencies {
11 | classpath 'com.android.tools.build:gradle:3.2.1'
12 | }
13 | }
14 |
15 | rootProject.allprojects {
16 | repositories {
17 | google()
18 | jcenter()
19 | }
20 | }
21 |
22 | apply plugin: 'com.android.library'
23 |
24 | android {
25 | compileSdkVersion 27
26 |
27 | defaultConfig {
28 | minSdkVersion 16
29 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
30 | }
31 | lintOptions {
32 | disable 'InvalidPackage'
33 | }
34 | }
35 |
36 |
37 | dependencies {
38 | compile 'com.amap.api:3dmap:latest.integration'
39 | }
40 |
--------------------------------------------------------------------------------
/android/gradle.properties:
--------------------------------------------------------------------------------
1 | org.gradle.jvmargs=-Xmx1536M
2 |
--------------------------------------------------------------------------------
/android/settings.gradle:
--------------------------------------------------------------------------------
1 | rootProject.name = 'amap_maps_flutter'
2 |
--------------------------------------------------------------------------------
/android/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
--------------------------------------------------------------------------------
/android/src/main/java/com/amap/maps/amapmapsflutter/AMapController.java:
--------------------------------------------------------------------------------
1 | package com.amap.maps.amapmapsflutter;
2 |
3 | import android.annotation.TargetApi;
4 | import android.app.Activity;
5 | import android.app.Application;
6 | import android.content.Context;
7 | import android.os.Build;
8 | import android.os.Bundle;
9 | import android.view.View;
10 |
11 | import com.amap.api.maps.AMap;
12 | import com.amap.api.maps.CameraUpdateFactory;
13 | import com.amap.api.maps.MapView;
14 | import com.amap.api.maps.model.CameraPosition;
15 | import com.amap.api.maps.model.Marker;
16 | import com.amap.api.maps.model.MarkerOptions;
17 |
18 | import java.util.HashMap;
19 | import java.util.List;
20 | import java.util.Map;
21 | import java.util.concurrent.atomic.AtomicInteger;
22 |
23 | import io.flutter.plugin.common.MethodCall;
24 | import io.flutter.plugin.common.MethodChannel;
25 | import io.flutter.plugin.common.PluginRegistry;
26 | import io.flutter.plugin.platform.PlatformView;
27 |
28 | /**
29 | * @author zxy
30 | * @data 2018/12/8
31 | */
32 |
33 | @TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
34 | public class AMapController implements Application.ActivityLifecycleCallbacks, PlatformView, MethodChannel.MethodCallHandler, AMap.OnMapLoadedListener, AMap.OnCameraChangeListener, AMap.OnMarkerClickListener {
35 |
36 | public static final String CHANNEL = "plugins.flutter.maps.amap.com/amap_maps_flutter";
37 | public static final String METHOD_NAME_CALLBACK_AMAP_ON_MAP_LOADED = "amap#onMapLoaded";
38 | public static final String METHOD_NAME_CALLBACK_AMAP_ON_CAMERA_CHANGE = "amap#onCameraChange";
39 | public static final String MEHTOD_NAME_AMAP_CHANGE_CAMERA = "amap#changeCamera";
40 | public static final String MEHTOD_NAME_AMAP_ADD_MARKER = "amap#addMarker";
41 | public static final String MEHTOD_NAME_AMAP_UPDATE_MARKER = "amap#updateMarker";
42 |
43 | private final Context context;
44 | private final AtomicInteger activityState;
45 | private final PluginRegistry.Registrar registrar;
46 | private final MethodChannel methodChannel;
47 |
48 | private MapView mapView;
49 | private AMap aMap;
50 |
51 | private boolean disposed = false;
52 |
53 | private final int registrarActivityHashCode;
54 |
55 |
56 | private final Map markers;
57 |
58 | AMapController(int id, Context context,
59 | AtomicInteger activityState,
60 | PluginRegistry.Registrar registrar) {
61 | this.context = context;
62 | this.activityState = activityState;
63 | this.registrar = registrar;
64 | this.registrarActivityHashCode = registrar.activity().hashCode();
65 |
66 | registrar.activity().getApplication().registerActivityLifecycleCallbacks(this);
67 |
68 | methodChannel =
69 | new MethodChannel(registrar.messenger(), CHANNEL + id);
70 | methodChannel.setMethodCallHandler(this);
71 |
72 |
73 | mapView = new MapView(context);
74 | mapView.onCreate(null);
75 |
76 | aMap = mapView.getMap();
77 |
78 | this.markers = new HashMap();
79 |
80 | initListener();
81 |
82 |
83 | }
84 |
85 |
86 |
87 | @Override
88 | public View getView() {
89 | return mapView;
90 | }
91 |
92 | @Override
93 | public void dispose() {
94 | if (disposed) {
95 | return;
96 | }
97 | disposed = true;
98 | mapView.onDestroy();
99 | registrar.activity().getApplication().unregisterActivityLifecycleCallbacks(this);
100 | }
101 |
102 | @Override
103 | public void onActivityCreated(Activity activity, Bundle savedInstanceState) {
104 | if (disposed || activity.hashCode() != registrarActivityHashCode) {
105 | return;
106 | }
107 | mapView.onCreate(savedInstanceState);
108 | }
109 |
110 | @Override
111 | public void onActivityStarted(Activity activity) {
112 | if (disposed || activity.hashCode() != registrarActivityHashCode) {
113 | return;
114 | }
115 | // mapView.onStart();
116 | }
117 |
118 | @Override
119 | public void onActivityResumed(Activity activity) {
120 | if (disposed || activity.hashCode() != registrarActivityHashCode) {
121 | return;
122 | }
123 | mapView.onResume();
124 | }
125 |
126 | @Override
127 | public void onActivityPaused(Activity activity) {
128 | if (disposed || activity.hashCode() != registrarActivityHashCode) {
129 | return;
130 | }
131 | mapView.onPause();
132 | }
133 |
134 | @Override
135 | public void onActivityStopped(Activity activity) {
136 | if (disposed || activity.hashCode() != registrarActivityHashCode) {
137 | return;
138 | }
139 | // mapView.onStop();
140 | }
141 |
142 | @Override
143 | public void onActivitySaveInstanceState(Activity activity, Bundle outState) {
144 | if (disposed || activity.hashCode() != registrarActivityHashCode) {
145 | return;
146 | }
147 | mapView.onSaveInstanceState(outState);
148 | }
149 |
150 | @Override
151 | public void onActivityDestroyed(Activity activity) {
152 | if (disposed || activity.hashCode() != registrarActivityHashCode) {
153 | return;
154 | }
155 | mapView.onDestroy();
156 | }
157 |
158 | /**
159 | * 方法会从flutter中调用
160 | * @param methodCall
161 | * @param result
162 | */
163 | @Override
164 | public void onMethodCall(MethodCall methodCall, MethodChannel.Result result) {
165 |
166 | Marker marker = null;
167 | MarkerOptions markerOptions = null;
168 |
169 | switch (methodCall.method) {
170 | case MEHTOD_NAME_AMAP_CHANGE_CAMERA:
171 | // setText(methodCall, result);
172 |
173 | List