fix: Unable to use file picker with applock
This commit is contained in:
parent
bed7e34a36
commit
9c1c5a4aec
8 changed files with 69 additions and 32 deletions
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue