feat:核销放大
feat:锁屏页面 feat:饭卡自动查询预约
This commit is contained in:
1 parent
0b287b0364
commit
bdc33b822f
17 files changed
+1061
-89
No files matched your search
@@ -0,0 +1,43 @@
|
||||
import 'package:get/get.dart';
|
||||
|
||||
/// 执行一次终端唤醒身份校验,返回是否允许解除睡眠遮罩。
|
||||
typedef TerminalWakeVerifier = Future<bool> Function();
|
||||
|
||||
/// 管理主屏睡眠遮罩及唤醒验证的应用级状态。
|
||||
///
|
||||
/// 睡眠仅阻止主屏查看和触摸,不切换路由、不销毁页面 Controller,也不暂停串口、
|
||||
/// 人脸、网络请求或副屏通信。状态仅保存在当前进程,设备重新启动后不自动进入睡眠。
|
||||
class TerminalSleepControl extends GetxController {
|
||||
/// 创建一份默认处于唤醒状态的主屏睡眠控制器。
|
||||
TerminalSleepControl();
|
||||
|
||||
/// 主屏是否正在展示全屏睡眠遮罩。
|
||||
final isSleeping = false.obs;
|
||||
|
||||
/// 是否已有唤醒密码校验正在进行,防止快速点击叠加多个密码弹窗。
|
||||
bool _wakeVerificationInProgress = false;
|
||||
|
||||
/// 立即进入睡眠状态;重复调用保持幂等且不影响当前业务页面生命周期。
|
||||
void enterSleep() {
|
||||
if (!isSleeping.value) isSleeping.value = true;
|
||||
}
|
||||
|
||||
/// 通过调用方提供的密码校验请求唤醒主屏。
|
||||
///
|
||||
/// 校验取消、失败或重复提交时继续保持睡眠;校验过程抛出的异常会向上返回,
|
||||
/// 由界面层统一记录并提示,同时保证下一次唤醒仍可重新发起。
|
||||
Future<bool> requestWake(TerminalWakeVerifier verifier) async {
|
||||
if (!isSleeping.value) return true;
|
||||
if (_wakeVerificationInProgress) return false;
|
||||
|
||||
_wakeVerificationInProgress = true;
|
||||
try {
|
||||
final verified = await verifier();
|
||||
if (!verified) return false;
|
||||
isSleeping.value = false;
|
||||
return true;
|
||||
} finally {
|
||||
_wakeVerificationInProgress = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user