add selectecmode

This commit is contained in:
2025-09-02 23:18:46 +02:00
parent 59b16e5131
commit 692d55858c

View File

@@ -230,15 +230,45 @@ class _MapboxPagesState extends State<MapboxPages> with ShowAlertDialog {
drawer: MyDrawer(),
body: isLoading
? const Center(child: CircularProgressIndicator())
: mapbox.MapWidget(
onMapCreated: (controller) {
mapboxMap = controller;
},
cameraOptions: mapbox.CameraOptions(
center: mapbox.Point(
coordinates: mapbox.Position(longitude, latitude)),
zoom: 14.0,
),
: Column(
children: [
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
const Text("Mode : "),
DropdownButton<String>(
value: selectedMode,
items: const [
DropdownMenuItem(
value: 'driving', child: Text("🚗 Voiture")),
DropdownMenuItem(
value: 'walking', child: Text("🚶 Marche")),
DropdownMenuItem(
value: 'cycling', child: Text("🚴 Vélo")),
],
onChanged: (value) {
if (value != null) {
setState(() {
selectedMode = value;
});
}
},
),
],
),
Expanded(
child: mapbox.MapWidget(
onMapCreated: (controller) {
mapboxMap = controller;
},
cameraOptions: mapbox.CameraOptions(
center: mapbox.Point(
coordinates: mapbox.Position(longitude, latitude)),
zoom: 14.0,
),
),
),
],
),
floatingActionButton: FloatingActionButton(
onPressed: _drawRouteAndMarkers,