addPoi method
Future<String>
addPoi(
- LatLng position, {
- required PoiStyle style,
- String? id,
- String? text,
- int? rank,
- bool visible = true,
override
Implementation
@override
Future<String> addPoi(
LatLng position, {
required PoiStyle style,
String? id,
String? text,
int? rank,
bool visible = true,
}) async {
final poiId = manager._uuid.v4();
final Map<int, String> preEncodedImage = {};
if (style.icon != null) {
preEncodedImage[style.zoomLevel] =
encodeImageToBase64(await style.icon!.readBytes());
}
for (var inStyle in style.otherStyles) {
if (inStyle.icon == null) continue;
preEncodedImage[inStyle.zoomLevel] =
encodeImageToBase64(await inStyle.icon!.readBytes());
}
final poi = _webPoi[poiId] = WebPoi(poiId, this.id,
currentLevel: style.zoomLevel,
text: text,
styleId: style.id!, onClick: () {
manager._onPoiClick(this.id, poiId, isLod);
});
final options = WebCustomOverlayOption(
clickable: true,
content: poiElement(poi, style),
position: WebLatLng.fromLatLng(position),
xAnchor: style.anchor.x.toDouble(),
yAnchor: style.anchor.y.toDouble(),
zIndex: rank ?? 10001);
poi.overlay = WebCustomOverlay(options);
poi.preEncodedImage.addAll(preEncodedImage);
poi.setMap(controller);
poi.setVisible(visible);
_syncZoomLevel(poiId);
return poiId;
}