1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
import 'package:amap_flutter_base/amap_flutter_base.dart';
import 'package:amap_flutter_map/amap_flutter_map.dart';
import 'package:amap_flutter_map/src/types/input_tips_result.dart';
import 'package:amap_flutter_map/src/types/regeocode_result.dart';
///地图事件处理
class MapEvent<T> {
/// 地图id
final int mapId;
///返回的内容,对应的[MethodCall]中的[[arguments]]
final T value;
/// 构造一个event
///
/// `mapId` 当前地图的id
/// `value` 需要传输的值,可以为`null`.
MapEvent(this.mapId, this.value);
}
///定位回调接口
class LocationChangedEvent extends MapEvent<AMapLocation> {
LocationChangedEvent(int mapId, AMapLocation value) : super(mapId, value);
}
///地图移动回调
class CameraPositionMoveEvent extends MapEvent<CameraPosition> {
CameraPositionMoveEvent(int mapId, CameraPosition value)
: super(mapId, value);
}
///地图移动结束回调
class CameraPositionMoveEndEvent extends MapEvent<CameraPosition> {
CameraPositionMoveEndEvent(int mapId, CameraPosition value)
: super(mapId, value);
}
///地图搜索POI回调
class MapSearchPOIEvent extends MapEvent<PoiResult> {
MapSearchPOIEvent(int mapId, PoiResult value)
: super(mapId, value);
}
///地图搜索inputTip回调
class MapSearchInputTipsEvent extends MapEvent<InputTipsResult> {
MapSearchInputTipsEvent(int mapId, InputTipsResult value)
: super(mapId, value);
}
///地图搜索regeocode回调
class MapSearchRegeocodeEvent extends MapEvent<RegeocodeResult> {
MapSearchRegeocodeEvent(int mapId, RegeocodeResult value)
: super(mapId, value);
}
///点击地图回调
class MapTapEvent extends MapEvent<LatLng> {
MapTapEvent(int mapId, LatLng value) : super(mapId, value);
}
///长按地图回调
class MapLongPressEvent extends MapEvent<LatLng> {
MapLongPressEvent(int mapId, LatLng value) : super(mapId, value);
}
/// 带位置回调的地图事件
class _PositionedMapEvent<T> extends MapEvent<T> {
/// 事件中带的位置信息
final LatLng position;
/// 构造一个带位置的地图事件,
///
/// `mapId` 当前地图的id
/// `value` 需要传输的值,可以为`null`.
_PositionedMapEvent(int mapId, this.position, T value) : super(mapId, value);
}
/// [Marker] 的点击事件
class MarkerTapEvent extends MapEvent<String> {
MarkerTapEvent(int mapId, String markerId) : super(mapId, markerId);
}
/// [Marker] 的拖拽结束事件,附带拖拽结束时的位置信息[LatLng].
class MarkerDragEndEvent extends _PositionedMapEvent<String> {
MarkerDragEndEvent(int mapId, LatLng position, String markerId)
: super(mapId, position, markerId);
}
/// [Polyline] 的点击事件
class PolylineTapEvent extends MapEvent<String> {
PolylineTapEvent(int mapId, String polylineId) : super(mapId, polylineId);
}
/// Poi点击事件
class MapPoiTouchEvent extends MapEvent<AMapPoi> {
MapPoiTouchEvent(int mapId, AMapPoi poi) : super(mapId, poi);
}