feat: integrate ErrorService for consistent error display and standardize bloc error messages.
This commit is contained in:
@@ -3,6 +3,7 @@ import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import '../blocs/auth/auth_bloc.dart';
|
||||
import '../blocs/auth/auth_event.dart';
|
||||
import '../blocs/auth/auth_state.dart';
|
||||
import '../services/error_service.dart';
|
||||
|
||||
class ForgotPasswordPage extends StatefulWidget {
|
||||
const ForgotPasswordPage({super.key});
|
||||
@@ -56,20 +57,13 @@ class _ForgotPasswordPageState extends State<ForgotPasswordPage> {
|
||||
body: BlocListener<AuthBloc, AuthState>(
|
||||
listener: (context, state) {
|
||||
if (state is AuthPasswordResetSent) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text('Email de réinitialisation envoyé !'),
|
||||
backgroundColor: Colors.green,
|
||||
),
|
||||
ErrorService().showSnackbar(
|
||||
message: 'Email de réinitialisation envoyé !',
|
||||
isError: false,
|
||||
);
|
||||
Navigator.pop(context);
|
||||
} else if (state is AuthError) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text(state.message),
|
||||
backgroundColor: Colors.red,
|
||||
),
|
||||
);
|
||||
ErrorService().showError(message: state.message);
|
||||
}
|
||||
},
|
||||
child: SafeArea(
|
||||
|
||||
Reference in New Issue
Block a user