-
Notifications
You must be signed in to change notification settings - Fork 549
Closed
Description
I mentioned this issue at #316.
How to properly add a symbol?
Map Widget
MapBoxGL.MapboxMap(
onMapCreated: _onMapCreated,
onMapClick: (p, l) {
_addSymbol(l, asset_path_bnb + 'add.png');
},
trackCameraPosition: true,
myLocationEnabled: false,
tiltGesturesEnabled: false,
initialCameraPosition: MapBoxGL.CameraPosition(
target: MapBoxGL.LatLng(
BaseSharedPref.sharedPreferences
.getDouble('latitude'),
BaseSharedPref.sharedPreferences
.getDouble('longitude')),
zoom: 15),
),
Initializing the controller
void _onMapCreated(MapboxMapController controller) {
this.controller = controller;
}
Adding a symbol
void _addSymbol(MapBoxGL.LatLng latlng, String iconImage) {
print('Add');
controller.addSymbol(
SymbolOptions(
geometry: latlng,
iconImage: iconImage,
),
);
setState(() {
_symbolCount += 1;
});
}
Also, sometimes onMapClick function does not fire at all. What could be the issue?
Metadata
Metadata
Assignees
Labels
No labels