addTextMarker method
Add a MarkerCrafter to existing set of Markers
- Pass the MarkerCrafter object to add to the set
- !!! IMPORTANT!!!
- Call setstate after calling this function, as shown in the example
Example
markers.addTextMarker(MarkerCrafter(
label: "makerLabel",
markerId: MarkerId("markerIdString"),
position: LatLng(11.1203, 45.33),),
).then((_) {
setState(() {});
});
Implementation
Future<bool> addTextMarker(MarkerCrafter markerCrafter) async {
bool result = false;
await createRoundedMarkerIcon(markerCrafter.text, backgroundColor: markerCrafter.backgroundColor, textStyle: markerCrafter.textStyle).then((value) {
add(Marker(
markerId: markerCrafter.markerId,
position: markerCrafter.position,
icon: value,
alpha: markerCrafter.alpha,
anchor: markerCrafter.anchor,
consumeTapEvents: markerCrafter.consumeTapEvents,
draggable: markerCrafter.draggable,
flat: markerCrafter.flat,
infoWindow: markerCrafter.infoWindow,
rotation: markerCrafter.rotation,
visible: markerCrafter.visible,
zIndex: markerCrafter.zIndex,
onTap: markerCrafter.onTap,
onDragStart: markerCrafter.onDragStart,
onDrag: markerCrafter.onDrag,
onDragEnd: markerCrafter.onDragEnd));
result = true;
});
return (result);
}