diff --git a/covas_mobile_new/lib/pages/MapboxPages.dart b/covas_mobile_new/lib/pages/MapboxPages.dart index 3fad1fa..63d50b1 100644 --- a/covas_mobile_new/lib/pages/MapboxPages.dart +++ b/covas_mobile_new/lib/pages/MapboxPages.dart @@ -231,14 +231,12 @@ class _MapboxPagesState extends State 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 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(