add marker red
This commit is contained in:
@@ -231,14 +231,12 @@ class _MapboxPagesState extends State<MapboxPages> with ShowAlertDialog {
|
||||
iconSize: 0.4,
|
||||
));
|
||||
|
||||
// Add event marker
|
||||
// Ajoute directement la flèche rouge à la position de l’événement
|
||||
final eventIcon = await _loadMarkerImage('images/marker-red.png');
|
||||
await pointAnnotationManager!.create(mapbox.PointAnnotationOptions(
|
||||
geometry: mapbox.Point(
|
||||
coordinates: mapbox.Position(
|
||||
destination.coordinates.lng, destination.coordinates.lat)),
|
||||
geometry: mapbox.Point(coordinates: mapbox.Position(longitude, latitude)),
|
||||
image: eventIcon,
|
||||
iconSize: 0.4,
|
||||
iconSize: 0.2,
|
||||
));
|
||||
|
||||
// Fetch and draw route
|
||||
@@ -296,8 +294,23 @@ class _MapboxPagesState extends State<MapboxPages> with ShowAlertDialog {
|
||||
),
|
||||
Expanded(
|
||||
child: mapbox.MapWidget(
|
||||
onMapCreated: (controller) {
|
||||
onMapCreated: (controller) async {
|
||||
mapboxMap = controller;
|
||||
|
||||
// Crée un manager si nécessaire
|
||||
pointAnnotationManager ??= await mapboxMap!.annotations
|
||||
.createPointAnnotationManager();
|
||||
|
||||
// Ajoute directement la flèche rouge à la position de l’événement
|
||||
final eventIcon =
|
||||
await _loadMarkerImage('images/marker-red.png');
|
||||
await pointAnnotationManager!
|
||||
.create(mapbox.PointAnnotationOptions(
|
||||
geometry: mapbox.Point(
|
||||
coordinates: mapbox.Position(longitude, latitude)),
|
||||
image: eventIcon,
|
||||
iconSize: 0.2,
|
||||
));
|
||||
},
|
||||
cameraOptions: mapbox.CameraOptions(
|
||||
center: mapbox.Point(
|
||||
|
Reference in New Issue
Block a user