AMapWidget constructor
const
AMapWidget({
- Key? key,
- AMapPrivacyStatement? privacyStatement,
- AMapApiKey? apiKey,
- CameraPosition initialCameraPosition = const CameraPosition(target: LatLng(39.909187, 116.397451), zoom: 10),
- MapType mapType = MapType.normal,
- bool buildingsEnabled = true,
- bool compassEnabled = false,
- bool labelsEnabled = true,
- LatLngBounds? limitBounds,
- MinMaxZoomPreference? minMaxZoomPreference,
- bool rotateGesturesEnabled = true,
- bool scaleEnabled = true,
- bool scrollGesturesEnabled = true,
- bool tiltGesturesEnabled = true,
- bool touchPoiEnabled = true,
- bool trafficEnabled = false,
- bool zoomGesturesEnabled = true,
- bool gestureScaleByMapCenter = false,
- MapCreatedCallback? onMapCreated,
- Set<
Factory< gestureRecognizers = const <Factory<OneSequenceGestureRecognizer>>{},OneSequenceGestureRecognizer> > - CustomStyleOptions? customStyleOptions,
- MyLocationStyleOptions? myLocationStyleOptions,
- ArgumentCallback<
CameraPosition> ? onCameraMove, - ArgumentCallback<
CameraPosition> ? onCameraMoveEnd, - ArgumentCallback<
AMapLocation> ? onLocationChanged, - ArgumentCallback<
LatLng> ? onTap, - ArgumentCallback<
LatLng> ? onLongPress, - ArgumentCallback<
AMapPoi> ? onPoiTouched, - Set<
Marker> markers = const <Marker>{}, - Set<
Polyline> polylines = const <Polyline>{}, - Set<
Polygon> polygons = const <Polygon>{},
创建一个展示高德地图的widget
如果使用的高德地图SDK的版本是8.1.0及以上版本,
在app首次启动时必须传入高德合规声明配置privacyStatement
,后续如果没有变化不需要重复设置
高德SDK合规使用方案请参考:https://lbs.amap.com/news/sdkhgsy
AssertionError will be thrown if initialCameraPosition
is null;
Implementation
const AMapWidget({
Key? key,
this.privacyStatement,
this.apiKey,
this.initialCameraPosition = const CameraPosition(target: LatLng(39.909187, 116.397451), zoom: 10),
this.mapType = MapType.normal,
this.buildingsEnabled = true,
this.compassEnabled = false,
this.labelsEnabled = true,
this.limitBounds,
this.minMaxZoomPreference,
this.rotateGesturesEnabled = true,
this.scaleEnabled = true,
this.scrollGesturesEnabled = true,
this.tiltGesturesEnabled = true,
this.touchPoiEnabled = true,
this.trafficEnabled = false,
this.zoomGesturesEnabled = true,
this.gestureScaleByMapCenter = false,//新增,中心锁定缩放
this.onMapCreated,
this.gestureRecognizers = const <Factory<OneSequenceGestureRecognizer>>{},
this.customStyleOptions,
this.myLocationStyleOptions,
this.onCameraMove,
this.onCameraMoveEnd,
this.onLocationChanged,
this.onTap,
this.onLongPress,
this.onPoiTouched,
this.markers = const <Marker>{},
this.polylines = const <Polyline>{},
this.polygons = const <Polygon>{},
}) : super(key: key);