flutter_screen_lock icon indicating copy to clipboard operation
flutter_screen_lock copied to clipboard

Can we close the screen lock when native back action is performed ?

Open rajenderK7 opened this issue 3 years ago • 1 comments

I want to close the screen lock overlay when I perform the native back gesture or the back button. Is there already a way to do it ?

rajenderK7 avatar Feb 20 '23 15:02 rajenderK7

https://github.com/naoki0719/flutter_screen_lock/blob/master/lib/src/functions.dart In the screenLock function, I have a WillPopScopeWidget that sets a condition that I cannot return to. I think that this can be solved by building the ScreenLockWidget directly.

naoki0719 avatar Feb 24 '23 05:02 naoki0719

yes you can use WillPopScope Wrap widget to ScreenLock Function

return WillPopScope( onWillPop: () async => false, child: ScreenLock( correctString: 1234, // onCancelled: Navigator.of(context).pop, onUnlocked: Navigator.of(context).pop,

            ),
          );

kishanflutter avatar May 10 '24 12:05 kishanflutter