add marker red

This commit is contained in:
2025-09-04 18:11:12 +02:00
parent 9989aebc32
commit 86f81ff009

View File

@@ -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(