2023-08-24 14:25:55 +08:00
|
|
|
|
2024-05-14 09:32:06 +08:00
|
|
|
import 'dart:math';
|
|
|
|
|
|
2023-08-24 14:25:55 +08:00
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
import 'package:get/get.dart';
|
2025-02-24 17:02:38 +08:00
|
|
|
import 'package:star_lock/main/lockDetail/lockSet/lockSet/lockSetInfo_entity.dart';
|
2023-08-24 14:25:55 +08:00
|
|
|
|
|
|
|
|
import '../../../blue/blue_manage.dart';
|
|
|
|
|
|
|
|
|
|
class SaveLockState {
|
2024-06-05 09:30:04 +08:00
|
|
|
|
|
|
|
|
SaveLockState() {
|
|
|
|
|
aliName.value = BlueManage().connectDeviceName;
|
|
|
|
|
aliNameController.text = aliName.value;
|
|
|
|
|
adminPassword = getAdminPassword();
|
|
|
|
|
|
|
|
|
|
final Map map = Get.arguments;
|
2025-05-06 15:05:22 +08:00
|
|
|
if (map['pwdTimestamp']!= null) {
|
2024-06-05 09:30:04 +08:00
|
|
|
pwdTimestamp.value = map['pwdTimestamp'];
|
2025-05-06 15:05:22 +08:00
|
|
|
}
|
2025-05-06 19:32:13 +08:00
|
|
|
// if (map['addressInfo'] != null) {
|
|
|
|
|
// addressInfo.value = map['addressInfo'];
|
|
|
|
|
// }
|
2025-05-06 15:05:22 +08:00
|
|
|
if (map['lockInfo'] != null) {
|
2024-06-05 09:30:04 +08:00
|
|
|
lockInfo = map['lockInfo'];
|
2025-05-06 15:05:22 +08:00
|
|
|
}
|
|
|
|
|
if (map['featureValue'] != null) {
|
2024-06-05 09:30:04 +08:00
|
|
|
featureValue = map['featureValue'];
|
2025-05-06 15:05:22 +08:00
|
|
|
}
|
|
|
|
|
if (map['featureSettingValue'] != null) {
|
2024-06-05 09:30:04 +08:00
|
|
|
featureSettingValue = map['featureSettingValue'];
|
2025-05-06 15:05:22 +08:00
|
|
|
}
|
|
|
|
|
if (map['featureSettingParams'] != null) {
|
2024-06-05 09:30:04 +08:00
|
|
|
featureSettingParams = map['featureSettingParams'];
|
2025-05-06 15:05:22 +08:00
|
|
|
}
|
2025-05-06 19:32:13 +08:00
|
|
|
// if (map['isFromMap'] != null) {
|
|
|
|
|
// isFromMap = map['isFromMap'];
|
|
|
|
|
// }
|
2024-06-05 09:30:04 +08:00
|
|
|
}
|
|
|
|
|
RxString aliName = ''.obs;
|
|
|
|
|
RxInt pwdTimestamp = 0.obs;
|
2025-05-06 19:32:13 +08:00
|
|
|
// RxMap addressInfo = {}.obs;
|
2025-02-24 17:02:38 +08:00
|
|
|
final Rx<LockSetInfoData> lockSetInfoData = LockSetInfoData().obs;
|
2023-08-24 14:25:55 +08:00
|
|
|
TextEditingController aliNameController = TextEditingController();
|
2024-05-13 14:08:21 +08:00
|
|
|
FocusNode focusNode = FocusNode();
|
2023-08-24 14:25:55 +08:00
|
|
|
|
2024-06-05 09:30:04 +08:00
|
|
|
int lockUserNo = 0;
|
|
|
|
|
Map lockInfo = {};
|
|
|
|
|
String featureValue = '';
|
|
|
|
|
String featureSettingValue = '';
|
|
|
|
|
List featureSettingParams = [];
|
2025-05-06 19:32:13 +08:00
|
|
|
// int isFromMap = 0; // 0:不是从地图界面进入 1:从地图界面进入
|
2023-11-01 17:28:59 +08:00
|
|
|
|
2024-06-05 09:30:04 +08:00
|
|
|
RxBool ifCurrentScreen = true.obs; // 是否是当前界面,用于判断是否需要针对当前界面进行展示
|
|
|
|
|
RxInt sureBtnState = 0.obs; // 0可点击 1 不可点击
|
2024-01-06 16:26:13 +08:00
|
|
|
|
2024-01-18 11:25:56 +08:00
|
|
|
// 管理员密码
|
2024-06-05 09:30:04 +08:00
|
|
|
TextEditingController adminPasswordTF = TextEditingController();
|
2024-05-13 14:08:21 +08:00
|
|
|
|
2024-06-05 09:30:04 +08:00
|
|
|
String adminPassword = '';
|
|
|
|
|
int lockId = 0;
|
2023-08-24 14:25:55 +08:00
|
|
|
|
|
|
|
|
void onClose() {
|
|
|
|
|
aliNameController.dispose();
|
|
|
|
|
}
|
2024-05-14 09:32:06 +08:00
|
|
|
|
|
|
|
|
String getAdminPassword(){
|
2024-06-05 09:30:04 +08:00
|
|
|
final Random rng = Random();
|
|
|
|
|
final int number = rng.nextInt(900000) + 100000; // 生成 100000 到 999999 之间的随机整数
|
2024-05-14 09:32:06 +08:00
|
|
|
return number.toString();
|
|
|
|
|
}
|
2024-05-13 14:08:21 +08:00
|
|
|
}
|
2024-05-14 09:38:01 +08:00
|
|
|
|