2024-11-06 09:28:18 +08:00

69 lines
2.5 KiB
Dart
Executable File

import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:star_lock/app_settings/app_colors.dart';
import 'package:star_lock/main/lockDetail/lockSet/lockSet/lockSetInfo_entity.dart';
class FaceUnlockState {
FaceUnlockState() {
Map map = Get.arguments;
if (map['lockSetInfoData'] != null) {
lockSetInfoData.value = map['lockSetInfoData'];
faceOn.value = lockSetInfoData.value.lockSettingInfo!.faceSwitch != 0;
// autoBright.value = lockSetInfoData.value.lockSettingInfo!.faceAutoLightScreen != 0;
switch (lockSetInfoData.value.lockSettingInfo!.faceInductionDistance!) {
case 1:
senseDistance.value = '近距离'.tr;
break;
case 2:
senseDistance.value = '中距离'.tr;
break;
case 3:
senseDistance.value = '远距离'.tr;
break;
case 0:
senseDistance.value = '关闭'.tr;
break;
}
antiMisoperation.value =
lockSetInfoData.value.lockSettingInfo!.faceEnErrUnlock!;
}
for (int i = 0; i < 31; i++) {
antiMisoperationStrList.add(i.toString() + ''.tr);
}
}
Rx<LockSetInfoData> lockSetInfoData = LockSetInfoData().obs;
// RxBool isCheck = false.obs;
RxBool faceOn = false.obs; //面容开锁
// RxBool autoBright = false.obs; //自动亮屏
RxString senseDistance = '远距离'.tr.obs; //感应距离
RxInt antiMisoperation = 0.obs; //防误开
RxList<String> senseDistanceList =
<String>['远距离'.tr, '中距离'.tr, '近距离'.tr, '关闭'.tr].obs;
// RxList<int> antiMisoperationList = <int>[0, 5, 10, 15, 30, 60].obs;
RxList<String> antiMisoperationStrList = <String>[].obs;
// TextEditingController antiMisoperationStrController = TextEditingController();
//高亮样式
final TextStyle titleStyle = TextStyle(
color: Colors.black, fontSize: 24.sp, fontWeight: FontWeight.w500);
//默认样式
final TextStyle subTipsStyle =
TextStyle(color: AppColors.placeholderTextColor, fontSize: 22.sp);
late InlineSpan tipsPreviewSpan = TextSpan(children: <InlineSpan>[
TextSpan(text: '${"添加和使用面容开锁时".tr}:\n', style: titleStyle),
TextSpan(text: '添加和使用面容开锁时提示'.tr, style: subTipsStyle),
]);
RxBool ifCurrentScreen = true.obs; // 是否是当前界面,用于判断是否需要针对当前界面进行展示
RxInt sureBtnState = 0.obs;
RxInt setType = 0.obs; // 0面容开锁 1感应距离 2防误开
}