feat: clear navigation stack after successful authentication in login and signup flows

This commit is contained in:
Van Leemput Dayron
2025-12-30 15:53:53 +01:00
parent 3036eec3af
commit bb5a89a06d
2 changed files with 10 additions and 2 deletions

View File

@@ -88,7 +88,11 @@ class _LoginPageState extends State<LoginPage> {
body: BlocConsumer<AuthBloc, AuthState>( body: BlocConsumer<AuthBloc, AuthState>(
listener: (context, state) { listener: (context, state) {
if (state is AuthAuthenticated) { if (state is AuthAuthenticated) {
Navigator.pushReplacementNamed(context, '/home'); Navigator.pushNamedAndRemoveUntil(
context,
'/home',
(route) => false,
);
} else if (state is AuthError) { } else if (state is AuthError) {
ErrorService().showError(message: state.message); ErrorService().showError(message: state.message);
} }

View File

@@ -128,7 +128,11 @@ class _SignUpPageState extends State<SignUpPage> {
backgroundColor: Colors.green, backgroundColor: Colors.green,
), ),
); );
Navigator.pushReplacementNamed(context, '/home'); Navigator.pushNamedAndRemoveUntil(
context,
'/home',
(route) => false,
);
} else if (state is AuthError) { } else if (state is AuthError) {
_errorService.showError(message: state.message); _errorService.showError(message: state.message);
} }