add marker red
This commit is contained in:
@@ -231,14 +231,12 @@ class _MapboxPagesState extends State<MapboxPages> with ShowAlertDialog {
|
|||||||
iconSize: 0.4,
|
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');
|
final eventIcon = await _loadMarkerImage('images/marker-red.png');
|
||||||
await pointAnnotationManager!.create(mapbox.PointAnnotationOptions(
|
await pointAnnotationManager!.create(mapbox.PointAnnotationOptions(
|
||||||
geometry: mapbox.Point(
|
geometry: mapbox.Point(coordinates: mapbox.Position(longitude, latitude)),
|
||||||
coordinates: mapbox.Position(
|
|
||||||
destination.coordinates.lng, destination.coordinates.lat)),
|
|
||||||
image: eventIcon,
|
image: eventIcon,
|
||||||
iconSize: 0.4,
|
iconSize: 0.2,
|
||||||
));
|
));
|
||||||
|
|
||||||
// Fetch and draw route
|
// Fetch and draw route
|
||||||
@@ -296,8 +294,23 @@ class _MapboxPagesState extends State<MapboxPages> with ShowAlertDialog {
|
|||||||
),
|
),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: mapbox.MapWidget(
|
child: mapbox.MapWidget(
|
||||||
onMapCreated: (controller) {
|
onMapCreated: (controller) async {
|
||||||
mapboxMap = controller;
|
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(
|
cameraOptions: mapbox.CameraOptions(
|
||||||
center: mapbox.Point(
|
center: mapbox.Point(
|
||||||
|
Reference in New Issue
Block a user