flutter-mapbox-gl / maps

A Mapbox GL flutter package for creating custom maps
Other
1.04k stars 503 forks source link

How to add special effects to the marker? #1306

Closed yvone1991 closed 1 year ago

yvone1991 commented 1 year ago

The circle I draw always covers my car icon.

image
Future<Uint8List> loadMarkerImage() async {
  var byteData =
      await rootBundle.load("lib/assets/images/fjmower/icon_fjmower_img.png");

  return byteData.buffer.asUint8List();
}

void _onMapCreated(MapboxMapController controller) async {
    _mapController = controller;
    var markerImage = await loadMarkerImage();
    _mapController.addImage('car', markerImage);
    // add circle
    await _mapController.addCircle(CircleOptions(
      circleOpacity: 1,
      circleColor: '#D6E2F0',
      circleRadius: 22.r,
      geometry: location,
    ));
    //add car
    await _mapController.addSymbol(SymbolOptions(
      iconSize: 0.3,
      iconImage: "car",
      geometry: location,
      zIndex: 2,
    ));
}
felix-ht commented 1 year ago

change annotation order to

MapboxMap(
      ...
     annotationOrder: [
          AnnotationType.fill,
          AnnotationType.line,
          AnnotationType.circle,
          AnnotationType.symbol,
        ],
)
yvone1991 commented 1 year ago

change annotation order to

MapboxMap(
      ...
     annotationOrder: [
          AnnotationType.fill,
          AnnotationType.line,
          AnnotationType.circle,
          AnnotationType.symbol,
        ],
)

wow,3q~