translate mapbox page 50%

This commit is contained in:
2025-07-27 20:42:56 +02:00
parent dcc2ec25de
commit 9e50b6d6f6
3 changed files with 48 additions and 12 deletions

View File

@@ -161,14 +161,19 @@ class _MapboxPagesState extends State<MapboxPages> with ShowAlertDialog {
// Handle location services disabled
position = await Geolocator.getLastKnownPosition();
if (position == null) {
print('No last known position available.');
showAlertDialog(
context,
AppLocalizations.of(context)?.error ?? "Error",
"No last known position available..");
}
} catch (e) {
// Handle other errors
print('Failed to get location: $e');
position = await Geolocator.getLastKnownPosition();
if (position == null) {
print('No last known position available.');
showAlertDialog(
context,
AppLocalizations.of(context)?.error ?? "Error",
"No last known position available");
}
}
if (position != null) {
@@ -201,7 +206,7 @@ class _MapboxPagesState extends State<MapboxPages> with ShowAlertDialog {
}).toList();
});
} else {
showAlertDialog(context, "Erreur serveur",
showAlertDialog(context, AppLocalizations.of(context)?.error ?? "Error",
"Failed to fetch the route: ${response.statusCode}");
}
}
@@ -209,8 +214,6 @@ class _MapboxPagesState extends State<MapboxPages> with ShowAlertDialog {
// Called when the map is created
void _onStyleLoaded() async {
// Log the map controller and coordinates
print("Mapbox controller initialized: $mapController");
print("lat - long : $latitude - $longitude");
// Check if the mapController is really initialized
if (mapController != null) {
@@ -230,20 +233,23 @@ class _MapboxPagesState extends State<MapboxPages> with ShowAlertDialog {
);
// Debugging symbol options
print("Adding symbol with options: $symbolOptions");
// Add symbol to map
mapController!.addSymbol(symbolOptions);
} else {
print("Error: Invalid coordinates, cannot add symbol.");
showAlertDialog(
context,
AppLocalizations.of(context)?.error ?? "Error",
"Error: Invalid coordinates, cannot add symbol.");
}
} catch (e) {
// Handle any exception that occurs when adding the symbol
print("Error when adding symbol: $e");
showAlertDialog(context, AppLocalizations.of(context)?.error ?? "Error",
"Error when adding symbol.");
}
} else {
print(
"Error: MapboxMapController is null at the time of symbol addition");
showAlertDialog(context, AppLocalizations.of(context)?.error ?? "Error",
"Error when adding symbol.");
}
}