mapbox-maps-flutter icon indicating copy to clipboard operation
mapbox-maps-flutter copied to clipboard

Does Mapbox currently provide the ability to add markers as widgets? If not, are there any plans to support the use of widgets as markers on the map in future updates?

Open th-amit-ind49 opened this issue 1 year ago • 3 comments

I'm using PointAnnotationManager to create a marker. To create a custom marker right now I'm doing a widget to Uint8List. I expect that any other better way to use widget as marker on mapbox skd?

  static Future<Uint8List> widgetToIcon(GlobalKey globalKey) async {
    RenderRepaintBoundary boundary =
    globalKey.currentContext?.findRenderObject() as RenderRepaintBoundary;
    ui.Image image = await boundary.toImage();
    ByteData? byteData = await image.toByteData(format: ui.ImageByteFormat.png);
    return byteData!.buffer.asUint8List();
  }

th-amit-ind49 avatar Jan 06 '25 13:01 th-amit-ind49

I tried porting the markers layer implementation from flutter_map but failed :(. Maybe someone smarter than me can do it!

sheeroo avatar Jan 14 '25 14:01 sheeroo

@amitind49 Did you figure out how to do this better?

mattrltrent avatar Mar 09 '25 08:03 mattrltrent

Here's how I did it, hope it helps you:

Widget -> Capture Widget -> Unit8list -> draw to mapbox

JasonEastar avatar May 14 '25 04:05 JasonEastar