Refactor ProfileContent to use ErrorService for error handling and update instantiation in SettingsContent
This commit is contained in:
@@ -1,13 +1,16 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:travel_mate/components/widgets/user_state_widget.dart';
|
||||
import 'package:travel_mate/services/error_service.dart';
|
||||
import '../../../blocs/user/user_bloc.dart';
|
||||
import '../../../blocs/user/user_state.dart' as user_state;
|
||||
import '../../../blocs/user/user_event.dart' as user_event;
|
||||
import '../../../services/auth_service.dart';
|
||||
|
||||
class ProfileContent extends StatelessWidget {
|
||||
const ProfileContent({super.key});
|
||||
ProfileContent({super.key});
|
||||
|
||||
final _errorService = ErrorService();
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -251,11 +254,8 @@ class ProfileContent extends StatelessWidget {
|
||||
),
|
||||
);
|
||||
} catch (e) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text('Erreur: Mot de passe actuel incorrect'),
|
||||
backgroundColor: Colors.red,
|
||||
),
|
||||
_errorService.showError(
|
||||
message: 'Erreur: Mot de passe actuel incorrect',
|
||||
);
|
||||
}
|
||||
},
|
||||
@@ -317,11 +317,8 @@ class ProfileContent extends StatelessWidget {
|
||||
(route) => false,
|
||||
);
|
||||
} catch (e) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text('Erreur: Mot de passe incorrect'),
|
||||
backgroundColor: Colors.red,
|
||||
),
|
||||
_errorService.showError(
|
||||
message: 'Erreur: Mot de passe incorrect',
|
||||
);
|
||||
}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user