Skip to content

After implementing AppLock, the device back button closes the app instead of returning to the previous screen (Android) #35

@joelrose2

Description

@joelrose2

Describe the bug
Before implementing flutter_app_lock, the device back button would always return to the previous screen (the one from which it was pushed). With flutter_app_lock, the device back button will close the app entirely (Android) instead, if the second screen called and dismissed any dialog box.

To Reproduce

I have established with certainty that this behavior is due to the addition of flutter_app_lock to the app, because when I simply comment-out the following lines and run the app, the back button behaves as expected.

MaterialApp(
...
      // builder: (context, child) => AppLock(
      //   builder: (context, arg) => child!,
      //   lockScreenBuilder: (context) => LockScreen(),
      //   initiallyEnabled: (currentAppLockMode > 0), // 0 = no lock, 1 = PIN, 2 = biometrics
      //   initialBackgroundLockLatency: const Duration(seconds: 5),
      // ),

Expected behavior
Even if the user opens and closes a dialog in a screen, after the dialog is closed, the screen's own pop() should return to the previous route in the stack and not hide the entire app.

Additional context (optional)
I am developing using:
[√] Flutter (Channel stable, 3.29.1, on Microsoft Windows [Version 10.0.26100.3194], locale en-US)
[√] Windows Version (11 Pro 64-bit, 24H2, 2009)
[√] Android toolchain - develop for Android devices (Android SDK version 35.0.0)
[√] Android Studio (version 2024.3)
[√] VS Code, 64-bit edition (version 1.97.2)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions