refactor: Centralize error and notification handling using a dedicated _errorService across various components.

This commit is contained in:
Van Leemput Dayron
2025-12-03 14:50:03 +01:00
parent 6757cb013a
commit f3ae91ccf9
10 changed files with 91 additions and 249 deletions

View File

@@ -547,11 +547,9 @@ class _ShowTripDetailsContentState extends State<ShowTripDetailsContent> {
}
void _showComingSoon(String feature) {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text('$feature - Fonctionnalité à venir'),
backgroundColor: Colors.blue,
),
_errorService.showSnackbar(
message: '$feature - Fonctionnalité à venir',
isError: false,
);
}
@@ -868,11 +866,8 @@ class _ShowTripDetailsContentState extends State<ShowTripDetailsContent> {
_addParticipantByEmail(emailController.text);
Navigator.pop(context);
} else {
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(
content: Text('Veuillez entrer un email valide'),
backgroundColor: Colors.red,
),
_errorService.showError(
message: 'Veuillez entrer un email valide',
);
}
},
@@ -940,11 +935,9 @@ class _ShowTripDetailsContentState extends State<ShowTripDetailsContent> {
TripUpdateRequested(trip: updatedTrip),
);
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text('${user.prenom} a été ajouté au voyage'),
backgroundColor: Colors.green,
),
_errorService.showSnackbar(
message: '${user.prenom} a été ajouté au voyage',
isError: false,
);
// Rafraîchir la page