AMapWidget constructor

const AMapWidget({
  1. Key? key,
  2. CameraPosition initialCameraPosition = const CameraPosition(target: LatLng(39.909187, 116.397451), zoom: 10),
  3. MapType mapType = MapType.normal,
  4. bool buildingsEnabled = true,
  5. bool compassEnabled = false,
  6. bool labelsEnabled = true,
  7. LatLngBounds? limitBounds,
  8. MinMaxZoomPreference? minMaxZoomPreference,
  9. bool rotateGesturesEnabled = true,
  10. bool scaleEnabled = true,
  11. bool scrollGesturesEnabled = true,
  12. bool tiltGesturesEnabled = true,
  13. bool touchPoiEnabled = true,
  14. bool trafficEnabled = false,
  15. bool zoomGesturesEnabled = true,
  16. MapCreatedCallback? onMapCreated,
  17. Set<Factory<OneSequenceGestureRecognizer>> gestureRecognizers = const <Factory<OneSequenceGestureRecognizer>>{},
  18. CustomStyleOptions? customStyleOptions,
  19. MyLocationStyleOptions? myLocationStyleOptions,
  20. ArgumentCallback<CameraPosition>? onCameraMove,
  21. ArgumentCallback<CameraPosition>? onCameraMoveEnd,
  22. ArgumentCallback<AMapLocation>? onLocationChanged,
  23. ArgumentCallback<LatLng>? onTap,
  24. ArgumentCallback<LatLng>? onLongPress,
  25. ArgumentCallback<AMapPoi>? onPoiTouched,
  26. Set<Marker> markers = const <Marker>{},
  27. Set<Polyline> polylines = const <Polyline>{},
  28. Set<Polygon> polygons = const <Polygon>{},
  29. List<AMapExtension> extensions = const [],
})

创建一个展示高德地图的widget

在app首次启动时必须传入高德合规声明配置privacyStatement,后续如果没有变化不需要重复设置

  • [privacyStatement.hasContains] 隐私权政策是否包含高德开平隐私权政策
  • [privacyStatement.hasShow] 是否已经弹窗展示给用户
  • [privacyStatement.hasAgree] 隐私权政策是否已经取得用户同意
  • 以上三个值,任何一个为false都会造成地图插件不工作(白屏情况)

    高德SDK合规使用方案请参考:https://lbs.amap.com/news/sdkhgsy

    AssertionError will be thrown if initialCameraPosition is null;

    Implementation

    const AMapWidget(
        {Key? key,
        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.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>{},
        this.extensions = const []})
        : super(key: key);