release: 1.0.11

This commit is contained in:
Kuloud
2024-08-25 23:37:44 +08:00
parent 74e60b2015
commit 8c59ec203a
20 changed files with 87 additions and 118 deletions

View File

@ -1,8 +1,14 @@
## 1.0.11
2024-08-25
* 升级amap iOS sdk版本 10.0.900 | 2024-08-23
* code lint
## 1.0.10
2024-08-25
* 移除extension实现机制
* 添加 getMapContentApprovalNumber / getSatelliteImageApprovalNumber参见example#ShowMapPage
* 添加 InfoWindowAdapter参见example#CustomInfoWindowDemoPage,结合 infoWindowEnable 和 BaseInfoWindowAdapter 自行实现具体逻辑
* permission_handler 11.3.0 -> 11.3.1
## 1.0.9
2024-08-24

View File

@ -6,7 +6,7 @@
| | 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+ |
本插件基于 amap_flutter_map 3.0.0 进行二开的原因:

1
analysis_options.yaml Normal file
View File

@ -0,0 +1 @@
include: package:lints/recommended.yaml

View File

@ -1,5 +1,5 @@
PODS:
- AMap3DMap (10.0.800):
- AMap3DMap (10.0.900):
- AMapFoundation (>= 1.8.0)
- amap_map (1.0.8):
- AMap3DMap
@ -28,7 +28,7 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/permission_handler_apple/ios"
SPEC CHECKSUMS:
AMap3DMap: 6761e0381f517978312e4f795ce77b2b9f6781a6
AMap3DMap: 220e48934bc6553a15251c8c86f581a802787506
amap_map: 5be213f350872f6ea406be964031572ab9a0d6e1
AMapFoundation: 9885c48fc3a78fdfb84a0299a2293e56ea3c9fec
Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7

View File

@ -24,13 +24,13 @@ class _AMapRadioGroupState<T> extends State<AMapRadioGroup<T>> {
@override
void initState() {
super.initState();
_groupValue = (widget.groupValue ?? null) as T?;
_groupValue = (widget.groupValue);
}
@override
Widget build(BuildContext context) {
List<Widget> radioList = <Widget>[];
_groupValue = (widget.groupValue ?? null) as T?;
_groupValue = (widget.groupValue);
Widget _myRadio(String label, dynamic radioValue) {
return Row(
mainAxisAlignment: MainAxisAlignment.center,

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
part of amap_map;
part of '../amap_map.dart';
class AMapInitializer {
static AMapApiKey? _apiKey;

View File

@ -10,9 +10,9 @@
// Unless required by applicable law or agreed to in writing, software
// 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
class AMapWidget extends StatefulWidget {
@ -124,7 +124,7 @@ class AMapWidget extends StatefulWidget {
///
/// [AssertionError] will be thrown if [initialCameraPosition] is null;
const AMapWidget(
{Key? key,
{super.key,
this.initialCameraPosition =
const CameraPosition(target: LatLng(39.909187, 116.397451), zoom: 10),
this.mapType = MapType.normal,
@ -157,8 +157,7 @@ class AMapWidget extends StatefulWidget {
this.infoWindowAdapter,
this.logoPosition,
this.logoBottomMargin,
this.logoLeftMargin})
: super(key: key);
this.logoLeftMargin});
///
@override
@ -169,7 +168,7 @@ class _MapState extends State<AMapWidget> {
Map<String, Marker> _markers = <String, Marker>{};
Map<String, Polyline> _polylines = <String, Polyline>{};
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>();
late _AMapOptions _mapOptions;
@ -244,38 +243,38 @@ class _MapState extends State<AMapWidget> {
);
_controller.complete(controller);
final MapCreatedCallback? _onMapCreated = widget.onMapCreated;
if (_onMapCreated != null) {
_onMapCreated(controller);
final MapCreatedCallback? onMapCreated = widget.onMapCreated;
if (onMapCreated != null) {
onMapCreated(controller);
}
}
void onMarkerTap(String markerId) {
final Marker? _marker = _markers[markerId];
if (_marker != null) {
final ArgumentCallback<String>? _onTap = _marker.onTap;
if (_onTap != null) {
_onTap(markerId);
final Marker? marker = _markers[markerId];
if (marker != null) {
final ArgumentCallback<String>? onTap = marker.onTap;
if (onTap != null) {
onTap(markerId);
}
}
}
void onMarkerDragEnd(String markerId, LatLng position) {
final Marker? _marker = _markers[markerId];
if (_marker != null) {
final MarkerDragEndCallback? _onDragEnd = _marker.onDragEnd;
if (_onDragEnd != null) {
_onDragEnd(markerId, position);
final Marker? marker = _markers[markerId];
if (marker != null) {
final MarkerDragEndCallback? onDragEnd = marker.onDragEnd;
if (onDragEnd != null) {
onDragEnd(markerId, position);
}
}
}
void onPolylineTap(String polylineId) {
final Polyline? _polyline = _polylines[polylineId];
if (_polyline != null) {
final ArgumentCallback<String>? _onTap = _polyline.onTap;
if (_onTap != null) {
_onTap(polylineId);
final Polyline? polyline = _polylines[polylineId];
if (polyline != null) {
final ArgumentCallback<String>? onTap = polyline.onTap;
if (onTap != null) {
onTap(polylineId);
}
}
}

View File

@ -18,29 +18,27 @@ class MapEvent<T> {
///定位回调接口
class LocationChangedEvent extends MapEvent<AMapLocation> {
LocationChangedEvent(int mapId, AMapLocation value) : super(mapId, value);
LocationChangedEvent(super.mapId, super.value);
}
///地图移动回调
class CameraPositionMoveEvent extends MapEvent<CameraPosition> {
CameraPositionMoveEvent(int mapId, CameraPosition value)
: super(mapId, value);
CameraPositionMoveEvent(super.mapId, super.value);
}
///地图移动结束回调
class CameraPositionMoveEndEvent extends MapEvent<CameraPosition> {
CameraPositionMoveEndEvent(int mapId, CameraPosition value)
: super(mapId, value);
CameraPositionMoveEndEvent(super.mapId, super.value);
}
///点击地图回调
class MapTapEvent extends MapEvent<LatLng> {
MapTapEvent(int mapId, LatLng value) : super(mapId, value);
MapTapEvent(super.mapId, super.value);
}
///长按地图回调
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] 的点击事件
class MarkerTapEvent extends MapEvent<String> {
MarkerTapEvent(int mapId, String markerId) : super(mapId, markerId);
MarkerTapEvent(super.mapId, super.markerId);
}
/// [Marker] 的拖拽结束事件,附带拖拽结束时的位置信息[LatLng].
class MarkerDragEndEvent extends _PositionedMapEvent<String> {
MarkerDragEndEvent(int mapId, LatLng position, String markerId)
: super(mapId, position, markerId);
MarkerDragEndEvent(super.mapId, super.position, super.markerId);
}
/// [Polyline] 的点击事件
class PolylineTapEvent extends MapEvent<String> {
PolylineTapEvent(int mapId, String polylineId) : super(mapId, polylineId);
PolylineTapEvent(super.mapId, super.polylineId);
}
/// Poi点击事件
class MapPoiTouchEvent extends MapEvent<AMapPoi> {
MapPoiTouchEvent(int mapId, AMapPoi poi) : super(mapId, poi);
MapPoiTouchEvent(super.mapId, super.poi);
}

View File

@ -182,7 +182,7 @@ class MethodChannelAMapFlutterMap implements AMapFlutterPlatform {
_mapEventStreamController.add(LocationChangedEvent(
mapId, AMapLocation.fromMap(call.arguments['location'])!));
} catch (e) {
print("location#changed error=======>" + e.toString());
print("location#changed error=======>$e");
}
break;
@ -191,7 +191,7 @@ class MethodChannelAMapFlutterMap implements AMapFlutterPlatform {
_mapEventStreamController.add(CameraPositionMoveEvent(
mapId, CameraPosition.fromMap(call.arguments['position'])!));
} catch (e) {
print("camera#onMove error===>" + e.toString());
print("camera#onMove error===>$e");
}
break;
case 'camera#onMoveEnd':
@ -199,7 +199,7 @@ class MethodChannelAMapFlutterMap implements AMapFlutterPlatform {
_mapEventStreamController.add(CameraPositionMoveEndEvent(
mapId, CameraPosition.fromMap(call.arguments['position'])!));
} catch (e) {
print("camera#onMoveEnd error===>" + e.toString());
print("camera#onMoveEnd error===>$e");
}
break;
case 'map#onTap':
@ -232,7 +232,7 @@ class MethodChannelAMapFlutterMap implements AMapFlutterPlatform {
_mapEventStreamController.add(MapPoiTouchEvent(
mapId, AMapPoi.fromJson(call.arguments['poi'])!));
} catch (e) {
print('map#onPoiTouched error===>' + e.toString());
print('map#onPoiTouched error===>$e');
}
break;
}

View File

@ -6,7 +6,7 @@ class BaseOverlay {
String get id => _id;
BaseOverlay() {
this._id = this.hashCode.toString();
_id = hashCode.toString();
}
void setIdForCopy(String copyId) => _id = copyId;

View File

@ -38,7 +38,7 @@ class CameraPosition {
///
/// 主要在插件内部使用
static CameraPosition? fromMap(dynamic json) {
if (json == null || !(json is Map<dynamic, dynamic>)) {
if (json == null || json is! Map<dynamic, dynamic>) {
return null;
}
final LatLng? target = LatLng.fromJson(json['target']);

View File

@ -8,7 +8,7 @@ import 'package:x_amap_base/x_amap_base.dart';
import 'bitmap.dart';
/// Marker拖动回调
typedef void MarkerDragEndCallback(String id, LatLng endPosition);
typedef MarkerDragEndCallback = void Function(String id, LatLng endPosition);
///Marker的气泡
///
@ -91,11 +91,11 @@ class Marker extends BaseOverlay {
this.zIndex = 0.0,
this.onTap,
this.onDragEnd,
}) : this.alpha =
}) : alpha =
// ignore: unnecessary_null_comparison
(alpha != null ? (alpha < 0 ? 0 : (alpha > 1 ? 1 : alpha)) : alpha),
// ignore: unnecessary_null_comparison
this.anchor = (anchor == null
anchor = (anchor == null
? Offset(0.5, 1.0)
: ((anchor.dx < 0 ||
anchor.dx > 1 ||
@ -182,6 +182,7 @@ class Marker extends BaseOverlay {
return copyMark;
}
@override
Marker clone() => copyWith();
@override

View File

@ -6,16 +6,6 @@ import 'types.dart';
class MarkerUpdates {
/// 根据之前的marker列表[previous]和当前的marker列表[current]创建[MakerUpdates].
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> currentMarkers = keyByMarkerId(current);

View File

@ -60,6 +60,7 @@ class Polygon extends BaseOverlay {
return copyPolyline;
}
@override
Polygon clone() => copyWith();
/// 转换成可以序列化的map

View File

@ -9,16 +9,6 @@ import 'types.dart';
class PolygonUpdates {
/// 通过Polygon的前后更新集合构造一个PolygonUpdates
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> currentPolygons = keyByPolygonId(current);
@ -29,10 +19,10 @@ class PolygonUpdates {
return currentPolygons[id]!;
}
final Set<String> _polygonIdsToRemove =
final Set<String> tempPolygonIdsToRemove =
prevPolygonIds.difference(currentPolygonIds);
final Set<Polygon> _polygonsToAdd = currentPolygonIds
final Set<Polygon> tempPolygonsToAdd = currentPolygonIds
.difference(prevPolygonIds)
.map(idToCurrentPolygon)
.toSet();
@ -42,15 +32,15 @@ class PolygonUpdates {
return current != previous;
}
final Set<Polygon> _polygonsToChange = currentPolygonIds
final Set<Polygon> tempPolygonsToChange = currentPolygonIds
.intersection(prevPolygonIds)
.map(idToCurrentPolygon)
.where(hasChanged)
.toSet();
polygonsToAdd = _polygonsToAdd;
polygonIdsToRemove = _polygonIdsToRemove;
polygonsToChange = _polygonsToChange;
polygonsToAdd = tempPolygonsToAdd;
polygonIdsToRemove = tempPolygonIdsToRemove;
polygonsToChange = tempPolygonsToChange;
}
/// 想要添加的polygon对象集合.

View File

@ -62,9 +62,9 @@ class Polyline extends BaseOverlay {
this.customTexture,
this.onTap,
this.color = const Color(0xCCC4E0F0),
}) : assert(points.length > 0),
this.width = (width <= 0 ? 10 : width),
this.alpha = (alpha < 0 ? 0 : (alpha > 1 ? 1 : alpha)),
}) : assert(points.isNotEmpty),
width = (width <= 0 ? 10 : width),
alpha = (alpha < 0 ? 0 : (alpha > 1 ? 1 : alpha)),
super();
/// 覆盖物的坐标点数组,points不能为空
@ -131,6 +131,7 @@ class Polyline extends BaseOverlay {
return copyPolyline;
}
@override
Polyline clone() => copyWith();
/// 将对象转换为可序列化的map.
@ -176,9 +177,6 @@ class Polyline extends BaseOverlay {
color == typedOther.color;
}
@override
int get hashCode => super.hashCode;
dynamic _pointsToJson() {
final List<dynamic> result = <dynamic>[];
for (final LatLng point in points) {

View File

@ -10,16 +10,6 @@ import 'types.dart';
class PolylineUpdates {
/// 通过polyline的前后更新集合构造一个polylineUpdates
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> currentPolylines = keyByPolylineId(current);
@ -30,10 +20,10 @@ class PolylineUpdates {
return currentPolylines[id]!;
}
final Set<String> _polylineIdsToRemove =
final Set<String> tempPolylineIdsToRemove =
prevPolylineIds.difference(currentPolylineIds);
final Set<Polyline> _polylinesToAdd = currentPolylineIds
final Set<Polyline> tempPolylinesToAdd = currentPolylineIds
.difference(prevPolylineIds)
.map(idToCurrentPolyline)
.toSet();
@ -43,15 +33,15 @@ class PolylineUpdates {
return current != previous;
}
final Set<Polyline> _polylinesToChange = currentPolylineIds
final Set<Polyline> tempPolylinesToChange = currentPolylineIds
.intersection(prevPolylineIds)
.map(idToCurrentPolyline)
.where(hasChanged)
.toSet();
polylinesToAdd = _polylinesToAdd;
polylineIdsToRemove = _polylineIdsToRemove;
polylinesToChange = _polylinesToChange;
polylinesToAdd = tempPolylinesToAdd;
polylineIdsToRemove = tempPolylineIdsToRemove;
polylinesToChange = tempPolylinesToChange;
}
/// 用于添加polyline的集合

View File

@ -72,14 +72,12 @@ class MinMaxZoomPreference {
/// 缩放级别范围为[3, 20],超出范围取边界值
///
const MinMaxZoomPreference(double minZoom, double maxZoom)
: this.minZoom =
((minZoom < 3 ? 3 : minZoom) > (maxZoom > 20 ? 20 : maxZoom)
? maxZoom
: minZoom),
this.maxZoom =
((minZoom < 3 ? 3 : minZoom) > (maxZoom > 20 ? 20 : maxZoom)
? minZoom
: maxZoom);
: minZoom = ((minZoom < 3 ? 3 : minZoom) > (maxZoom > 20 ? 20 : maxZoom)
? maxZoom
: minZoom),
maxZoom = ((minZoom < 3 ? 3 : minZoom) > (maxZoom > 20 ? 20 : maxZoom)
? minZoom
: maxZoom);
/// 最小zoomLevel
final double? minZoom;
@ -152,10 +150,10 @@ class MyLocationStyleOptions {
}
return MyLocationStyleOptions(
json['enabled'] ?? false,
circleFillColor: json['circleFillColor'] ?? null,
circleStrokeColor: json['circleStrokeColor'] ?? null,
circleStrokeWidth: json['circleStrokeWidth'] ?? null,
icon: json['icon'] ?? null,
circleFillColor: json['circleFillColor'],
circleStrokeColor: json['circleStrokeColor'],
circleStrokeWidth: json['circleStrokeWidth'],
icon: json['icon'],
);
}
@ -225,8 +223,8 @@ class CustomStyleOptions {
}
return CustomStyleOptions(
json['enabled'] ?? false,
styleData: json['styleData'] ?? null,
styleExtraData: json['styleExtraData'] ?? null,
styleData: json['styleData'],
styleExtraData: json['styleExtraData'],
);
}

View File

@ -1,4 +1,4 @@
part of amap_map;
part of '../../amap_map.dart';
bool isLocationValid(AMapLocation location) {
final LatLng latLng = location.latLng;

View File

@ -1,6 +1,6 @@
name: amap_map
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
issue_tracker: https://github.com/kuloud/amap_map/issues
platforms:
@ -24,13 +24,11 @@ dependencies:
x_amap_base: ^1.0.3
x_common: ^1.0.4
# provider: ^6.1.1
# x_amap_base:
# path: ../x_amap_base
dev_dependencies:
flutter_test:
sdk: flutter
lints: ^4.0.0
# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec