Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
A
amap_flutter_map
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
openSourceLibrary
amap_flutter_map
Commits
33179313
提交
33179313
authored
11月 07, 2025
作者:
祁增奎
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'v1.0.1' into 1.0.0
# Conflicts: # ios/amap_flutter_map.podspec
上级
0edc4981
55bca669
隐藏空白字符变更
内嵌
并排
正在显示
28 个修改的文件
包含
124 行增加
和
35 行删除
+124
-35
.gitignore
.gitignore
+5
-0
build.gradle
android/build.gradle
+1
-1
gradle-wrapper.properties
android/gradle/wrapper/gradle-wrapper.properties
+1
-1
PolygonController.java
.../amap/flutter/map/overlays/polygon/PolygonController.java
+3
-0
PolygonOptionsSink.java
...amap/flutter/map/overlays/polygon/PolygonOptionsSink.java
+1
-0
PolygonsController.java
...amap/flutter/map/overlays/polygon/PolygonsController.java
+34
-2
Const.java
android/src/main/java/com/amap/flutter/map/utils/Const.java
+2
-1
AMapFlutterFactory.m
ios/Classes/AMapFlutterFactory.m
+1
-1
AMapViewController.h
ios/Classes/AMapViewController.h
+1
-1
AMapViewController.m
ios/Classes/AMapViewController.m
+3
-0
MAAnnotationView+Flutter.h
ios/Classes/Category/MAAnnotationView+Flutter.h
+1
-1
MAMapView+Flutter.h
ios/Classes/Category/MAMapView+Flutter.h
+1
-1
MAPointAnnotation+Flutter.h
ios/Classes/Category/MAPointAnnotation+Flutter.h
+1
-1
MAPolygon+Flutter.h
ios/Classes/Category/MAPolygon+Flutter.h
+1
-1
MAPolygonRenderer+Flutter.h
ios/Classes/Category/MAPolygonRenderer+Flutter.h
+1
-1
MAPolyline+Flutter.h
ios/Classes/Category/MAPolyline+Flutter.h
+1
-1
MAPolylineRenderer+Flutter.h
ios/Classes/Category/MAPolylineRenderer+Flutter.h
+1
-1
AMapMarker.h
ios/Classes/Model/AMapMarker.h
+1
-1
AMapPolygon.h
ios/Classes/Model/AMapPolygon.h
+1
-1
AMapPolyline.h
ios/Classes/Model/AMapPolyline.h
+1
-1
AMapMarkerController.h
ios/Classes/OverlayController/AMapMarkerController.h
+1
-1
AMapPolygonController.h
ios/Classes/OverlayController/AMapPolygonController.h
+1
-1
AMapPolygonController.m
ios/Classes/OverlayController/AMapPolygonController.m
+22
-0
AMapPolylineController.h
ios/Classes/OverlayController/AMapPolylineController.h
+1
-1
AMapConvertUtil.h
ios/Classes/Util/AMapConvertUtil.h
+1
-1
amap_flutter_map.podspec
ios/amap_flutter_map.podspec
+0
-1
amap_controller.dart
lib/src/amap_controller.dart
+10
-3
method_channel_amap_flutter_map.dart
lib/src/core/method_channel_amap_flutter_map.dart
+26
-10
没有找到文件。
.gitignore
浏览文件 @
33179313
...
...
@@ -10,3 +10,8 @@ build/
**/pubspec.lock
.settings/
.project
# FVM Version Cache
.fvm/
.fvmrc
/.vscode
android/build.gradle
浏览文件 @
33179313
...
...
@@ -34,6 +34,6 @@ android {
dependencies
{
compileOnly
'com.amap.api:3dmap:8.1.0'
implementation
'com.amap.api:search:8.1.0'
compileOnly
'com.amap.api:search:8.1.0'
}
android/gradle/wrapper/gradle-wrapper.properties
浏览文件 @
33179313
...
...
@@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath
=
wrapper/dists
zipStoreBase
=
GRADLE_USER_HOME
zipStorePath
=
wrapper/dists
distributionUrl
=
https
\:
//services.gradle.org/distributions/gradle-
5.6.2-all
.zip
distributionUrl
=
https
\:
//services.gradle.org/distributions/gradle-
7.5-bin
.zip
android/src/main/java/com/amap/flutter/map/overlays/polygon/PolygonController.java
浏览文件 @
33179313
...
...
@@ -59,4 +59,7 @@ class PolygonController implements PolygonOptionsSink{
public
void
setLineJoinType
(
AMapPara
.
LineJoinType
joinType
)
{
//不支持动态修改
}
public
boolean
contains
(
LatLng
latLng
)
{
return
polygon
.
contains
(
latLng
);
}
}
android/src/main/java/com/amap/flutter/map/overlays/polygon/PolygonOptionsSink.java
浏览文件 @
33179313
...
...
@@ -29,4 +29,5 @@ interface PolygonOptionsSink {
//边框连接类型
void
setLineJoinType
(
AMapPara
.
LineJoinType
joinType
);
}
android/src/main/java/com/amap/flutter/map/overlays/polygon/PolygonsController.java
浏览文件 @
33179313
...
...
@@ -5,6 +5,7 @@ import android.text.TextUtils;
import
androidx.annotation.NonNull
;
import
com.amap.api.maps.AMap
;
import
com.amap.api.maps.model.LatLng
;
import
com.amap.api.maps.model.Polygon
;
import
com.amap.api.maps.model.PolygonOptions
;
import
com.amap.flutter.map.MyMethodCallHandler
;
...
...
@@ -37,11 +38,15 @@ public class PolygonsController
@Override
public
void
doMethodCall
(
@NonNull
MethodCall
call
,
@NonNull
MethodChannel
.
Result
result
)
{
String
methodId
=
call
.
method
;
LogUtil
.
i
(
CLASS_NAME
,
"doMethodCall===>"
+
methodId
);
LogUtil
.
i
(
CLASS_NAME
,
"doMethodCall===>"
+
methodId
);
switch
(
methodId
)
{
case
Const
.
METHOD_POLYGON_UPDATE
:
invokePolylineOptions
(
call
,
result
);
break
;
case
Const
.
METHOD_POLYGON_CONTAINS
:
invokeContains
(
call
,
result
);
}
}
...
...
@@ -51,7 +56,6 @@ public class PolygonsController
}
/**
*
* @param methodCall
* @param result
*/
...
...
@@ -68,6 +72,34 @@ public class PolygonsController
result
.
success
(
null
);
}
public
void
invokeContains
(
MethodCall
methodCall
,
MethodChannel
.
Result
result
)
{
if
(
null
==
methodCall
)
{
return
;
}
String
dartId
=
methodCall
.
argument
(
"id"
);
LatLng
position
=
ConvertUtil
.
toLatLng
(
methodCall
.
argument
(
"point"
));
LogUtil
.
d
(
CLASS_NAME
,
"invokeContains===>"
+
position
+
" dartId===>"
+
dartId
);
if
(
null
!=
dartId
)
{
PolygonController
controller
=
controllerMapByDartId
.
get
(
dartId
);
LogUtil
.
d
(
CLASS_NAME
,
"invokeContains===>1"
);
if
(
null
!=
controller
)
{
LogUtil
.
d
(
CLASS_NAME
,
"invokeContains===>2"
);
boolean
bool
=
controller
.
contains
(
position
);
result
.
success
(
bool
);
LogUtil
.
d
(
CLASS_NAME
,
"invokeContains===>3"
);
return
;
}
}
result
.
success
(
null
);
}
public
void
addByList
(
List
<
Object
>
polygonsToAdd
)
{
if
(
polygonsToAdd
!=
null
)
{
for
(
Object
polygonToAdd
:
polygonsToAdd
)
{
...
...
android/src/main/java/com/amap/flutter/map/utils/Const.java
浏览文件 @
33179313
...
...
@@ -54,7 +54,8 @@ public class Const {
* polygons
*/
public
static
final
String
METHOD_POLYGON_UPDATE
=
"polygons#update"
;
public
static
final
String
[]
METHOD_ID_LIST_FOR_POLYGON
=
{
METHOD_POLYGON_UPDATE
};
public
static
final
String
METHOD_POLYGON_CONTAINS
=
"polygon#containsPoint"
;
public
static
final
String
[]
METHOD_ID_LIST_FOR_POLYGON
=
{
METHOD_POLYGON_UPDATE
,
METHOD_POLYGON_CONTAINS
};
/**
* polylines
...
...
ios/Classes/AMapFlutterFactory.m
浏览文件 @
33179313
...
...
@@ -6,7 +6,7 @@
//
#import "AMapFlutterFactory.h"
#i
mport <MAMap
Kit/MAMapKit.h>
#i
nclude <AMapNavi
Kit/MAMapKit.h>
#import "AMapViewController.h"
@implementation
AMapFlutterFactory
{
...
...
ios/Classes/AMapViewController.h
浏览文件 @
33179313
...
...
@@ -7,7 +7,7 @@
#import <Foundation/Foundation.h>
#import <Flutter/Flutter.h>
#i
mport <MAMap
Kit/MAMapKit.h>
#i
nclude <AMapNavi
Kit/MAMapKit.h>
NS_ASSUME_NONNULL_BEGIN
...
...
ios/Classes/AMapViewController.m
浏览文件 @
33179313
...
...
@@ -685,6 +685,9 @@
[
dict
setValue
:
address
.
towncode
forKey
:
@"townCode"
];
//回调
[
arguments
setValue
:
dict
forKey
:
@"searchRegeocodeResult"
];
// 增加经纬度
[
arguments
setValue
:
@
(
request
.
location
.
latitude
)
forKey
:
@"latitude"
];
[
arguments
setValue
:
@
(
request
.
location
.
longitude
)
forKey
:
@"longitude"
];
[
_channel
invokeMethod
:
@"camera#searchRegeocodeEvent"
arguments
:
arguments
];
}
else
{
NSMutableDictionary
*
arguments
=
[
NSMutableDictionary
dictionary
];
...
...
ios/Classes/Category/MAAnnotationView+Flutter.h
浏览文件 @
33179313
...
...
@@ -5,7 +5,7 @@
// Created by lly on 2020/11/5.
//
#i
mport <MAMap
Kit/MAMapKit.h>
#i
nclude <AMapNavi
Kit/MAMapKit.h>
NS_ASSUME_NONNULL_BEGIN
...
...
ios/Classes/Category/MAMapView+Flutter.h
浏览文件 @
33179313
...
...
@@ -5,7 +5,7 @@
// Created by lly on 2020/10/30.
//
#i
mport <MAMap
Kit/MAMapKit.h>
#i
nclude <AMapNavi
Kit/MAMapKit.h>
NS_ASSUME_NONNULL_BEGIN
...
...
ios/Classes/Category/MAPointAnnotation+Flutter.h
浏览文件 @
33179313
...
...
@@ -5,7 +5,7 @@
// Created by lly on 2020/11/9.
//
#i
mport <MAMap
Kit/MAMapKit.h>
#i
nclude <AMapNavi
Kit/MAMapKit.h>
NS_ASSUME_NONNULL_BEGIN
...
...
ios/Classes/Category/MAPolygon+Flutter.h
浏览文件 @
33179313
...
...
@@ -5,7 +5,7 @@
// Created by lly on 2020/11/12.
//
#i
mport <MAMap
Kit/MAMapKit.h>
#i
nclude <AMapNavi
Kit/MAMapKit.h>
NS_ASSUME_NONNULL_BEGIN
...
...
ios/Classes/Category/MAPolygonRenderer+Flutter.h
浏览文件 @
33179313
...
...
@@ -5,7 +5,7 @@
// Created by lly on 2020/11/12.
//
#i
mport <MAMap
Kit/MAMapKit.h>
#i
nclude <AMapNavi
Kit/MAMapKit.h>
NS_ASSUME_NONNULL_BEGIN
...
...
ios/Classes/Category/MAPolyline+Flutter.h
浏览文件 @
33179313
...
...
@@ -5,7 +5,7 @@
// Created by lly on 2020/11/9.
//
#i
mport <MAMap
Kit/MAMapKit.h>
#i
nclude <AMapNavi
Kit/MAMapKit.h>
NS_ASSUME_NONNULL_BEGIN
...
...
ios/Classes/Category/MAPolylineRenderer+Flutter.h
浏览文件 @
33179313
...
...
@@ -5,7 +5,7 @@
// Created by lly on 2020/11/7.
//
#i
mport <MAMap
Kit/MAMapKit.h>
#i
nclude <AMapNavi
Kit/MAMapKit.h>
NS_ASSUME_NONNULL_BEGIN
...
...
ios/Classes/Model/AMapMarker.h
浏览文件 @
33179313
...
...
@@ -7,7 +7,7 @@
#import <Foundation/Foundation.h>
#import <CoreLocation/CoreLocation.h>
#i
mport <MAMap
Kit/MAMapKit.h>
#i
nclude <AMapNavi
Kit/MAMapKit.h>
NS_ASSUME_NONNULL_BEGIN
...
...
ios/Classes/Model/AMapPolygon.h
浏览文件 @
33179313
...
...
@@ -6,7 +6,7 @@
//
#import <Foundation/Foundation.h>
#i
mport <MAMap
Kit/MAMapKit.h>
#i
nclude <AMapNavi
Kit/MAMapKit.h>
#import <CoreLocation/CoreLocation.h>
NS_ASSUME_NONNULL_BEGIN
...
...
ios/Classes/Model/AMapPolyline.h
浏览文件 @
33179313
...
...
@@ -6,7 +6,7 @@
//
#import <Foundation/Foundation.h>
#i
mport <MAMap
Kit/MAMapKit.h>
#i
nclude <AMapNavi
Kit/MAMapKit.h>
#import <CoreLocation/CoreLocation.h>
NS_ASSUME_NONNULL_BEGIN
...
...
ios/Classes/OverlayController/AMapMarkerController.h
浏览文件 @
33179313
...
...
@@ -7,7 +7,7 @@
#import <Foundation/Foundation.h>
#import <Flutter/Flutter.h>
#i
mport <MAMap
Kit/MAMapKit.h>
#i
nclude <AMapNavi
Kit/MAMapKit.h>
NS_ASSUME_NONNULL_BEGIN
...
...
ios/Classes/OverlayController/AMapPolygonController.h
浏览文件 @
33179313
...
...
@@ -7,7 +7,7 @@
#import <Foundation/Foundation.h>
#import <Flutter/Flutter.h>
#i
mport <MAMap
Kit/MAMapKit.h>
#i
nclude <AMapNavi
Kit/MAMapKit.h>
NS_ASSUME_NONNULL_BEGIN
...
...
ios/Classes/OverlayController/AMapPolygonController.m
浏览文件 @
33179313
...
...
@@ -12,6 +12,7 @@
#import "MAPolygonRenderer+Flutter.h"
#import "FlutterMethodChannel+MethodCallDispatch.h"
@interface
AMapPolygonController
()
@property
(
nonatomic
,
strong
)
NSMutableDictionary
<
NSString
*
,
AMapPolygon
*>
*
polygonDict
;
...
...
@@ -50,10 +51,31 @@
}
result
(
nil
);
}];
[
_methodChannel
addMethodName
:
@"polygon#containsPoint"
withHandler
:
^
(
FlutterMethodCall
*
_Nonnull
call
,
FlutterResult
_Nonnull
result
)
{
id
point
=
call
.
arguments
[
@"point"
];
if
(
!
[
point
isKindOfClass
:[
NSArray
class
]])
{
result
(
false
);
return
;
}
NSArray
*
locationArray
=
(
NSArray
*
)
point
;
if
(
locationArray
.
count
<
2
)
{
result
(
false
);
return
;
}
CLLocationDegrees
latitude
=
[
locationArray
[
0
]
doubleValue
];
CLLocationDegrees
longitude
=
[
locationArray
[
1
]
doubleValue
];
CLLocationCoordinate2D
coordinate
=
CLLocationCoordinate2DMake
(
latitude
,
longitude
);
MAMapPoint
mapPoint
=
MAMapPointForCoordinate
(
coordinate
);
NSString
*
_id
=
call
.
arguments
[
@"id"
];
AMapPolygon
*
polygon
=
[
weakSelf
polygonForId
:
_id
];
result
(
@
(
MAPolygonContainsPoint
(
mapPoint
,
polygon
.
polygon
.
points
,
polygon
.
polygon
.
pointCount
)));
}];
}
return
self
;
}
-
(
nullable
AMapPolygon
*
)
polygonForId
:(
NSString
*
)
polygonId
{
return
_polygonDict
[
polygonId
];
}
...
...
ios/Classes/OverlayController/AMapPolylineController.h
浏览文件 @
33179313
...
...
@@ -7,7 +7,7 @@
#import <Foundation/Foundation.h>
#import <Flutter/Flutter.h>
#i
mport <MAMap
Kit/MAMapKit.h>
#i
nclude <AMapNavi
Kit/MAMapKit.h>
NS_ASSUME_NONNULL_BEGIN
...
...
ios/Classes/Util/AMapConvertUtil.h
浏览文件 @
33179313
...
...
@@ -8,7 +8,7 @@
#import <Foundation/Foundation.h>
#import <CoreLocation/CoreLocation.h>
#import <Flutter/Flutter.h>
#i
mport <MAMap
Kit/MAMapKit.h>
#i
nclude <AMapNavi
Kit/MAMapKit.h>
NS_ASSUME_NONNULL_BEGIN
...
...
ios/amap_flutter_map.podspec
浏览文件 @
33179313
...
...
@@ -16,7 +16,6 @@ A new Flutter plugin.
s
.
source_files
=
'Classes/**/*'
s
.
public_header_files
=
'Classes/**/*.h'
s
.
dependency
'Flutter'
# s.dependency 'AMap3DMap'
s
.
dependency
'AMapSearch'
s
.
static_framework
=
true
s
.
platform
=
:ios
,
'8.0'
...
...
lib/src/amap_controller.dart
浏览文件 @
33179313
...
...
@@ -63,7 +63,7 @@ class AMapController {
}
if
(
_mapState
.
widget
.
onMapSearchRegeocode
!=
null
)
{
_methodChannel
.
mapSearchRegeocode
(
mapId:
mapId
).
listen
(
(
MapSearchRegeocodeEvent
e
)
=>
(
MapSearchRegeocodeEvent
e
)
=>
_mapState
.
widget
.
onMapSearchRegeocode
!(
e
.
value
));
}
if
(
_mapState
.
widget
.
onTap
!=
null
)
{
...
...
@@ -149,6 +149,11 @@ class AMapController {
return
_methodChannel
.
takeSnapshot
(
mapId:
mapId
);
}
/// 判断点是否在多边形内
Future
<
bool
?>
containsPoint
(
LatLng
point
,
id
)
{
return
_methodChannel
.
containsPoint
(
point
,
id
,
mapId:
mapId
);
}
//地图可视区域
Future
<
dynamic
>
getVisibleRegion
()
{
return
_methodChannel
.
getVisibleRegion
(
mapId:
mapId
);
...
...
@@ -158,8 +163,10 @@ class AMapController {
// searchType
// 0 根据输入信息 获取poi点
// 1 根据经纬度 获取周边poi点
Future
<
void
>
searchPoi
(
String
keyWord
,
int
searchType
,{
latitude
=
0.0
,
double
longitude
=
0.0
})
{
return
_methodChannel
.
searchPoi
(
keyWord
,
searchType
,
mapId:
mapId
,
latitude:
latitude
,
longitude:
longitude
);
Future
<
void
>
searchPoi
(
String
keyWord
,
int
searchType
,
{
latitude
=
0.0
,
double
longitude
=
0.0
})
{
return
_methodChannel
.
searchPoi
(
keyWord
,
searchType
,
mapId:
mapId
,
latitude:
latitude
,
longitude:
longitude
);
}
//搜索POI
...
...
lib/src/core/method_channel_amap_flutter_map.dart
浏览文件 @
33179313
...
...
@@ -81,6 +81,15 @@ class MethodChannelAMapFlutterMap implements AMapFlutterPlatform {
);
}
///判断 点坐标是否在polygon 多边形内
///@param point 点坐标
Future
<
bool
?>
containsPoint
(
LatLng
point
,
String
id
,
{
required
int
mapId
})
{
return
channel
(
mapId
).
invokeMethod
<
bool
>(
'polygon#containsPoint'
,
<
String
,
dynamic
>{
'point'
:
point
.
toJson
(),
'id'
:
id
},
);
}
@override
void
dispose
({
required
int
id
})
{
if
(
_channels
.
containsKey
(
id
))
{
...
...
@@ -210,18 +219,23 @@ class MethodChannelAMapFlutterMap implements AMapFlutterPlatform {
}
break
;
case
'camera#searchInputTipsEvent'
:
print
(
'----- camera#searchInputTipsEvent result:
${call.arguments['searchInputTipsResult']}
'
);
print
(
'----- camera#searchInputTipsEvent result:
${call.arguments['searchInputTipsResult']}
'
);
try
{
_mapEventStreamController
.
add
(
MapSearchInputTipsEvent
(
mapId
,
InputTipsResult
.
toInputTipsResult
(
call
.
arguments
[
'searchInputTipsResult'
])!));
_mapEventStreamController
.
add
(
MapSearchInputTipsEvent
(
mapId
,
InputTipsResult
.
toInputTipsResult
(
call
.
arguments
[
'searchInputTipsResult'
])!));
}
catch
(
e
)
{
print
(
"camera#searchInputTipsEvent error===>"
+
e
.
toString
());
}
break
;
case
'camera#searchRegeocodeEvent'
:
try
{
_mapEventStreamController
.
add
(
MapSearchRegeocodeEvent
(
mapId
,
RegeocodeResult
.
toRegeocodeResult
(
call
.
arguments
[
'searchRegeocodeResult'
])!));
_mapEventStreamController
.
add
(
MapSearchRegeocodeEvent
(
mapId
,
RegeocodeResult
.
toRegeocodeResult
(
call
.
arguments
[
'searchRegeocodeResult'
])!));
}
catch
(
e
)
{
print
(
"camera#searchRegeocodeEvent error===>"
+
e
.
toString
());
}
...
...
@@ -277,9 +291,9 @@ class MethodChannelAMapFlutterMap implements AMapFlutterPlatform {
}
/// 展示marker InfoWindow
Future
<
void
>
showInfoWindow
(
String
markerId
,
{
required
int
mapId
})
{
return
channel
(
mapId
)
.
invokeMethod
<
void
>(
'markers#showInfoWindow'
,
<
String
,
dynamic
>{
Future
<
void
>
showInfoWindow
(
String
markerId
,
{
required
int
mapId
})
{
return
channel
(
mapId
)
.
invokeMethod
<
void
>(
'markers#showInfoWindow'
,
<
String
,
dynamic
>{
'markerId'
:
markerId
,
});
}
...
...
@@ -310,7 +324,8 @@ class MethodChannelAMapFlutterMap implements AMapFlutterPlatform {
}
// 地图可视区域
Future
<
void
>
searchPoi
(
String
query
,
int
searchType
,
{
required
int
mapId
,
double
latitude
=
0.0
,
double
longitude
=
0.0
})
{
Future
<
void
>
searchPoi
(
String
query
,
int
searchType
,
{
required
int
mapId
,
double
latitude
=
0.0
,
double
longitude
=
0.0
})
{
return
channel
(
mapId
)
.
invokeMethod
<
dynamic
>(
'camera#searchPOI'
,
<
String
,
dynamic
>{
'query'
:
query
,
...
...
@@ -329,7 +344,8 @@ class MethodChannelAMapFlutterMap implements AMapFlutterPlatform {
}
// 地图搜索regeocode
Future
<
void
>
searchRegeocode
(
double
latitude
,
double
longitude
,
{
required
int
mapId
})
{
Future
<
void
>
searchRegeocode
(
double
latitude
,
double
longitude
,
{
required
int
mapId
})
{
return
channel
(
mapId
)
.
invokeMethod
<
dynamic
>(
'camera#searchRegeocode'
,
<
String
,
dynamic
>{
'latitude'
:
latitude
,
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论