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(), drawer: MyDrawer(),
body: isLoading body: isLoading
? const Center(child: CircularProgressIndicator()) ? const Center(child: CircularProgressIndicator())
: mapbox.MapWidget( : Column(
onMapCreated: (controller) { children: [
mapboxMap = controller; Row(
}, mainAxisAlignment: MainAxisAlignment.center,
cameraOptions: mapbox.CameraOptions( children: [
center: mapbox.Point( const Text("Mode : "),
coordinates: mapbox.Position(longitude, latitude)), DropdownButton<String>(
zoom: 14.0, 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( floatingActionButton: FloatingActionButton(
onPressed: _drawRouteAndMarkers, onPressed: _drawRouteAndMarkers,