refactor: Centralize error and notification handling using a dedicated _errorService across various components.
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user