release: 1.0.11
This commit is contained in:
@ -1,8 +1,14 @@
|
|||||||
|
## 1.0.11
|
||||||
|
2024-08-25
|
||||||
|
* 升级amap iOS sdk版本 10.0.900 | 2024-08-23
|
||||||
|
* code lint
|
||||||
|
|
||||||
## 1.0.10
|
## 1.0.10
|
||||||
2024-08-25
|
2024-08-25
|
||||||
* 移除extension实现机制
|
* 移除extension实现机制
|
||||||
* 添加 getMapContentApprovalNumber / getSatelliteImageApprovalNumber(参见example#ShowMapPage)
|
* 添加 getMapContentApprovalNumber / getSatelliteImageApprovalNumber(参见example#ShowMapPage)
|
||||||
* 添加 InfoWindowAdapter(参见example#CustomInfoWindowDemoPage),结合 infoWindowEnable 和 BaseInfoWindowAdapter 自行实现具体逻辑
|
* 添加 InfoWindowAdapter(参见example#CustomInfoWindowDemoPage),结合 infoWindowEnable 和 BaseInfoWindowAdapter 自行实现具体逻辑
|
||||||
|
* permission_handler 11.3.0 -> 11.3.1
|
||||||
|
|
||||||
## 1.0.9
|
## 1.0.9
|
||||||
2024-08-24
|
2024-08-24
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
| | Android | iOS |
|
| | Android | iOS |
|
||||||
| ----------- | -------------------------- | -------- |
|
| ----------- | -------------------------- | -------- |
|
||||||
| **AMapSDK** | 10.0.800_loc6.4.5_sea9.7.2 | 10.0.800 |
|
| **AMapSDK** | 10.0.800_loc6.4.5_sea9.7.2 | 10.0.900 |
|
||||||
| **Support** | SDK 16+ | 12.0+ |
|
| **Support** | SDK 16+ | 12.0+ |
|
||||||
|
|
||||||
本插件基于 amap_flutter_map 3.0.0 进行二开的原因:
|
本插件基于 amap_flutter_map 3.0.0 进行二开的原因:
|
||||||
|
1
analysis_options.yaml
Normal file
1
analysis_options.yaml
Normal file
@ -0,0 +1 @@
|
|||||||
|
include: package:lints/recommended.yaml
|
@ -1,5 +1,5 @@
|
|||||||
PODS:
|
PODS:
|
||||||
- AMap3DMap (10.0.800):
|
- AMap3DMap (10.0.900):
|
||||||
- AMapFoundation (>= 1.8.0)
|
- AMapFoundation (>= 1.8.0)
|
||||||
- amap_map (1.0.8):
|
- amap_map (1.0.8):
|
||||||
- AMap3DMap
|
- AMap3DMap
|
||||||
@ -28,7 +28,7 @@ EXTERNAL SOURCES:
|
|||||||
:path: ".symlinks/plugins/permission_handler_apple/ios"
|
:path: ".symlinks/plugins/permission_handler_apple/ios"
|
||||||
|
|
||||||
SPEC CHECKSUMS:
|
SPEC CHECKSUMS:
|
||||||
AMap3DMap: 6761e0381f517978312e4f795ce77b2b9f6781a6
|
AMap3DMap: 220e48934bc6553a15251c8c86f581a802787506
|
||||||
amap_map: 5be213f350872f6ea406be964031572ab9a0d6e1
|
amap_map: 5be213f350872f6ea406be964031572ab9a0d6e1
|
||||||
AMapFoundation: 9885c48fc3a78fdfb84a0299a2293e56ea3c9fec
|
AMapFoundation: 9885c48fc3a78fdfb84a0299a2293e56ea3c9fec
|
||||||
Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7
|
Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7
|
||||||
|
@ -24,13 +24,13 @@ class _AMapRadioGroupState<T> extends State<AMapRadioGroup<T>> {
|
|||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
_groupValue = (widget.groupValue ?? null) as T?;
|
_groupValue = (widget.groupValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
List<Widget> radioList = <Widget>[];
|
List<Widget> radioList = <Widget>[];
|
||||||
_groupValue = (widget.groupValue ?? null) as T?;
|
_groupValue = (widget.groupValue);
|
||||||
Widget _myRadio(String label, dynamic radioValue) {
|
Widget _myRadio(String label, dynamic radioValue) {
|
||||||
return Row(
|
return Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
part of amap_map;
|
part of '../amap_map.dart';
|
||||||
|
|
||||||
class AMapInitializer {
|
class AMapInitializer {
|
||||||
static AMapApiKey? _apiKey;
|
static AMapApiKey? _apiKey;
|
||||||
|
@ -10,9 +10,9 @@
|
|||||||
// Unless required by applicable law or agreed to in writing, software
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
|
||||||
part of amap_map;
|
part of '../amap_map.dart';
|
||||||
|
|
||||||
typedef void MapCreatedCallback(AMapController controller);
|
typedef MapCreatedCallback = void Function(AMapController controller);
|
||||||
|
|
||||||
///用于展示高德地图的Widget
|
///用于展示高德地图的Widget
|
||||||
class AMapWidget extends StatefulWidget {
|
class AMapWidget extends StatefulWidget {
|
||||||
@ -124,7 +124,7 @@ class AMapWidget extends StatefulWidget {
|
|||||||
///
|
///
|
||||||
/// [AssertionError] will be thrown if [initialCameraPosition] is null;
|
/// [AssertionError] will be thrown if [initialCameraPosition] is null;
|
||||||
const AMapWidget(
|
const AMapWidget(
|
||||||
{Key? key,
|
{super.key,
|
||||||
this.initialCameraPosition =
|
this.initialCameraPosition =
|
||||||
const CameraPosition(target: LatLng(39.909187, 116.397451), zoom: 10),
|
const CameraPosition(target: LatLng(39.909187, 116.397451), zoom: 10),
|
||||||
this.mapType = MapType.normal,
|
this.mapType = MapType.normal,
|
||||||
@ -157,8 +157,7 @@ class AMapWidget extends StatefulWidget {
|
|||||||
this.infoWindowAdapter,
|
this.infoWindowAdapter,
|
||||||
this.logoPosition,
|
this.logoPosition,
|
||||||
this.logoBottomMargin,
|
this.logoBottomMargin,
|
||||||
this.logoLeftMargin})
|
this.logoLeftMargin});
|
||||||
: super(key: key);
|
|
||||||
|
|
||||||
///
|
///
|
||||||
@override
|
@override
|
||||||
@ -169,7 +168,7 @@ class _MapState extends State<AMapWidget> {
|
|||||||
Map<String, Marker> _markers = <String, Marker>{};
|
Map<String, Marker> _markers = <String, Marker>{};
|
||||||
Map<String, Polyline> _polylines = <String, Polyline>{};
|
Map<String, Polyline> _polylines = <String, Polyline>{};
|
||||||
Map<String, Polygon> _polygons = <String, Polygon>{};
|
Map<String, Polygon> _polygons = <String, Polygon>{};
|
||||||
Map<String, Widget?> _infoWindows = <String, Widget?>{};
|
final Map<String, Widget?> _infoWindows = <String, Widget?>{};
|
||||||
|
|
||||||
final Completer<AMapController> _controller = Completer<AMapController>();
|
final Completer<AMapController> _controller = Completer<AMapController>();
|
||||||
late _AMapOptions _mapOptions;
|
late _AMapOptions _mapOptions;
|
||||||
@ -244,38 +243,38 @@ class _MapState extends State<AMapWidget> {
|
|||||||
);
|
);
|
||||||
_controller.complete(controller);
|
_controller.complete(controller);
|
||||||
|
|
||||||
final MapCreatedCallback? _onMapCreated = widget.onMapCreated;
|
final MapCreatedCallback? onMapCreated = widget.onMapCreated;
|
||||||
if (_onMapCreated != null) {
|
if (onMapCreated != null) {
|
||||||
_onMapCreated(controller);
|
onMapCreated(controller);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void onMarkerTap(String markerId) {
|
void onMarkerTap(String markerId) {
|
||||||
final Marker? _marker = _markers[markerId];
|
final Marker? marker = _markers[markerId];
|
||||||
if (_marker != null) {
|
if (marker != null) {
|
||||||
final ArgumentCallback<String>? _onTap = _marker.onTap;
|
final ArgumentCallback<String>? onTap = marker.onTap;
|
||||||
if (_onTap != null) {
|
if (onTap != null) {
|
||||||
_onTap(markerId);
|
onTap(markerId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void onMarkerDragEnd(String markerId, LatLng position) {
|
void onMarkerDragEnd(String markerId, LatLng position) {
|
||||||
final Marker? _marker = _markers[markerId];
|
final Marker? marker = _markers[markerId];
|
||||||
if (_marker != null) {
|
if (marker != null) {
|
||||||
final MarkerDragEndCallback? _onDragEnd = _marker.onDragEnd;
|
final MarkerDragEndCallback? onDragEnd = marker.onDragEnd;
|
||||||
if (_onDragEnd != null) {
|
if (onDragEnd != null) {
|
||||||
_onDragEnd(markerId, position);
|
onDragEnd(markerId, position);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void onPolylineTap(String polylineId) {
|
void onPolylineTap(String polylineId) {
|
||||||
final Polyline? _polyline = _polylines[polylineId];
|
final Polyline? polyline = _polylines[polylineId];
|
||||||
if (_polyline != null) {
|
if (polyline != null) {
|
||||||
final ArgumentCallback<String>? _onTap = _polyline.onTap;
|
final ArgumentCallback<String>? onTap = polyline.onTap;
|
||||||
if (_onTap != null) {
|
if (onTap != null) {
|
||||||
_onTap(polylineId);
|
onTap(polylineId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,29 +18,27 @@ class MapEvent<T> {
|
|||||||
|
|
||||||
///定位回调接口
|
///定位回调接口
|
||||||
class LocationChangedEvent extends MapEvent<AMapLocation> {
|
class LocationChangedEvent extends MapEvent<AMapLocation> {
|
||||||
LocationChangedEvent(int mapId, AMapLocation value) : super(mapId, value);
|
LocationChangedEvent(super.mapId, super.value);
|
||||||
}
|
}
|
||||||
|
|
||||||
///地图移动回调
|
///地图移动回调
|
||||||
class CameraPositionMoveEvent extends MapEvent<CameraPosition> {
|
class CameraPositionMoveEvent extends MapEvent<CameraPosition> {
|
||||||
CameraPositionMoveEvent(int mapId, CameraPosition value)
|
CameraPositionMoveEvent(super.mapId, super.value);
|
||||||
: super(mapId, value);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
///地图移动结束回调
|
///地图移动结束回调
|
||||||
class CameraPositionMoveEndEvent extends MapEvent<CameraPosition> {
|
class CameraPositionMoveEndEvent extends MapEvent<CameraPosition> {
|
||||||
CameraPositionMoveEndEvent(int mapId, CameraPosition value)
|
CameraPositionMoveEndEvent(super.mapId, super.value);
|
||||||
: super(mapId, value);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
///点击地图回调
|
///点击地图回调
|
||||||
class MapTapEvent extends MapEvent<LatLng> {
|
class MapTapEvent extends MapEvent<LatLng> {
|
||||||
MapTapEvent(int mapId, LatLng value) : super(mapId, value);
|
MapTapEvent(super.mapId, super.value);
|
||||||
}
|
}
|
||||||
|
|
||||||
///长按地图回调
|
///长按地图回调
|
||||||
class MapLongPressEvent extends MapEvent<LatLng> {
|
class MapLongPressEvent extends MapEvent<LatLng> {
|
||||||
MapLongPressEvent(int mapId, LatLng value) : super(mapId, value);
|
MapLongPressEvent(super.mapId, super.value);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// 带位置回调的地图事件
|
/// 带位置回调的地图事件
|
||||||
@ -57,21 +55,20 @@ class _PositionedMapEvent<T> extends MapEvent<T> {
|
|||||||
|
|
||||||
/// [Marker] 的点击事件
|
/// [Marker] 的点击事件
|
||||||
class MarkerTapEvent extends MapEvent<String> {
|
class MarkerTapEvent extends MapEvent<String> {
|
||||||
MarkerTapEvent(int mapId, String markerId) : super(mapId, markerId);
|
MarkerTapEvent(super.mapId, super.markerId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// [Marker] 的拖拽结束事件,附带拖拽结束时的位置信息[LatLng].
|
/// [Marker] 的拖拽结束事件,附带拖拽结束时的位置信息[LatLng].
|
||||||
class MarkerDragEndEvent extends _PositionedMapEvent<String> {
|
class MarkerDragEndEvent extends _PositionedMapEvent<String> {
|
||||||
MarkerDragEndEvent(int mapId, LatLng position, String markerId)
|
MarkerDragEndEvent(super.mapId, super.position, super.markerId);
|
||||||
: super(mapId, position, markerId);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// [Polyline] 的点击事件
|
/// [Polyline] 的点击事件
|
||||||
class PolylineTapEvent extends MapEvent<String> {
|
class PolylineTapEvent extends MapEvent<String> {
|
||||||
PolylineTapEvent(int mapId, String polylineId) : super(mapId, polylineId);
|
PolylineTapEvent(super.mapId, super.polylineId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Poi点击事件
|
/// Poi点击事件
|
||||||
class MapPoiTouchEvent extends MapEvent<AMapPoi> {
|
class MapPoiTouchEvent extends MapEvent<AMapPoi> {
|
||||||
MapPoiTouchEvent(int mapId, AMapPoi poi) : super(mapId, poi);
|
MapPoiTouchEvent(super.mapId, super.poi);
|
||||||
}
|
}
|
||||||
|
@ -182,7 +182,7 @@ class MethodChannelAMapFlutterMap implements AMapFlutterPlatform {
|
|||||||
_mapEventStreamController.add(LocationChangedEvent(
|
_mapEventStreamController.add(LocationChangedEvent(
|
||||||
mapId, AMapLocation.fromMap(call.arguments['location'])!));
|
mapId, AMapLocation.fromMap(call.arguments['location'])!));
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
print("location#changed error=======>" + e.toString());
|
print("location#changed error=======>$e");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -191,7 +191,7 @@ class MethodChannelAMapFlutterMap implements AMapFlutterPlatform {
|
|||||||
_mapEventStreamController.add(CameraPositionMoveEvent(
|
_mapEventStreamController.add(CameraPositionMoveEvent(
|
||||||
mapId, CameraPosition.fromMap(call.arguments['position'])!));
|
mapId, CameraPosition.fromMap(call.arguments['position'])!));
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
print("camera#onMove error===>" + e.toString());
|
print("camera#onMove error===>$e");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'camera#onMoveEnd':
|
case 'camera#onMoveEnd':
|
||||||
@ -199,7 +199,7 @@ class MethodChannelAMapFlutterMap implements AMapFlutterPlatform {
|
|||||||
_mapEventStreamController.add(CameraPositionMoveEndEvent(
|
_mapEventStreamController.add(CameraPositionMoveEndEvent(
|
||||||
mapId, CameraPosition.fromMap(call.arguments['position'])!));
|
mapId, CameraPosition.fromMap(call.arguments['position'])!));
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
print("camera#onMoveEnd error===>" + e.toString());
|
print("camera#onMoveEnd error===>$e");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'map#onTap':
|
case 'map#onTap':
|
||||||
@ -232,7 +232,7 @@ class MethodChannelAMapFlutterMap implements AMapFlutterPlatform {
|
|||||||
_mapEventStreamController.add(MapPoiTouchEvent(
|
_mapEventStreamController.add(MapPoiTouchEvent(
|
||||||
mapId, AMapPoi.fromJson(call.arguments['poi'])!));
|
mapId, AMapPoi.fromJson(call.arguments['poi'])!));
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
print('map#onPoiTouched error===>' + e.toString());
|
print('map#onPoiTouched error===>$e');
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,7 @@ class BaseOverlay {
|
|||||||
String get id => _id;
|
String get id => _id;
|
||||||
|
|
||||||
BaseOverlay() {
|
BaseOverlay() {
|
||||||
this._id = this.hashCode.toString();
|
_id = hashCode.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
void setIdForCopy(String copyId) => _id = copyId;
|
void setIdForCopy(String copyId) => _id = copyId;
|
||||||
|
@ -38,7 +38,7 @@ class CameraPosition {
|
|||||||
///
|
///
|
||||||
/// 主要在插件内部使用
|
/// 主要在插件内部使用
|
||||||
static CameraPosition? fromMap(dynamic json) {
|
static CameraPosition? fromMap(dynamic json) {
|
||||||
if (json == null || !(json is Map<dynamic, dynamic>)) {
|
if (json == null || json is! Map<dynamic, dynamic>) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
final LatLng? target = LatLng.fromJson(json['target']);
|
final LatLng? target = LatLng.fromJson(json['target']);
|
||||||
|
@ -8,7 +8,7 @@ import 'package:x_amap_base/x_amap_base.dart';
|
|||||||
import 'bitmap.dart';
|
import 'bitmap.dart';
|
||||||
|
|
||||||
/// Marker拖动回调
|
/// Marker拖动回调
|
||||||
typedef void MarkerDragEndCallback(String id, LatLng endPosition);
|
typedef MarkerDragEndCallback = void Function(String id, LatLng endPosition);
|
||||||
|
|
||||||
///Marker的气泡
|
///Marker的气泡
|
||||||
///
|
///
|
||||||
@ -91,11 +91,11 @@ class Marker extends BaseOverlay {
|
|||||||
this.zIndex = 0.0,
|
this.zIndex = 0.0,
|
||||||
this.onTap,
|
this.onTap,
|
||||||
this.onDragEnd,
|
this.onDragEnd,
|
||||||
}) : this.alpha =
|
}) : alpha =
|
||||||
// ignore: unnecessary_null_comparison
|
// ignore: unnecessary_null_comparison
|
||||||
(alpha != null ? (alpha < 0 ? 0 : (alpha > 1 ? 1 : alpha)) : alpha),
|
(alpha != null ? (alpha < 0 ? 0 : (alpha > 1 ? 1 : alpha)) : alpha),
|
||||||
// ignore: unnecessary_null_comparison
|
// ignore: unnecessary_null_comparison
|
||||||
this.anchor = (anchor == null
|
anchor = (anchor == null
|
||||||
? Offset(0.5, 1.0)
|
? Offset(0.5, 1.0)
|
||||||
: ((anchor.dx < 0 ||
|
: ((anchor.dx < 0 ||
|
||||||
anchor.dx > 1 ||
|
anchor.dx > 1 ||
|
||||||
@ -182,6 +182,7 @@ class Marker extends BaseOverlay {
|
|||||||
return copyMark;
|
return copyMark;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
Marker clone() => copyWith();
|
Marker clone() => copyWith();
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
@ -6,16 +6,6 @@ import 'types.dart';
|
|||||||
class MarkerUpdates {
|
class MarkerUpdates {
|
||||||
/// 根据之前的marker列表[previous]和当前的marker列表[current]创建[MakerUpdates].
|
/// 根据之前的marker列表[previous]和当前的marker列表[current]创建[MakerUpdates].
|
||||||
MarkerUpdates.from(Set<Marker> previous, Set<Marker> current) {
|
MarkerUpdates.from(Set<Marker> previous, Set<Marker> current) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
if (previous == null) {
|
|
||||||
previous = Set<Marker>.identity();
|
|
||||||
}
|
|
||||||
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
if (current == null) {
|
|
||||||
current = Set<Marker>.identity();
|
|
||||||
}
|
|
||||||
|
|
||||||
final Map<String, Marker> previousMarkers = keyByMarkerId(previous);
|
final Map<String, Marker> previousMarkers = keyByMarkerId(previous);
|
||||||
final Map<String, Marker> currentMarkers = keyByMarkerId(current);
|
final Map<String, Marker> currentMarkers = keyByMarkerId(current);
|
||||||
|
|
||||||
|
@ -60,6 +60,7 @@ class Polygon extends BaseOverlay {
|
|||||||
return copyPolyline;
|
return copyPolyline;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
Polygon clone() => copyWith();
|
Polygon clone() => copyWith();
|
||||||
|
|
||||||
/// 转换成可以序列化的map
|
/// 转换成可以序列化的map
|
||||||
|
@ -9,16 +9,6 @@ import 'types.dart';
|
|||||||
class PolygonUpdates {
|
class PolygonUpdates {
|
||||||
/// 通过Polygon的前后更新集合构造一个PolygonUpdates
|
/// 通过Polygon的前后更新集合构造一个PolygonUpdates
|
||||||
PolygonUpdates.from(Set<Polygon> previous, Set<Polygon> current) {
|
PolygonUpdates.from(Set<Polygon> previous, Set<Polygon> current) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
if (previous == null) {
|
|
||||||
previous = Set<Polygon>.identity();
|
|
||||||
}
|
|
||||||
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
if (current == null) {
|
|
||||||
current = Set<Polygon>.identity();
|
|
||||||
}
|
|
||||||
|
|
||||||
final Map<String, Polygon> previousPolygons = keyByPolygonId(previous);
|
final Map<String, Polygon> previousPolygons = keyByPolygonId(previous);
|
||||||
final Map<String, Polygon> currentPolygons = keyByPolygonId(current);
|
final Map<String, Polygon> currentPolygons = keyByPolygonId(current);
|
||||||
|
|
||||||
@ -29,10 +19,10 @@ class PolygonUpdates {
|
|||||||
return currentPolygons[id]!;
|
return currentPolygons[id]!;
|
||||||
}
|
}
|
||||||
|
|
||||||
final Set<String> _polygonIdsToRemove =
|
final Set<String> tempPolygonIdsToRemove =
|
||||||
prevPolygonIds.difference(currentPolygonIds);
|
prevPolygonIds.difference(currentPolygonIds);
|
||||||
|
|
||||||
final Set<Polygon> _polygonsToAdd = currentPolygonIds
|
final Set<Polygon> tempPolygonsToAdd = currentPolygonIds
|
||||||
.difference(prevPolygonIds)
|
.difference(prevPolygonIds)
|
||||||
.map(idToCurrentPolygon)
|
.map(idToCurrentPolygon)
|
||||||
.toSet();
|
.toSet();
|
||||||
@ -42,15 +32,15 @@ class PolygonUpdates {
|
|||||||
return current != previous;
|
return current != previous;
|
||||||
}
|
}
|
||||||
|
|
||||||
final Set<Polygon> _polygonsToChange = currentPolygonIds
|
final Set<Polygon> tempPolygonsToChange = currentPolygonIds
|
||||||
.intersection(prevPolygonIds)
|
.intersection(prevPolygonIds)
|
||||||
.map(idToCurrentPolygon)
|
.map(idToCurrentPolygon)
|
||||||
.where(hasChanged)
|
.where(hasChanged)
|
||||||
.toSet();
|
.toSet();
|
||||||
|
|
||||||
polygonsToAdd = _polygonsToAdd;
|
polygonsToAdd = tempPolygonsToAdd;
|
||||||
polygonIdsToRemove = _polygonIdsToRemove;
|
polygonIdsToRemove = tempPolygonIdsToRemove;
|
||||||
polygonsToChange = _polygonsToChange;
|
polygonsToChange = tempPolygonsToChange;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// 想要添加的polygon对象集合.
|
/// 想要添加的polygon对象集合.
|
||||||
|
@ -62,9 +62,9 @@ class Polyline extends BaseOverlay {
|
|||||||
this.customTexture,
|
this.customTexture,
|
||||||
this.onTap,
|
this.onTap,
|
||||||
this.color = const Color(0xCCC4E0F0),
|
this.color = const Color(0xCCC4E0F0),
|
||||||
}) : assert(points.length > 0),
|
}) : assert(points.isNotEmpty),
|
||||||
this.width = (width <= 0 ? 10 : width),
|
width = (width <= 0 ? 10 : width),
|
||||||
this.alpha = (alpha < 0 ? 0 : (alpha > 1 ? 1 : alpha)),
|
alpha = (alpha < 0 ? 0 : (alpha > 1 ? 1 : alpha)),
|
||||||
super();
|
super();
|
||||||
|
|
||||||
/// 覆盖物的坐标点数组,points不能为空
|
/// 覆盖物的坐标点数组,points不能为空
|
||||||
@ -131,6 +131,7 @@ class Polyline extends BaseOverlay {
|
|||||||
return copyPolyline;
|
return copyPolyline;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
Polyline clone() => copyWith();
|
Polyline clone() => copyWith();
|
||||||
|
|
||||||
/// 将对象转换为可序列化的map.
|
/// 将对象转换为可序列化的map.
|
||||||
@ -176,9 +177,6 @@ class Polyline extends BaseOverlay {
|
|||||||
color == typedOther.color;
|
color == typedOther.color;
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
|
||||||
int get hashCode => super.hashCode;
|
|
||||||
|
|
||||||
dynamic _pointsToJson() {
|
dynamic _pointsToJson() {
|
||||||
final List<dynamic> result = <dynamic>[];
|
final List<dynamic> result = <dynamic>[];
|
||||||
for (final LatLng point in points) {
|
for (final LatLng point in points) {
|
||||||
|
@ -10,16 +10,6 @@ import 'types.dart';
|
|||||||
class PolylineUpdates {
|
class PolylineUpdates {
|
||||||
/// 通过polyline的前后更新集合构造一个polylineUpdates
|
/// 通过polyline的前后更新集合构造一个polylineUpdates
|
||||||
PolylineUpdates.from(Set<Polyline> previous, Set<Polyline> current) {
|
PolylineUpdates.from(Set<Polyline> previous, Set<Polyline> current) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
if (previous == null) {
|
|
||||||
previous = Set<Polyline>.identity();
|
|
||||||
}
|
|
||||||
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
if (current == null) {
|
|
||||||
current = Set<Polyline>.identity();
|
|
||||||
}
|
|
||||||
|
|
||||||
final Map<String, Polyline> previousPolylines = keyByPolylineId(previous);
|
final Map<String, Polyline> previousPolylines = keyByPolylineId(previous);
|
||||||
final Map<String, Polyline> currentPolylines = keyByPolylineId(current);
|
final Map<String, Polyline> currentPolylines = keyByPolylineId(current);
|
||||||
|
|
||||||
@ -30,10 +20,10 @@ class PolylineUpdates {
|
|||||||
return currentPolylines[id]!;
|
return currentPolylines[id]!;
|
||||||
}
|
}
|
||||||
|
|
||||||
final Set<String> _polylineIdsToRemove =
|
final Set<String> tempPolylineIdsToRemove =
|
||||||
prevPolylineIds.difference(currentPolylineIds);
|
prevPolylineIds.difference(currentPolylineIds);
|
||||||
|
|
||||||
final Set<Polyline> _polylinesToAdd = currentPolylineIds
|
final Set<Polyline> tempPolylinesToAdd = currentPolylineIds
|
||||||
.difference(prevPolylineIds)
|
.difference(prevPolylineIds)
|
||||||
.map(idToCurrentPolyline)
|
.map(idToCurrentPolyline)
|
||||||
.toSet();
|
.toSet();
|
||||||
@ -43,15 +33,15 @@ class PolylineUpdates {
|
|||||||
return current != previous;
|
return current != previous;
|
||||||
}
|
}
|
||||||
|
|
||||||
final Set<Polyline> _polylinesToChange = currentPolylineIds
|
final Set<Polyline> tempPolylinesToChange = currentPolylineIds
|
||||||
.intersection(prevPolylineIds)
|
.intersection(prevPolylineIds)
|
||||||
.map(idToCurrentPolyline)
|
.map(idToCurrentPolyline)
|
||||||
.where(hasChanged)
|
.where(hasChanged)
|
||||||
.toSet();
|
.toSet();
|
||||||
|
|
||||||
polylinesToAdd = _polylinesToAdd;
|
polylinesToAdd = tempPolylinesToAdd;
|
||||||
polylineIdsToRemove = _polylineIdsToRemove;
|
polylineIdsToRemove = tempPolylineIdsToRemove;
|
||||||
polylinesToChange = _polylinesToChange;
|
polylinesToChange = tempPolylinesToChange;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// 用于添加polyline的集合
|
/// 用于添加polyline的集合
|
||||||
|
@ -72,14 +72,12 @@ class MinMaxZoomPreference {
|
|||||||
/// 缩放级别范围为[3, 20],超出范围取边界值
|
/// 缩放级别范围为[3, 20],超出范围取边界值
|
||||||
///
|
///
|
||||||
const MinMaxZoomPreference(double minZoom, double maxZoom)
|
const MinMaxZoomPreference(double minZoom, double maxZoom)
|
||||||
: this.minZoom =
|
: minZoom = ((minZoom < 3 ? 3 : minZoom) > (maxZoom > 20 ? 20 : maxZoom)
|
||||||
((minZoom < 3 ? 3 : minZoom) > (maxZoom > 20 ? 20 : maxZoom)
|
? maxZoom
|
||||||
? maxZoom
|
: minZoom),
|
||||||
: minZoom),
|
maxZoom = ((minZoom < 3 ? 3 : minZoom) > (maxZoom > 20 ? 20 : maxZoom)
|
||||||
this.maxZoom =
|
? minZoom
|
||||||
((minZoom < 3 ? 3 : minZoom) > (maxZoom > 20 ? 20 : maxZoom)
|
: maxZoom);
|
||||||
? minZoom
|
|
||||||
: maxZoom);
|
|
||||||
|
|
||||||
/// 最小zoomLevel
|
/// 最小zoomLevel
|
||||||
final double? minZoom;
|
final double? minZoom;
|
||||||
@ -152,10 +150,10 @@ class MyLocationStyleOptions {
|
|||||||
}
|
}
|
||||||
return MyLocationStyleOptions(
|
return MyLocationStyleOptions(
|
||||||
json['enabled'] ?? false,
|
json['enabled'] ?? false,
|
||||||
circleFillColor: json['circleFillColor'] ?? null,
|
circleFillColor: json['circleFillColor'],
|
||||||
circleStrokeColor: json['circleStrokeColor'] ?? null,
|
circleStrokeColor: json['circleStrokeColor'],
|
||||||
circleStrokeWidth: json['circleStrokeWidth'] ?? null,
|
circleStrokeWidth: json['circleStrokeWidth'],
|
||||||
icon: json['icon'] ?? null,
|
icon: json['icon'],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -225,8 +223,8 @@ class CustomStyleOptions {
|
|||||||
}
|
}
|
||||||
return CustomStyleOptions(
|
return CustomStyleOptions(
|
||||||
json['enabled'] ?? false,
|
json['enabled'] ?? false,
|
||||||
styleData: json['styleData'] ?? null,
|
styleData: json['styleData'],
|
||||||
styleExtraData: json['styleExtraData'] ?? null,
|
styleExtraData: json['styleExtraData'],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
part of amap_map;
|
part of '../../amap_map.dart';
|
||||||
|
|
||||||
bool isLocationValid(AMapLocation location) {
|
bool isLocationValid(AMapLocation location) {
|
||||||
final LatLng latLng = location.latLng;
|
final LatLng latLng = location.latLng;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
name: amap_map
|
name: amap_map
|
||||||
description: Amap SDK Flutter plugin for integrating AMapSDK in iOS and Android applications.
|
description: Amap SDK Flutter plugin for integrating AMapSDK in iOS and Android applications.
|
||||||
version: 1.0.10
|
version: 1.0.11
|
||||||
homepage: https://github.com/kuloud/amap_map
|
homepage: https://github.com/kuloud/amap_map
|
||||||
issue_tracker: https://github.com/kuloud/amap_map/issues
|
issue_tracker: https://github.com/kuloud/amap_map/issues
|
||||||
platforms:
|
platforms:
|
||||||
@ -24,13 +24,11 @@ dependencies:
|
|||||||
|
|
||||||
x_amap_base: ^1.0.3
|
x_amap_base: ^1.0.3
|
||||||
x_common: ^1.0.4
|
x_common: ^1.0.4
|
||||||
# provider: ^6.1.1
|
|
||||||
# x_amap_base:
|
|
||||||
# path: ../x_amap_base
|
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
flutter_test:
|
flutter_test:
|
||||||
sdk: flutter
|
sdk: flutter
|
||||||
|
lints: ^4.0.0
|
||||||
|
|
||||||
# For information on the generic Dart part of this file, see the
|
# For information on the generic Dart part of this file, see the
|
||||||
# following page: https://dart.dev/tools/pub/pubspec
|
# following page: https://dart.dev/tools/pub/pubspec
|
||||||
|
Reference in New Issue
Block a user