Description
In login_page.dart, the navigation logic successfully routes the user to the DashBoardTabletView upon authentication. However, it utilizes Navigator.of(context).push() instead of a replacement method.
Because .push() simply layers the new route on top of the existing one, the LoginPage remains active in the navigation stack. If an authenticated user presses the Android hardware Back button from the Dashboard, they are incorrectly routed back to the Login screen, breaking the session UX and creating an illogical app flow.
Steps to Reproduce
- Launch the application and navigate to the Login screen.
- Authenticate successfully to reach the Dashboard.
- Press the physical hardware Back button on the Android device/emulator.
- Observe that the app routes back to the Login screen instead of exiting the app or acting on the Dashboard's back-press logic.
Expected Behavior
Once a user authenticates and navigates to the core application (Dashboard), the Login screen should be completely removed from the navigation stack. Pressing the Back button from the root Dashboard should either prompt the user to exit the app or do nothing, but it should never return to the Login screen.
Environment
- Target File:
lib/ui/login_page.dart
Proposed Solution
Replace the Navigator.of(context).push(...) call with Navigator.of(context).pushReplacement(...) (or pushAndRemoveUntil if there are multiple pre-login routes) to ensure the authentication screens are destroyed upon successful login.
Description
In
login_page.dart, the navigation logic successfully routes the user to theDashBoardTabletViewupon authentication. However, it utilizesNavigator.of(context).push()instead of a replacement method.Because
.push()simply layers the new route on top of the existing one, theLoginPageremains active in the navigation stack. If an authenticated user presses the Android hardware Back button from the Dashboard, they are incorrectly routed back to the Login screen, breaking the session UX and creating an illogical app flow.Steps to Reproduce
Expected Behavior
Once a user authenticates and navigates to the core application (Dashboard), the Login screen should be completely removed from the navigation stack. Pressing the Back button from the root Dashboard should either prompt the user to exit the app or do nothing, but it should never return to the Login screen.
Environment
lib/ui/login_page.dartProposed Solution
Replace the
Navigator.of(context).push(...)call withNavigator.of(context).pushReplacement(...)(orpushAndRemoveUntilif there are multiple pre-login routes) to ensure the authentication screens are destroyed upon successful login.