feat: add remote pull and push
This commit is contained in:
@@ -2,9 +2,16 @@ import 'package:flutter/material.dart';
|
||||
|
||||
class AppLifecycleLockObserver extends WidgetsBindingObserver {
|
||||
final VoidCallback onLock;
|
||||
final VoidCallback? onBackground;
|
||||
final VoidCallback? onForeground;
|
||||
final bool Function()? shouldLock;
|
||||
|
||||
AppLifecycleLockObserver({required this.onLock, this.shouldLock});
|
||||
AppLifecycleLockObserver({
|
||||
required this.onLock,
|
||||
this.onBackground,
|
||||
this.onForeground,
|
||||
this.shouldLock,
|
||||
});
|
||||
|
||||
@override
|
||||
void didChangeAppLifecycleState(AppLifecycleState state) {
|
||||
@@ -14,8 +21,9 @@ class AppLifecycleLockObserver extends WidgetsBindingObserver {
|
||||
case AppLifecycleState.paused:
|
||||
case AppLifecycleState.detached:
|
||||
if (shouldLock?.call() ?? true) onLock();
|
||||
onBackground?.call();
|
||||
case AppLifecycleState.resumed:
|
||||
break;
|
||||
onForeground?.call();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user