fix: Unable to use file picker with applock

This commit is contained in:
krille-chan 2023-10-07 10:36:56 +02:00
commit 9c1c5a4aec
No known key found for this signature in database
8 changed files with 69 additions and 32 deletions

View file

@ -28,10 +28,12 @@ class AppLockWidget extends StatefulWidget {
class AppLock extends State<AppLockWidget> with WidgetsBindingObserver {
String? _pincode;
bool _isLocked = false;
bool _paused = false;
bool get isActive =>
_pincode != null &&
int.tryParse(_pincode!) != null &&
_pincode!.length == 4;
_pincode!.length == 4 &&
!_paused;
@override
void initState() {
@ -86,6 +88,15 @@ class AppLock extends State<AppLockWidget> with WidgetsBindingObserver {
_isLocked = true;
});
Future<T> pauseWhile<T>(Future<T> future) async {
_paused = true;
try {
return await future;
} finally {
_paused = false;
}
}
static AppLock of(BuildContext context) => Provider.of<AppLock>(
context,
listen: false,