change alert message
This commit is contained in:
@@ -42,7 +42,7 @@ class MapboxPages extends StatefulWidget {
|
||||
State<MapboxPages> createState() => _MapboxPagesState();
|
||||
}
|
||||
|
||||
class _MapboxPagesState extends State<MapboxPages> with ShowErrorDialog {
|
||||
class _MapboxPagesState extends State<MapboxPages> with ShowAlertDialog {
|
||||
late MapboxMapController mapController;
|
||||
late String mapboxAccessToken;
|
||||
List<LatLng> routeCoordinates = [];
|
||||
@@ -63,7 +63,8 @@ class _MapboxPagesState extends State<MapboxPages> with ShowErrorDialog {
|
||||
void _initToken() {
|
||||
mapboxAccessToken = dotenv.env['MAPBOX_ACCESS_TOKEN'] ?? '';
|
||||
if (mapboxAccessToken.isEmpty) {
|
||||
showErrorDialog(context, "Mapbox Access Token is not available.");
|
||||
showAlertDialog(
|
||||
context, "Erreur Mapbox", "Mapbox Access Token is not available.");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -88,7 +89,7 @@ class _MapboxPagesState extends State<MapboxPages> with ShowErrorDialog {
|
||||
_handleErrorResponse(responseGet.statusCode);
|
||||
}
|
||||
} else {
|
||||
showErrorDialog(context, "Invalid cache.");
|
||||
showAlertDialog(context, "Erreur serveur", "Invalid cache.");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -116,14 +117,15 @@ class _MapboxPagesState extends State<MapboxPages> with ShowErrorDialog {
|
||||
default:
|
||||
text = "Unknown error.";
|
||||
}
|
||||
showErrorDialog(context, text);
|
||||
showAlertDialog(context, "Erreur serveur", text);
|
||||
}
|
||||
|
||||
Future<void> _getUserLocation() async {
|
||||
try {
|
||||
bool serviceEnabled = await Geolocator.isLocationServiceEnabled();
|
||||
if (!serviceEnabled) {
|
||||
showErrorDialog(context, "Location services are disabled.");
|
||||
showAlertDialog(
|
||||
context, "Erreur de service", "Location services are disabled.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -131,13 +133,14 @@ class _MapboxPagesState extends State<MapboxPages> with ShowErrorDialog {
|
||||
if (permission == LocationPermission.denied) {
|
||||
permission = await Geolocator.requestPermission();
|
||||
if (permission == LocationPermission.denied) {
|
||||
showErrorDialog(context, "Location permissions are denied.");
|
||||
showAlertDialog(context, "Erreur de permission",
|
||||
"Location permissions are denied.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (permission == LocationPermission.deniedForever) {
|
||||
showErrorDialog(context,
|
||||
showAlertDialog(context, "Erreur de permission",
|
||||
"Location permissions are permanently denied. Enable them in settings.");
|
||||
return;
|
||||
}
|
||||
@@ -171,7 +174,7 @@ class _MapboxPagesState extends State<MapboxPages> with ShowErrorDialog {
|
||||
_initToken();
|
||||
_getEventInfo();
|
||||
} catch (e) {
|
||||
showErrorDialog(context, "Failed to get user location: $e");
|
||||
showAlertDialog(context, "Erreur geo", "Failed to get user location: $e");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -191,8 +194,8 @@ class _MapboxPagesState extends State<MapboxPages> with ShowErrorDialog {
|
||||
}).toList();
|
||||
});
|
||||
} else {
|
||||
showErrorDialog(
|
||||
context, "Failed to fetch the route: ${response.statusCode}");
|
||||
showAlertDialog(context, "Erreur serveur",
|
||||
"Failed to fetch the route: ${response.statusCode}");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -244,8 +247,8 @@ class _MapboxPagesState extends State<MapboxPages> with ShowErrorDialog {
|
||||
currentRouteLine = null;
|
||||
}
|
||||
if (!isUserPositionInitialized) {
|
||||
showErrorDialog(
|
||||
context, "User position is not yet initialized. Try again.");
|
||||
showAlertDialog(context, "Erreur de position",
|
||||
"User position is not yet initialized. Try again.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -284,7 +287,8 @@ class _MapboxPagesState extends State<MapboxPages> with ShowErrorDialog {
|
||||
_zoomToFitRoute(routeCoordinates);
|
||||
}
|
||||
} else {
|
||||
showErrorDialog(context, "Invalid coordinates or user position.");
|
||||
showAlertDialog(context, "Erreur de coordonée",
|
||||
"Invalid coordinates or user position.");
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user