mapbox-maps-flutter
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?
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();
}
I tried porting the markers layer implementation from flutter_map but failed :(. Maybe someone smarter than me can do it!
@amitind49 Did you figure out how to do this better?
Here's how I did it, hope it helps you:
Widget -> Capture Widget -> Unit8list -> draw to mapbox