admin管理员组

文章数量:1404923

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.

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),
      // ),

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.

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)

I cannot release this version where the back button closes the app unexpectedly. Is there any fix or workaround for this situation?

本文标签: