fix:修复 event
This commit is contained in:
parent
11c90ca414
commit
3da93adfb5
@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
|
||||||
import 'package:flutter/scheduler.dart';
|
import 'package:flutter/scheduler.dart';
|
||||||
@ -7,6 +6,8 @@ import 'package:get/get.dart';
|
|||||||
import 'package:intl/intl.dart';
|
import 'package:intl/intl.dart';
|
||||||
import 'package:permission_handler/permission_handler.dart';
|
import 'package:permission_handler/permission_handler.dart';
|
||||||
import 'package:star_lock/common/XSConstantMacro/XSConstantMacro.dart';
|
import 'package:star_lock/common/XSConstantMacro/XSConstantMacro.dart';
|
||||||
|
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyList/entity/ElectronicKeyListEntity.dart';
|
||||||
|
import 'package:star_lock/main/lockDetail/lockSet/lockTime/getServerDatetime_entity.dart';
|
||||||
|
|
||||||
import 'package:star_lock/widget/permission/permission_dialog.dart';
|
import 'package:star_lock/widget/permission/permission_dialog.dart';
|
||||||
|
|
||||||
@ -35,7 +36,7 @@ class LockDetailLogic extends BaseGetXController {
|
|||||||
// 监听设备返回的数据
|
// 监听设备返回的数据
|
||||||
void initReplySubscription() {
|
void initReplySubscription() {
|
||||||
state.replySubscription =
|
state.replySubscription =
|
||||||
EventBusManager().eventBus!.on<Reply>().listen((reply) async {
|
EventBusManager().eventBus!.on<Reply>().listen((Reply reply) async {
|
||||||
// 开门
|
// 开门
|
||||||
if (reply is OpenDoorReply && state.ifCurrentScreen.value == true) {
|
if (reply is OpenDoorReply && state.ifCurrentScreen.value == true) {
|
||||||
_replyOpenLock(reply);
|
_replyOpenLock(reply);
|
||||||
@ -51,7 +52,7 @@ class LockDetailLogic extends BaseGetXController {
|
|||||||
|
|
||||||
// 开门数据解析
|
// 开门数据解析
|
||||||
Future<void> _replyOpenLock(Reply reply) async {
|
Future<void> _replyOpenLock(Reply reply) async {
|
||||||
int status = reply.data[6];
|
final int status = reply.data[6];
|
||||||
|
|
||||||
switch (status) {
|
switch (status) {
|
||||||
case 0x00:
|
case 0x00:
|
||||||
@ -62,19 +63,20 @@ class LockDetailLogic extends BaseGetXController {
|
|||||||
state.iSClosedUnlockSuccessfulPopup.value = true;
|
state.iSClosedUnlockSuccessfulPopup.value = true;
|
||||||
state.closedUnlockSuccessfulTimer?.cancel();
|
state.closedUnlockSuccessfulTimer?.cancel();
|
||||||
// 如果没有点击关闭弹窗,3秒后自动关闭
|
// 如果没有点击关闭弹窗,3秒后自动关闭
|
||||||
state.closedUnlockSuccessfulTimer = Timer.periodic(3.seconds, (timer) {
|
state.closedUnlockSuccessfulTimer =
|
||||||
|
Timer.periodic(3.seconds, (Timer timer) {
|
||||||
state.iSClosedUnlockSuccessfulPopup.value = false;
|
state.iSClosedUnlockSuccessfulPopup.value = false;
|
||||||
timer.cancel();
|
timer.cancel();
|
||||||
eventBus.fire(RefreshLockDetailInfoDataEvent());
|
eventBus.fire(RefreshLockDetailInfoDataEvent());
|
||||||
});
|
});
|
||||||
|
|
||||||
// 电量
|
// 电量
|
||||||
int power = reply.data[7];
|
final int power = reply.data[7];
|
||||||
state.electricQuantity.value = power;
|
state.electricQuantity.value = power;
|
||||||
|
|
||||||
// 备用电量
|
// 备用电量
|
||||||
if (state.keyInfos.value.lockFeature!.isSupportBackupBattery == 1) {
|
if (state.keyInfos.value.lockFeature!.isSupportBackupBattery == 1) {
|
||||||
int powerStandby = reply.data[9];
|
final int powerStandby = reply.data[9];
|
||||||
state.electricQuantityStandby.value = powerStandby;
|
state.electricQuantityStandby.value = powerStandby;
|
||||||
}
|
}
|
||||||
// 更新电量
|
// 更新电量
|
||||||
@ -85,14 +87,17 @@ class LockDetailLogic extends BaseGetXController {
|
|||||||
break;
|
break;
|
||||||
case 0x06:
|
case 0x06:
|
||||||
//无权限
|
//无权限
|
||||||
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
final List<String>? privateKey =
|
||||||
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
await Storage.getStringList(saveBluePrivateKey);
|
||||||
|
final List<int> getPrivateKeyList =
|
||||||
|
changeStringListToIntList(privateKey!);
|
||||||
|
|
||||||
var signKey = await Storage.getStringList(saveBlueSignKey);
|
final List<String>? signKey =
|
||||||
List<int> signKeyDataList = changeStringListToIntList(signKey!);
|
await Storage.getStringList(saveBlueSignKey);
|
||||||
|
final List<int> signKeyDataList = changeStringListToIntList(signKey!);
|
||||||
|
|
||||||
var tokenData = reply.data.sublist(2, 6);
|
final List<int> tokenData = reply.data.sublist(2, 6);
|
||||||
var saveStrList = changeIntListToStringList(tokenData);
|
final List<String> saveStrList = changeIntListToStringList(tokenData);
|
||||||
Storage.setStringList(saveBlueToken, saveStrList);
|
Storage.setStringList(saveBlueToken, saveStrList);
|
||||||
|
|
||||||
IoSenderManage.senderOpenLock(
|
IoSenderManage.senderOpenLock(
|
||||||
@ -110,7 +115,7 @@ class LockDetailLogic extends BaseGetXController {
|
|||||||
case 0x16:
|
case 0x16:
|
||||||
// 正在开锁中...
|
// 正在开锁中...
|
||||||
resetOpenDoorState();
|
resetOpenDoorState();
|
||||||
showToast("正在开锁中...".tr, something: () {
|
showToast('正在开锁中...'.tr, something: () {
|
||||||
cancelBlueConnetctToastTimer();
|
cancelBlueConnetctToastTimer();
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
@ -132,7 +137,7 @@ class LockDetailLogic extends BaseGetXController {
|
|||||||
break;
|
break;
|
||||||
case 0x0a:
|
case 0x0a:
|
||||||
// 钥匙不存在
|
// 钥匙不存在
|
||||||
showToast("钥匙不存在");
|
showToast('钥匙不存在');
|
||||||
resetOpenDoorState();
|
resetOpenDoorState();
|
||||||
|
|
||||||
cancelBlueConnetctToastTimer();
|
cancelBlueConnetctToastTimer();
|
||||||
@ -140,7 +145,7 @@ class LockDetailLogic extends BaseGetXController {
|
|||||||
break;
|
break;
|
||||||
case 0x0c:
|
case 0x0c:
|
||||||
// 钥匙数量已到上限
|
// 钥匙数量已到上限
|
||||||
showToast("钥匙数量已到上限");
|
showToast('钥匙数量已到上限');
|
||||||
resetOpenDoorState();
|
resetOpenDoorState();
|
||||||
|
|
||||||
cancelBlueConnetctToastTimer();
|
cancelBlueConnetctToastTimer();
|
||||||
@ -148,7 +153,7 @@ class LockDetailLogic extends BaseGetXController {
|
|||||||
break;
|
break;
|
||||||
case 0x0e:
|
case 0x0e:
|
||||||
// 钥匙已存在
|
// 钥匙已存在
|
||||||
showToast("钥匙已存在");
|
showToast('钥匙已存在');
|
||||||
resetOpenDoorState();
|
resetOpenDoorState();
|
||||||
|
|
||||||
cancelBlueConnetctToastTimer();
|
cancelBlueConnetctToastTimer();
|
||||||
@ -156,7 +161,7 @@ class LockDetailLogic extends BaseGetXController {
|
|||||||
break;
|
break;
|
||||||
case 0x0f:
|
case 0x0f:
|
||||||
// 用户已存在
|
// 用户已存在
|
||||||
showToast("用户已存在");
|
showToast('用户已存在');
|
||||||
resetOpenDoorState();
|
resetOpenDoorState();
|
||||||
|
|
||||||
cancelBlueConnetctToastTimer();
|
cancelBlueConnetctToastTimer();
|
||||||
@ -164,7 +169,7 @@ class LockDetailLogic extends BaseGetXController {
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
//失败
|
//失败
|
||||||
AppLog.log("开锁失败");
|
AppLog.log('开锁失败');
|
||||||
// state.animationController!.stop();
|
// state.animationController!.stop();
|
||||||
resetOpenDoorState();
|
resetOpenDoorState();
|
||||||
cancelBlueConnetctToastTimer();
|
cancelBlueConnetctToastTimer();
|
||||||
@ -183,11 +188,11 @@ class LockDetailLogic extends BaseGetXController {
|
|||||||
|
|
||||||
// 根据时间查解析数据
|
// 根据时间查解析数据
|
||||||
Future<void> _replyReferEventRecordTime(Reply reply) async {
|
Future<void> _replyReferEventRecordTime(Reply reply) async {
|
||||||
int status = reply.data[2];
|
final int status = reply.data[2];
|
||||||
switch (status) {
|
switch (status) {
|
||||||
case 0x00:
|
case 0x00:
|
||||||
//成功
|
//成功
|
||||||
int dataLength = (reply.data[5] << 8) + reply.data[6];
|
final int dataLength = (reply.data[5] << 8) + reply.data[6];
|
||||||
// AppLog.log("dataLength:$dataLength");
|
// AppLog.log("dataLength:$dataLength");
|
||||||
if (dataLength > 0) {
|
if (dataLength > 0) {
|
||||||
reply.data.removeRange(0, 7);
|
reply.data.removeRange(0, 7);
|
||||||
@ -195,32 +200,32 @@ class LockDetailLogic extends BaseGetXController {
|
|||||||
if (reply.data.length < 17) {
|
if (reply.data.length < 17) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var getList = splitList(reply.data, 17);
|
final List<List<int>> getList = splitList(reply.data, 17);
|
||||||
// AppLog.log("getList:$getList");
|
// AppLog.log("getList:$getList");
|
||||||
var uploadList = [];
|
final List uploadList = [];
|
||||||
for (int i = 0; i < getList.length; i++) {
|
for (int i = 0; i < getList.length; i++) {
|
||||||
var indexList = getList[i];
|
final List<int> indexList = getList[i];
|
||||||
// AppLog.log("indexList:$indexList");
|
// AppLog.log("indexList:$indexList");
|
||||||
var indexMap = {};
|
final Map indexMap = {};
|
||||||
indexMap["type"] = indexList[0].toString();
|
indexMap['type'] = indexList[0].toString();
|
||||||
int operateDate = 0;
|
int operateDate = 0;
|
||||||
if (indexList[0] == 2) {
|
if (indexList[0] == 2) {
|
||||||
var passwordData = reply.data.sublist(7, 17);
|
final List<int> passwordData = reply.data.sublist(7, 17);
|
||||||
var password = utf8String(passwordData);
|
final String password = utf8String(passwordData);
|
||||||
indexMap["user"] = password.toString();
|
indexMap['user'] = password.toString();
|
||||||
} else {
|
} else {
|
||||||
int userNo = (indexList[1] * 256) + indexList[2];
|
final int userNo = (indexList[1] * 256) + indexList[2];
|
||||||
indexMap["user"] = userNo.toString();
|
indexMap['user'] = userNo.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
indexMap["success"] = "1";
|
indexMap['success'] = '1';
|
||||||
|
|
||||||
int time = ((0xff & indexList[(3)]) << 24 |
|
final int time = ((0xff & indexList[(3)]) << 24 |
|
||||||
(0xff & indexList[4]) << 16 |
|
(0xff & indexList[4]) << 16 |
|
||||||
(0xff & indexList[5]) << 8 |
|
(0xff & indexList[5]) << 8 |
|
||||||
(0xFF & indexList[6]));
|
(0xFF & indexList[6]));
|
||||||
operateDate = time * 1000;
|
operateDate = time * 1000;
|
||||||
indexMap["date"] = "$operateDate";
|
indexMap['date'] = '$operateDate';
|
||||||
uploadList.add(indexMap);
|
uploadList.add(indexMap);
|
||||||
|
|
||||||
if (i == getList.length - 1) {
|
if (i == getList.length - 1) {
|
||||||
@ -256,14 +261,15 @@ class LockDetailLogic extends BaseGetXController {
|
|||||||
// BlueManage().stopScan();
|
// BlueManage().stopScan();
|
||||||
BlueManage().disconnect();
|
BlueManage().disconnect();
|
||||||
});
|
});
|
||||||
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
final List<String>? privateKey =
|
||||||
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
await Storage.getStringList(saveBluePrivateKey);
|
||||||
|
final List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||||
|
|
||||||
var signKey = await Storage.getStringList(saveBlueSignKey);
|
final List<String>? signKey = await Storage.getStringList(saveBlueSignKey);
|
||||||
List<int> signKeyDataList = changeStringListToIntList(signKey!);
|
final List<int> signKeyDataList = changeStringListToIntList(signKey!);
|
||||||
|
|
||||||
var token = await Storage.getStringList(saveBlueToken);
|
final List<String>? token = await Storage.getStringList(saveBlueToken);
|
||||||
List<int> getTokenList = changeStringListToIntList(token!);
|
final List<int> getTokenList = changeStringListToIntList(token!);
|
||||||
|
|
||||||
BlueManage()
|
BlueManage()
|
||||||
.bludSendData(state.keyInfos.value.bluetooth!.bluetoothDeviceName!,
|
.bludSendData(state.keyInfos.value.bluetooth!.bluetoothDeviceName!,
|
||||||
@ -303,14 +309,18 @@ class LockDetailLogic extends BaseGetXController {
|
|||||||
BlueManage().bludSendData(BlueManage().connectDeviceName,
|
BlueManage().bludSendData(BlueManage().connectDeviceName,
|
||||||
(BluetoothConnectionState connectionState) async {
|
(BluetoothConnectionState connectionState) async {
|
||||||
if (connectionState == BluetoothConnectionState.connected) {
|
if (connectionState == BluetoothConnectionState.connected) {
|
||||||
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
final List<String>? privateKey =
|
||||||
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
await Storage.getStringList(saveBluePrivateKey);
|
||||||
|
final List<int> getPrivateKeyList =
|
||||||
|
changeStringListToIntList(privateKey!);
|
||||||
|
|
||||||
var token = await Storage.getStringList(saveBlueToken);
|
final List<String>? token = await Storage.getStringList(saveBlueToken);
|
||||||
List<int> getTokenList = changeStringListToIntList(token!);
|
final List<int> getTokenList = changeStringListToIntList(token!);
|
||||||
|
|
||||||
var publicKey = await Storage.getStringList(saveBluePublicKey);
|
final List<String>? publicKey =
|
||||||
List<int> getPublicKeyList = changeStringListToIntList(publicKey!);
|
await Storage.getStringList(saveBluePublicKey);
|
||||||
|
final List<int> getPublicKeyList =
|
||||||
|
changeStringListToIntList(publicKey!);
|
||||||
|
|
||||||
IoSenderManage.senderReferEventRecordTimeCommand(
|
IoSenderManage.senderReferEventRecordTimeCommand(
|
||||||
keyID: BlueManage().connectDeviceName,
|
keyID: BlueManage().connectDeviceName,
|
||||||
@ -329,7 +339,8 @@ class LockDetailLogic extends BaseGetXController {
|
|||||||
|
|
||||||
// 从服务器获取锁的时间 开锁时传入
|
// 从服务器获取锁的时间 开锁时传入
|
||||||
void getServerDatetime() async {
|
void getServerDatetime() async {
|
||||||
var entity = await ApiRepository.to.getServerDatetimeData();
|
final GetServerDatetimeEntity entity =
|
||||||
|
await ApiRepository.to.getServerDatetimeData();
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
state.differentialTime = entity.data!.date! ~/ 1000 -
|
state.differentialTime = entity.data!.date! ~/ 1000 -
|
||||||
DateTime.now().millisecondsSinceEpoch ~/ 1000;
|
DateTime.now().millisecondsSinceEpoch ~/ 1000;
|
||||||
@ -344,17 +355,17 @@ class LockDetailLogic extends BaseGetXController {
|
|||||||
|
|
||||||
// 获取手机联网token,根据锁设置里面获取的开锁时是否联网来判断是否调用这个接口
|
// 获取手机联网token,根据锁设置里面获取的开锁时是否联网来判断是否调用这个接口
|
||||||
void getLockNetToken() async {
|
void getLockNetToken() async {
|
||||||
LockNetTokenEntity entity = await ApiRepository.to
|
final LockNetTokenEntity entity = await ApiRepository.to
|
||||||
.getLockNetToken(lockId: state.keyInfos.value.lockId.toString());
|
.getLockNetToken(lockId: state.keyInfos.value.lockId.toString());
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
state.lockNetToken = entity.data!.token!.toString();
|
state.lockNetToken = entity.data!.token!.toString();
|
||||||
AppLog.log("从服务器获取联网token:${state.lockNetToken}");
|
AppLog.log('从服务器获取联网token:${state.lockNetToken}');
|
||||||
openDoorAction();
|
openDoorAction();
|
||||||
} else {
|
} else {
|
||||||
showToast("网络访问失败,请检查网络是否正常".tr, something: () {
|
showToast('网络访问失败,请检查网络是否正常'.tr, something: () {
|
||||||
resetOpenDoorState();
|
resetOpenDoorState();
|
||||||
cancelBlueConnetctToastTimer();
|
cancelBlueConnetctToastTimer();
|
||||||
state.lockNetToken = "0";
|
state.lockNetToken = '0';
|
||||||
openDoorAction();
|
openDoorAction();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -362,7 +373,7 @@ class LockDetailLogic extends BaseGetXController {
|
|||||||
|
|
||||||
//电量更新请求
|
//电量更新请求
|
||||||
Future<void> uploadElectricQuantityRequest() async {
|
Future<void> uploadElectricQuantityRequest() async {
|
||||||
KeyOperationRecordEntity entity = await ApiRepository.to
|
final KeyOperationRecordEntity entity = await ApiRepository.to
|
||||||
.uploadElectricQuantity(
|
.uploadElectricQuantity(
|
||||||
electricQuantity: state.electricQuantity.value.toString(),
|
electricQuantity: state.electricQuantity.value.toString(),
|
||||||
electricQuantityStandby:
|
electricQuantityStandby:
|
||||||
@ -371,15 +382,15 @@ class LockDetailLogic extends BaseGetXController {
|
|||||||
isUnShowLoading: true);
|
isUnShowLoading: true);
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
SchedulerBinding.instance.addPostFrameCallback((_) {
|
SchedulerBinding.instance.addPostFrameCallback((_) {
|
||||||
eventBus.fire(RefreshLockListInfoDataEvent());
|
eventBus.fire(RefreshLockListInfoDataEvent(isUnShowLoading: true));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 查询锁记录最后时间
|
// 查询锁记录最后时间
|
||||||
void getLockRecordLastUploadDataTime() async {
|
void getLockRecordLastUploadDataTime() async {
|
||||||
LockOperatingRecordGetLastRecordTimeEntity entity = await ApiRepository.to
|
final LockOperatingRecordGetLastRecordTimeEntity entity =
|
||||||
.getLockRecordLastUploadDataTime(
|
await ApiRepository.to.getLockRecordLastUploadDataTime(
|
||||||
lockId: state.keyInfos.value.lockId.toString());
|
lockId: state.keyInfos.value.lockId.toString());
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
state.operateDate = entity.data!.operateDate! ~/ 1000;
|
state.operateDate = entity.data!.operateDate! ~/ 1000;
|
||||||
@ -388,14 +399,14 @@ class LockDetailLogic extends BaseGetXController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 操作记录上传
|
// 操作记录上传
|
||||||
void lockRecordUploadData(List list) async {
|
Future<void> lockRecordUploadData(List list) async {
|
||||||
KeyOperationRecordEntity entity = await ApiRepository.to
|
final KeyOperationRecordEntity entity = await ApiRepository.to
|
||||||
.lockRecordUploadData(
|
.lockRecordUploadData(
|
||||||
lockId: state.keyInfos.value.lockId.toString(), records: list);
|
lockId: state.keyInfos.value.lockId.toString(), records: list);
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
// mockNetworkDataRequest();
|
// mockNetworkDataRequest();
|
||||||
AppLog.log(
|
AppLog.log(
|
||||||
"state.keyInfos.value.keyType:${state.keyInfos.value.keyType}");
|
'state.keyInfos.value.keyType:${state.keyInfos.value.keyType}');
|
||||||
if (state.keyInfos.value.keyType == XSConstantMacro.keyTypeOnce) {
|
if (state.keyInfos.value.keyType == XSConstantMacro.keyTypeOnce) {
|
||||||
// 单次删除
|
// 单次删除
|
||||||
deletKeyData();
|
deletKeyData();
|
||||||
@ -405,10 +416,11 @@ class LockDetailLogic extends BaseGetXController {
|
|||||||
|
|
||||||
// 普通用户或者授权管理员删除钥匙
|
// 普通用户或者授权管理员删除钥匙
|
||||||
void deletKeyData() async {
|
void deletKeyData() async {
|
||||||
var entity = await ApiRepository.to.deleteElectronicKey(
|
final ElectronicKeyListEntity entity = await ApiRepository.to
|
||||||
keyId: state.keyInfos.value.keyId.toString(), includeUnderlings: 0);
|
.deleteElectronicKey(
|
||||||
|
keyId: state.keyInfos.value.keyId.toString(), includeUnderlings: 0);
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
BlueManage().connectDeviceMacAddress = "";
|
BlueManage().connectDeviceMacAddress = '';
|
||||||
SchedulerBinding.instance.addPostFrameCallback((_) {
|
SchedulerBinding.instance.addPostFrameCallback((_) {
|
||||||
eventBus.fire(RefreshLockListInfoDataEvent());
|
eventBus.fire(RefreshLockListInfoDataEvent());
|
||||||
});
|
});
|
||||||
@ -422,7 +434,7 @@ class LockDetailLogic extends BaseGetXController {
|
|||||||
state.lockSetOpenOrCloseCheckInRefreshLockDetailWithAttendanceEvent =
|
state.lockSetOpenOrCloseCheckInRefreshLockDetailWithAttendanceEvent =
|
||||||
eventBus
|
eventBus
|
||||||
.on<LockSetChangeSetRefreshLockDetailWithType>()
|
.on<LockSetChangeSetRefreshLockDetailWithType>()
|
||||||
.listen((event) {
|
.listen((LockSetChangeSetRefreshLockDetailWithType event) {
|
||||||
if (event.type == 0) {
|
if (event.type == 0) {
|
||||||
// 0考勤
|
// 0考勤
|
||||||
state.isAttendance.value = int.parse(event.setResult);
|
state.isAttendance.value = int.parse(event.setResult);
|
||||||
@ -433,7 +445,7 @@ class LockDetailLogic extends BaseGetXController {
|
|||||||
state.isOpenLockNeedOnline.value = int.parse(event.setResult);
|
state.isOpenLockNeedOnline.value = int.parse(event.setResult);
|
||||||
state.keyInfos.value.lockSetting!.appUnlockOnline =
|
state.keyInfos.value.lockSetting!.appUnlockOnline =
|
||||||
int.parse(event.setResult);
|
int.parse(event.setResult);
|
||||||
state.lockNetToken = ""; // 改变开锁时是否联网状态的时候清空token
|
state.lockNetToken = ''; // 改变开锁时是否联网状态的时候清空token
|
||||||
} else if (event.type == 2) {
|
} else if (event.type == 2) {
|
||||||
// 2 常开模式
|
// 2 常开模式
|
||||||
state.isOpenPassageMode.value = int.parse(event.setResult);
|
state.isOpenPassageMode.value = int.parse(event.setResult);
|
||||||
@ -458,7 +470,7 @@ class LockDetailLogic extends BaseGetXController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
String getKeyStatusTextAndShow() {
|
String getKeyStatusTextAndShow() {
|
||||||
String text = "";
|
String text = '';
|
||||||
if (state.keyInfos.value.keyStatus ==
|
if (state.keyInfos.value.keyStatus ==
|
||||||
XSConstantMacro.keyStatusWaitIneffective ||
|
XSConstantMacro.keyStatusWaitIneffective ||
|
||||||
state.keyInfos.value.keyStatus == XSConstantMacro.keyStatusFrozen ||
|
state.keyInfos.value.keyStatus == XSConstantMacro.keyStatusFrozen ||
|
||||||
@ -469,7 +481,7 @@ class LockDetailLogic extends BaseGetXController {
|
|||||||
"${"你的钥匙".tr}${XSConstantMacro.getKeyStatusStr(state.keyInfos.value.keyStatus!)}";
|
"${"你的钥匙".tr}${XSConstantMacro.getKeyStatusStr(state.keyInfos.value.keyStatus!)}";
|
||||||
} else {
|
} else {
|
||||||
text = state.isOpenPassageMode.value == 1
|
text = state.isOpenPassageMode.value == 1
|
||||||
? "常开模式启动!长按闭锁".tr
|
? '常开模式启动!长按闭锁'.tr
|
||||||
: TranslationLoader.lanKeys!.clickUnlockAndHoldDownClose!.tr;
|
: TranslationLoader.lanKeys!.clickUnlockAndHoldDownClose!.tr;
|
||||||
}
|
}
|
||||||
return text;
|
return text;
|
||||||
@ -477,9 +489,9 @@ class LockDetailLogic extends BaseGetXController {
|
|||||||
|
|
||||||
String getCurrentFormattedTime() {
|
String getCurrentFormattedTime() {
|
||||||
// 获取当前时间
|
// 获取当前时间
|
||||||
DateTime now = DateTime.now();
|
final DateTime now = DateTime.now();
|
||||||
// 格式化日期和时间
|
// 格式化日期和时间
|
||||||
String formattedTime = DateFormat('MM/dd HH:mm').format(now);
|
final String formattedTime = DateFormat('MM/dd HH:mm').format(now);
|
||||||
return formattedTime;
|
return formattedTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -8,6 +8,7 @@ import 'package:intl/intl.dart';
|
|||||||
import 'package:star_lock/app_settings/app_colors.dart';
|
import 'package:star_lock/app_settings/app_colors.dart';
|
||||||
import 'package:star_lock/flavors.dart';
|
import 'package:star_lock/flavors.dart';
|
||||||
import 'package:star_lock/main/lockDetail/lockDetail/lockDetail_list_page.dart';
|
import 'package:star_lock/main/lockDetail/lockDetail/lockDetail_list_page.dart';
|
||||||
|
import 'package:star_lock/main/lockDetail/lockDetail/lockDetail_state.dart';
|
||||||
import 'package:star_lock/tools/aliyunRealNameAuth/aliyunRealNameAuthHandle.dart';
|
import 'package:star_lock/tools/aliyunRealNameAuth/aliyunRealNameAuthHandle.dart';
|
||||||
import 'package:star_lock/tools/showCupertinoAlertView.dart';
|
import 'package:star_lock/tools/showCupertinoAlertView.dart';
|
||||||
import 'package:star_lock/tools/showTipView.dart';
|
import 'package:star_lock/tools/showTipView.dart';
|
||||||
@ -44,8 +45,8 @@ class LockDetailPage extends StatefulWidget {
|
|||||||
class _LockDetailPageState extends State<LockDetailPage>
|
class _LockDetailPageState extends State<LockDetailPage>
|
||||||
with TickerProviderStateMixin, RouteAware {
|
with TickerProviderStateMixin, RouteAware {
|
||||||
// with RouteAware
|
// with RouteAware
|
||||||
final logic = Get.put(LockDetailLogic());
|
final LockDetailLogic logic = Get.put(LockDetailLogic());
|
||||||
final state = Get.find<LockDetailLogic>().state;
|
final LockDetailState state = Get.find<LockDetailLogic>().state;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
@ -75,8 +76,9 @@ class _LockDetailPageState extends State<LockDetailPage>
|
|||||||
|
|
||||||
void _initRefreshLockDetailInfoDataEventAction() {
|
void _initRefreshLockDetailInfoDataEventAction() {
|
||||||
// 蓝牙协议通知传输跟蓝牙之外的数据传输类不一样 eventBus
|
// 蓝牙协议通知传输跟蓝牙之外的数据传输类不一样 eventBus
|
||||||
_lockRefreshLockDetailInfoDataEvent =
|
_lockRefreshLockDetailInfoDataEvent = eventBus
|
||||||
eventBus.on<RefreshLockDetailInfoDataEvent>().listen((event) {
|
.on<RefreshLockDetailInfoDataEvent>()
|
||||||
|
.listen((RefreshLockDetailInfoDataEvent event) {
|
||||||
setState(() {});
|
setState(() {});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -114,26 +116,28 @@ class _LockDetailPageState extends State<LockDetailPage>
|
|||||||
BlueManage().connectDeviceName =
|
BlueManage().connectDeviceName =
|
||||||
state.keyInfos.value.bluetooth!.bluetoothDeviceName!;
|
state.keyInfos.value.bluetooth!.bluetoothDeviceName!;
|
||||||
|
|
||||||
List<int> publicKeyData =
|
final List<int> publicKeyData =
|
||||||
state.keyInfos.value.bluetooth!.publicKey!.cast<int>();
|
state.keyInfos.value.bluetooth!.publicKey!.cast<int>();
|
||||||
var saveStrList = changeIntListToStringList(publicKeyData);
|
final List<String> saveStrList = changeIntListToStringList(publicKeyData);
|
||||||
Storage.setStringList(saveBluePublicKey, saveStrList);
|
Storage.setStringList(saveBluePublicKey, saveStrList);
|
||||||
|
|
||||||
// 私钥
|
// 私钥
|
||||||
List<int> privateKeyData =
|
final List<int> privateKeyData =
|
||||||
state.keyInfos.value.bluetooth!.privateKey!.cast<int>();
|
state.keyInfos.value.bluetooth!.privateKey!.cast<int>();
|
||||||
var savePrivateKeyList = changeIntListToStringList(privateKeyData);
|
final List<String> savePrivateKeyList =
|
||||||
|
changeIntListToStringList(privateKeyData);
|
||||||
Storage.setStringList(saveBluePrivateKey, savePrivateKeyList);
|
Storage.setStringList(saveBluePrivateKey, savePrivateKeyList);
|
||||||
|
|
||||||
// signKey
|
// signKey
|
||||||
List<int> signKeyData =
|
final List<int> signKeyData =
|
||||||
state.keyInfos.value.bluetooth!.signKey!.cast<int>();
|
state.keyInfos.value.bluetooth!.signKey!.cast<int>();
|
||||||
var saveSignKeyList = changeIntListToStringList(signKeyData);
|
final List<String> saveSignKeyList = changeIntListToStringList(signKeyData);
|
||||||
Storage.setStringList(saveBlueSignKey, saveSignKeyList);
|
Storage.setStringList(saveBlueSignKey, saveSignKeyList);
|
||||||
|
|
||||||
bool ifHaveKey = await Storage.ifHaveKey(saveBlueToken);
|
final bool ifHaveKey = await Storage.ifHaveKey(saveBlueToken);
|
||||||
if (!ifHaveKey) {
|
if (!ifHaveKey) {
|
||||||
var saveTokenList = changeIntListToStringList([0, 0, 0, 0]);
|
final List<String> saveTokenList =
|
||||||
|
changeIntListToStringList(<int>[0, 0, 0, 0]);
|
||||||
Storage.setStringList(saveBlueToken, saveTokenList);
|
Storage.setStringList(saveBlueToken, saveTokenList);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -141,7 +145,7 @@ class _LockDetailPageState extends State<LockDetailPage>
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
loadData();
|
loadData();
|
||||||
return F.sw(defaultCall: () => skWidget(), xhjCall: () => xhjWidget());
|
return F.sw(defaultCall: skWidget, xhjCall: xhjWidget);
|
||||||
}
|
}
|
||||||
|
|
||||||
//鑫泓佳布局
|
//鑫泓佳布局
|
||||||
@ -150,9 +154,9 @@ class _LockDetailPageState extends State<LockDetailPage>
|
|||||||
backgroundColor: Colors.white,
|
backgroundColor: Colors.white,
|
||||||
body: Obx(() {
|
body: Obx(() {
|
||||||
return Stack(
|
return Stack(
|
||||||
children: [
|
children: <Widget>[
|
||||||
Column(
|
Column(
|
||||||
children: [
|
children: <Widget>[
|
||||||
SizedBox(
|
SizedBox(
|
||||||
height: 35.h,
|
height: 35.h,
|
||||||
),
|
),
|
||||||
@ -193,7 +197,7 @@ class _LockDetailPageState extends State<LockDetailPage>
|
|||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
borderRadius: BorderRadius.circular(16.r),
|
borderRadius: BorderRadius.circular(16.r),
|
||||||
boxShadow: [
|
boxShadow: <BoxShadow>[
|
||||||
BoxShadow(
|
BoxShadow(
|
||||||
color: Colors.black.withOpacity(0.15),
|
color: Colors.black.withOpacity(0.15),
|
||||||
offset: const Offset(0, 0),
|
offset: const Offset(0, 0),
|
||||||
@ -202,7 +206,7 @@ class _LockDetailPageState extends State<LockDetailPage>
|
|||||||
),
|
),
|
||||||
]),
|
]),
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: <Widget>[
|
||||||
Image.asset(
|
Image.asset(
|
||||||
img,
|
img,
|
||||||
width: 32.r,
|
width: 32.r,
|
||||||
@ -236,7 +240,7 @@ class _LockDetailPageState extends State<LockDetailPage>
|
|||||||
fit: BoxFit.cover,
|
fit: BoxFit.cover,
|
||||||
),
|
),
|
||||||
borderRadius: BorderRadius.circular(20.r),
|
borderRadius: BorderRadius.circular(20.r),
|
||||||
boxShadow: [
|
boxShadow: <BoxShadow>[
|
||||||
BoxShadow(
|
BoxShadow(
|
||||||
color: Colors.black.withOpacity(0.15),
|
color: Colors.black.withOpacity(0.15),
|
||||||
offset: const Offset(0, 0),
|
offset: const Offset(0, 0),
|
||||||
@ -247,19 +251,15 @@ class _LockDetailPageState extends State<LockDetailPage>
|
|||||||
),
|
),
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: <Widget>[
|
||||||
const Spacer(),
|
const Spacer(),
|
||||||
GestureDetector(
|
GestureDetector(
|
||||||
onTap: state.openDoorBtnisUneable.value == true
|
onTap: state.openDoorBtnisUneable.value == true
|
||||||
? () {
|
? isNeedRealNameAuthThenOpenLock
|
||||||
isNeedRealNameAuthThenOpenLock();
|
|
||||||
}
|
|
||||||
: null,
|
: null,
|
||||||
onLongPressStart: state.openDoorBtnisUneable.value == true
|
onLongPressStart: state.openDoorBtnisUneable.value == true
|
||||||
? (details) {
|
? (LongPressStartDetails details) {
|
||||||
setState(() {
|
setState(startUnLock);
|
||||||
startUnLock();
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
: null,
|
: null,
|
||||||
child: Container(
|
child: Container(
|
||||||
@ -268,7 +268,7 @@ class _LockDetailPageState extends State<LockDetailPage>
|
|||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
borderRadius: BorderRadius.circular(100.w),
|
borderRadius: BorderRadius.circular(100.w),
|
||||||
boxShadow: [
|
boxShadow: <BoxShadow>[
|
||||||
BoxShadow(
|
BoxShadow(
|
||||||
color: Colors.black.withOpacity(0.3),
|
color: Colors.black.withOpacity(0.3),
|
||||||
offset: const Offset(0, 0),
|
offset: const Offset(0, 0),
|
||||||
@ -279,42 +279,44 @@ class _LockDetailPageState extends State<LockDetailPage>
|
|||||||
margin: EdgeInsets.only(left: 35.w, bottom: 15.h),
|
margin: EdgeInsets.only(left: 35.w, bottom: 15.h),
|
||||||
child: Stack(
|
child: Stack(
|
||||||
alignment: AlignmentDirectional.center,
|
alignment: AlignmentDirectional.center,
|
||||||
children: [
|
children: <Widget>[
|
||||||
state.openDoorBtnisUneable.value == false
|
if (state.openDoorBtnisUneable.value == false)
|
||||||
? Icon(
|
Icon(
|
||||||
Icons.bluetooth_searching,
|
Icons.bluetooth_searching,
|
||||||
size: 48.r,
|
size: 48.r,
|
||||||
color: AppColors.mainColor,
|
color: AppColors.mainColor,
|
||||||
)
|
)
|
||||||
: Image.asset(
|
else
|
||||||
state.isOpenPassageMode.value == 1
|
Image.asset(
|
||||||
? 'images/icon_lock_err.png'
|
state.isOpenPassageMode.value == 1
|
||||||
: 'images/icon_lock_fill.png',
|
? 'images/icon_lock_err.png'
|
||||||
width: 38.r,
|
: 'images/icon_lock_fill.png',
|
||||||
height: 38.r,
|
width: 38.r,
|
||||||
color: AppColors.mainColor,
|
height: 38.r,
|
||||||
),
|
color: AppColors.mainColor,
|
||||||
state.openDoorBtnisUneable.value == false
|
),
|
||||||
? Positioned(
|
if (state.openDoorBtnisUneable.value == false)
|
||||||
child: Icon(
|
Positioned(
|
||||||
Icons.bluetooth_searching,
|
child: Icon(
|
||||||
size: 96.r,
|
Icons.bluetooth_searching,
|
||||||
),
|
size: 96.r,
|
||||||
)
|
),
|
||||||
: state.openLockBtnState.value == 1
|
)
|
||||||
? xhjBuildRotationTransition(
|
else
|
||||||
width: 88.r,
|
state.openLockBtnState.value == 1
|
||||||
height: 88.r,
|
? xhjBuildRotationTransition(
|
||||||
)
|
width: 88.r,
|
||||||
: Positioned(
|
height: 88.r,
|
||||||
child: Image.asset(
|
)
|
||||||
'images/icon_circle_dotted.png',
|
: Positioned(
|
||||||
width: 88.r,
|
child: Image.asset(
|
||||||
height: 88.r,
|
'images/icon_circle_dotted.png',
|
||||||
color: state.isOpenPassageMode.value == 1
|
width: 88.r,
|
||||||
? Colors.red
|
height: 88.r,
|
||||||
: AppColors.mainColor,
|
color: state.isOpenPassageMode.value == 1
|
||||||
)),
|
? Colors.red
|
||||||
|
: AppColors.mainColor,
|
||||||
|
)),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -323,10 +325,10 @@ class _LockDetailPageState extends State<LockDetailPage>
|
|||||||
padding: EdgeInsets.only(left: 15.w, right: 00.w, bottom: 15.h),
|
padding: EdgeInsets.only(left: 15.w, right: 00.w, bottom: 15.h),
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
children: [
|
children: <Widget>[
|
||||||
Column(
|
Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: <Widget>[
|
||||||
Text(
|
Text(
|
||||||
TranslationLoader
|
TranslationLoader
|
||||||
.lanKeys!.clickUnlockAndHoldDownClose!.tr,
|
.lanKeys!.clickUnlockAndHoldDownClose!.tr,
|
||||||
@ -341,16 +343,16 @@ class _LockDetailPageState extends State<LockDetailPage>
|
|||||||
Column(
|
Column(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: <Widget>[
|
||||||
Row(
|
Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.end,
|
mainAxisAlignment: MainAxisAlignment.end,
|
||||||
children: [
|
children: <Widget>[
|
||||||
Image.asset(
|
Image.asset(
|
||||||
showElectricIcon(state.electricQuantity.value),
|
showElectricIcon(state.electricQuantity.value),
|
||||||
width: 30.w,
|
width: 30.w,
|
||||||
height: 24.w),
|
height: 24.w),
|
||||||
SizedBox(width: 2.w),
|
SizedBox(width: 2.w),
|
||||||
Text("${state.electricQuantity.value}%",
|
Text('${state.electricQuantity.value}%',
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 18.sp,
|
fontSize: 18.sp,
|
||||||
color: AppColors.darkGrayTextColor)),
|
color: AppColors.darkGrayTextColor)),
|
||||||
@ -368,13 +370,13 @@ class _LockDetailPageState extends State<LockDetailPage>
|
|||||||
),
|
),
|
||||||
Row(
|
Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.end,
|
mainAxisAlignment: MainAxisAlignment.end,
|
||||||
children: [
|
children: <Widget>[
|
||||||
Image.asset(
|
Image.asset(
|
||||||
showElectricIcon(state.electricQuantity.value),
|
showElectricIcon(state.electricQuantity.value),
|
||||||
width: 30.w,
|
width: 30.w,
|
||||||
height: 24.w),
|
height: 24.w),
|
||||||
SizedBox(width: 2.w),
|
SizedBox(width: 2.w),
|
||||||
Text("--%",
|
Text('--%',
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 18.sp,
|
fontSize: 18.sp,
|
||||||
color: AppColors.darkGrayTextColor)),
|
color: AppColors.darkGrayTextColor)),
|
||||||
@ -400,32 +402,30 @@ class _LockDetailPageState extends State<LockDetailPage>
|
|||||||
//斯凯布局
|
//斯凯布局
|
||||||
Widget skWidget() {
|
Widget skWidget() {
|
||||||
return ListView(
|
return ListView(
|
||||||
children: [
|
children: <Widget>[
|
||||||
Visibility(
|
Visibility(
|
||||||
visible:
|
visible:
|
||||||
((state.keyInfos.value.keyType == XSConstantMacro.keyTypeTime ||
|
(state.keyInfos.value.keyType == XSConstantMacro.keyTypeTime ||
|
||||||
state.keyInfos.value.keyType ==
|
state.keyInfos.value.keyType ==
|
||||||
XSConstantMacro.keyTypeLoop) && // 限时、循环
|
XSConstantMacro.keyTypeLoop) && // 限时、循环
|
||||||
(DateTool().compareTimeGetDaysFromNow(
|
(DateTool().compareTimeGetDaysFromNow(
|
||||||
state.keyInfos.value.endDate!) <=
|
state.keyInfos.value.endDate!) <=
|
||||||
15 &&
|
15 &&
|
||||||
DateTool().compareTimeGetDaysFromNow(
|
DateTool().compareTimeGetDaysFromNow(
|
||||||
state.keyInfos.value.endDate!) >=
|
state.keyInfos.value.endDate!) >=
|
||||||
0) && // 0到30天
|
0) && // 0到30天
|
||||||
(state.keyInfos.value.keyStatus ==
|
(state.keyInfos.value.keyStatus ==
|
||||||
XSConstantMacro.keyStatusNormalUse ||
|
XSConstantMacro.keyStatusNormalUse ||
|
||||||
state.keyInfos.value.keyStatus ==
|
state.keyInfos.value.keyStatus ==
|
||||||
XSConstantMacro.keyStatusWaitReceive) // 正常使用、待接收
|
XSConstantMacro.keyStatusWaitReceive) // 正常使用、待接收
|
||||||
)
|
,
|
||||||
? true
|
|
||||||
: false,
|
|
||||||
child: Container(
|
child: Container(
|
||||||
// height: 30.h,
|
// height: 30.h,
|
||||||
color: const Color(0xFFFBEFD4),
|
color: const Color(0xFFFBEFD4),
|
||||||
padding: EdgeInsets.only(top: 8.h, bottom: 8.h),
|
padding: EdgeInsets.only(top: 8.h, bottom: 8.h),
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: [
|
children: <Widget>[
|
||||||
Text(
|
Text(
|
||||||
"${"钥匙将在".tr}${DateTool().compareTimeGetDaysFromNow(state.keyInfos.value.endDate!)}${"天后失效".tr}",
|
"${"钥匙将在".tr}${DateTool().compareTimeGetDaysFromNow(state.keyInfos.value.endDate!)}${"天后失效".tr}",
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
@ -434,26 +434,26 @@ class _LockDetailPageState extends State<LockDetailPage>
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Stack(children: [
|
Stack(children: <Widget>[
|
||||||
Container(
|
Container(
|
||||||
width: 1.sw,
|
width: 1.sw,
|
||||||
height: 1.sh - ScreenUtil().statusBarHeight,
|
height: 1.sh - ScreenUtil().statusBarHeight,
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: <Widget>[
|
||||||
topWidget(),
|
topWidget(),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
height: 10.h,
|
height: 10.h,
|
||||||
),
|
),
|
||||||
Obx(() => buildPageIndicator()),
|
Obx(buildPageIndicator),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Container(
|
child: Container(
|
||||||
margin: EdgeInsets.only(left: 10.w, right: 10.w, top: 30.h),
|
margin: EdgeInsets.only(left: 10.w, right: 10.w, top: 30.h),
|
||||||
child: PageView(
|
child: PageView(
|
||||||
scrollDirection: Axis.horizontal,
|
scrollDirection: Axis.horizontal,
|
||||||
controller: state.pageController,
|
controller: state.pageController,
|
||||||
children: [
|
children: <Widget>[
|
||||||
Obx(() => bottomWidget()),
|
Obx(bottomWidget),
|
||||||
attachmentWidget(),
|
attachmentWidget(),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
@ -476,7 +476,7 @@ class _LockDetailPageState extends State<LockDetailPage>
|
|||||||
|
|
||||||
Widget topWidget() {
|
Widget topWidget() {
|
||||||
return Column(
|
return Column(
|
||||||
children: [
|
children: <Widget>[
|
||||||
F.sw(
|
F.sw(
|
||||||
defaultCall: () => SizedBox(height: 50.h),
|
defaultCall: () => SizedBox(height: 50.h),
|
||||||
xhjCall: () => Padding(
|
xhjCall: () => Padding(
|
||||||
@ -490,7 +490,7 @@ class _LockDetailPageState extends State<LockDetailPage>
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
Stack(
|
Stack(
|
||||||
children: [
|
children: <Widget>[
|
||||||
Center(
|
Center(
|
||||||
child: Text(
|
child: Text(
|
||||||
state.lockAlias.value,
|
state.lockAlias.value,
|
||||||
@ -504,7 +504,7 @@ class _LockDetailPageState extends State<LockDetailPage>
|
|||||||
Positioned(
|
Positioned(
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
children: <Widget>[
|
||||||
GestureDetector(
|
GestureDetector(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
ShowTipView().showSureAlertDialog(
|
ShowTipView().showSureAlertDialog(
|
||||||
@ -512,7 +512,7 @@ class _LockDetailPageState extends State<LockDetailPage>
|
|||||||
},
|
},
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.end,
|
mainAxisAlignment: MainAxisAlignment.end,
|
||||||
children: [
|
children: <Widget>[
|
||||||
FlavorsImg(
|
FlavorsImg(
|
||||||
child: Image.asset(
|
child: Image.asset(
|
||||||
showElectricIcon(state.electricQuantity.value),
|
showElectricIcon(state.electricQuantity.value),
|
||||||
@ -520,7 +520,7 @@ class _LockDetailPageState extends State<LockDetailPage>
|
|||||||
height: 24.w),
|
height: 24.w),
|
||||||
),
|
),
|
||||||
SizedBox(width: 2.w),
|
SizedBox(width: 2.w),
|
||||||
Text("${state.electricQuantity.value}%",
|
Text('${state.electricQuantity.value}%',
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 18.sp,
|
fontSize: 18.sp,
|
||||||
color: AppColors.darkGrayTextColor)),
|
color: AppColors.darkGrayTextColor)),
|
||||||
@ -542,7 +542,7 @@ class _LockDetailPageState extends State<LockDetailPage>
|
|||||||
1,
|
1,
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.end,
|
mainAxisAlignment: MainAxisAlignment.end,
|
||||||
children: [
|
children: <Widget>[
|
||||||
FlavorsImg(
|
FlavorsImg(
|
||||||
child: Image.asset(
|
child: Image.asset(
|
||||||
showElectricIcon(
|
showElectricIcon(
|
||||||
@ -551,7 +551,7 @@ class _LockDetailPageState extends State<LockDetailPage>
|
|||||||
height: 24.w),
|
height: 24.w),
|
||||||
),
|
),
|
||||||
SizedBox(width: 2.w),
|
SizedBox(width: 2.w),
|
||||||
Text("${state.electricQuantityStandby.value}%",
|
Text('${state.electricQuantityStandby.value}%',
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 18.sp,
|
fontSize: 18.sp,
|
||||||
color: AppColors.darkGrayTextColor)),
|
color: AppColors.darkGrayTextColor)),
|
||||||
@ -580,23 +580,19 @@ class _LockDetailPageState extends State<LockDetailPage>
|
|||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
height: 330.w,
|
height: 330.w,
|
||||||
child: Stack(
|
child: Stack(
|
||||||
children: [
|
children: <Widget>[
|
||||||
Center(
|
Center(
|
||||||
child: GestureDetector(
|
child: GestureDetector(
|
||||||
onTap: state.openDoorBtnisUneable.value == true
|
onTap: state.openDoorBtnisUneable.value == true
|
||||||
? () {
|
? isNeedRealNameAuthThenOpenLock
|
||||||
isNeedRealNameAuthThenOpenLock();
|
|
||||||
}
|
|
||||||
: null,
|
: null,
|
||||||
onLongPressStart: state.openDoorBtnisUneable.value == true
|
onLongPressStart: state.openDoorBtnisUneable.value == true
|
||||||
? (details) {
|
? (LongPressStartDetails details) {
|
||||||
setState(() {
|
setState(startUnLock);
|
||||||
startUnLock();
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
: null,
|
: null,
|
||||||
child: Stack(
|
child: Stack(
|
||||||
children: [
|
children: <Widget>[
|
||||||
FlavorsImg(
|
FlavorsImg(
|
||||||
child: Image.asset(
|
child: Image.asset(
|
||||||
state.openDoorBtnisUneable.value == false
|
state.openDoorBtnisUneable.value == false
|
||||||
@ -609,31 +605,32 @@ class _LockDetailPageState extends State<LockDetailPage>
|
|||||||
// color: AppColors.primaryTopColor,
|
// color: AppColors.primaryTopColor,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
state.openDoorBtnisUneable.value == false
|
if (state.openDoorBtnisUneable.value == false)
|
||||||
? Positioned(
|
Positioned(
|
||||||
child: FlavorsImg(
|
child: FlavorsImg(
|
||||||
|
child: Image.asset(
|
||||||
|
'images/main/icon_main_openLockBtn_grey.png',
|
||||||
|
width: 330.w,
|
||||||
|
height: 330.w,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
else
|
||||||
|
state.openLockBtnState.value == 1
|
||||||
|
? buildRotationTransition(
|
||||||
|
width: 330.w,
|
||||||
|
height: 330.w,
|
||||||
|
)
|
||||||
|
: Positioned(
|
||||||
|
child: FlavorsImg(
|
||||||
child: Image.asset(
|
child: Image.asset(
|
||||||
'images/main/icon_main_openLockBtn_grey.png',
|
state.isOpenPassageMode.value == 1
|
||||||
|
? 'images/main/icon_main_normallyOpenMode_circle.png'
|
||||||
|
: 'images/main/icon_main_openLockBtn_circle.png',
|
||||||
width: 330.w,
|
width: 330.w,
|
||||||
height: 330.w,
|
height: 330.w,
|
||||||
),
|
),
|
||||||
),
|
)),
|
||||||
)
|
|
||||||
: state.openLockBtnState.value == 1
|
|
||||||
? buildRotationTransition(
|
|
||||||
width: 330.w,
|
|
||||||
height: 330.w,
|
|
||||||
)
|
|
||||||
: Positioned(
|
|
||||||
child: FlavorsImg(
|
|
||||||
child: Image.asset(
|
|
||||||
state.isOpenPassageMode.value == 1
|
|
||||||
? 'images/main/icon_main_normallyOpenMode_circle.png'
|
|
||||||
: 'images/main/icon_main_openLockBtn_circle.png',
|
|
||||||
width: 330.w,
|
|
||||||
height: 330.w,
|
|
||||||
),
|
|
||||||
)),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
)),
|
)),
|
||||||
@ -641,9 +638,8 @@ class _LockDetailPageState extends State<LockDetailPage>
|
|||||||
right: 90.w,
|
right: 90.w,
|
||||||
bottom: 1,
|
bottom: 1,
|
||||||
child: Obx(() => Visibility(
|
child: Obx(() => Visibility(
|
||||||
visible: state.keyInfos.value.lockSetting!.remoteUnlock == 1
|
visible:
|
||||||
? true
|
state.keyInfos.value.lockSetting!.remoteUnlock == 1,
|
||||||
: false,
|
|
||||||
child: GestureDetector(
|
child: GestureDetector(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
ShowCupertinoAlertView().isToRemoteUnLockAlert(
|
ShowCupertinoAlertView().isToRemoteUnLockAlert(
|
||||||
@ -672,7 +668,7 @@ class _LockDetailPageState extends State<LockDetailPage>
|
|||||||
),
|
),
|
||||||
Row(
|
Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: [
|
children: <Widget>[
|
||||||
Text(
|
Text(
|
||||||
logic.getKeyStatusTextAndShow(),
|
logic.getKeyStatusTextAndShow(),
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
@ -685,9 +681,7 @@ class _LockDetailPageState extends State<LockDetailPage>
|
|||||||
SizedBox(
|
SizedBox(
|
||||||
height: 30.h,
|
height: 30.h,
|
||||||
),
|
),
|
||||||
F.sw(
|
F.sw(defaultCall: adminInfoView, xhjCall: () => const SizedBox()),
|
||||||
defaultCall: () => adminInfoView(),
|
|
||||||
xhjCall: () => const SizedBox()),
|
|
||||||
SizedBox(
|
SizedBox(
|
||||||
height: 20.h,
|
height: 20.h,
|
||||||
),
|
),
|
||||||
@ -707,7 +701,7 @@ class _LockDetailPageState extends State<LockDetailPage>
|
|||||||
mainAxisAlignment:
|
mainAxisAlignment:
|
||||||
center ? MainAxisAlignment.center : MainAxisAlignment.start,
|
center ? MainAxisAlignment.center : MainAxisAlignment.start,
|
||||||
mainAxisSize: max ? MainAxisSize.max : MainAxisSize.min,
|
mainAxisSize: max ? MainAxisSize.max : MainAxisSize.min,
|
||||||
children: [
|
children: <Widget>[
|
||||||
Image.asset(
|
Image.asset(
|
||||||
'images/icon_electronicKey_admin.png',
|
'images/icon_electronicKey_admin.png',
|
||||||
width: 24.w,
|
width: 24.w,
|
||||||
@ -742,7 +736,7 @@ class _LockDetailPageState extends State<LockDetailPage>
|
|||||||
? AppColors.mainColor
|
? AppColors.mainColor
|
||||||
: AppColors.btnDisableColor),
|
: AppColors.btnDisableColor),
|
||||||
),
|
),
|
||||||
if (add) ...[
|
if (add) ...<Widget>[
|
||||||
const Spacer(),
|
const Spacer(),
|
||||||
GestureDetector(
|
GestureDetector(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
@ -752,7 +746,7 @@ class _LockDetailPageState extends State<LockDetailPage>
|
|||||||
padding: const EdgeInsets.all(8.0),
|
padding: const EdgeInsets.all(8.0),
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
children: <Widget>[
|
||||||
FlavorsImg(
|
FlavorsImg(
|
||||||
child: Image.asset(
|
child: Image.asset(
|
||||||
'images/mine/icon_mine_main_addLock.png',
|
'images/mine/icon_mine_main_addLock.png',
|
||||||
@ -823,7 +817,7 @@ class _LockDetailPageState extends State<LockDetailPage>
|
|||||||
Widget buildPageIndicator() {
|
Widget buildPageIndicator() {
|
||||||
return Row(
|
return Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: List.generate(2, (index) {
|
children: List.generate(2, (int index) {
|
||||||
return Container(
|
return Container(
|
||||||
width: 10.0.w,
|
width: 10.0.w,
|
||||||
height: 10.0.w,
|
height: 10.0.w,
|
||||||
@ -855,7 +849,7 @@ class _LockDetailPageState extends State<LockDetailPage>
|
|||||||
|
|
||||||
// 配件配置
|
// 配件配置
|
||||||
List<Widget> getAttachmentWidget() {
|
List<Widget> getAttachmentWidget() {
|
||||||
var showWidgetArr = <Widget>[];
|
final List<Widget> showWidgetArr = <Widget>[];
|
||||||
// 无线键盘
|
// 无线键盘
|
||||||
// if (state.isAttendance.value == 1) {
|
// if (state.isAttendance.value == 1) {
|
||||||
// showWidgetArr.add(bottomItem(
|
// showWidgetArr.add(bottomItem(
|
||||||
@ -911,7 +905,7 @@ class _LockDetailPageState extends State<LockDetailPage>
|
|||||||
|
|
||||||
// 普通用户
|
// 普通用户
|
||||||
List<Widget> getNormalWidget() {
|
List<Widget> getNormalWidget() {
|
||||||
List<Widget> showWidgetArr = <Widget>[];
|
final List<Widget> showWidgetArr = <Widget>[];
|
||||||
// 考勤
|
// 考勤
|
||||||
if (state.isAttendance.value == 1) {
|
if (state.isAttendance.value == 1) {
|
||||||
showWidgetArr.add(bottomItem(
|
showWidgetArr.add(bottomItem(
|
||||||
@ -928,15 +922,17 @@ class _LockDetailPageState extends State<LockDetailPage>
|
|||||||
TranslationLoader.lanKeys!.operatingRecord!.tr,
|
TranslationLoader.lanKeys!.operatingRecord!.tr,
|
||||||
state.bottomBtnisEable.value, () {
|
state.bottomBtnisEable.value, () {
|
||||||
Get.toNamed(Routers.doorLockLogPage,
|
Get.toNamed(Routers.doorLockLogPage,
|
||||||
arguments: {"keyInfo": state.keyInfos.value});
|
arguments: <String, LockListInfoItemEntity>{
|
||||||
|
'keyInfo': state.keyInfos.value
|
||||||
|
});
|
||||||
}));
|
}));
|
||||||
|
|
||||||
// 设置
|
// 设置
|
||||||
showWidgetArr.add(bottomItem('images/main/icon_main_set.png',
|
showWidgetArr.add(bottomItem('images/main/icon_main_set.png',
|
||||||
TranslationLoader.lanKeys!.set!.tr, true, () {
|
TranslationLoader.lanKeys!.set!.tr, true, () {
|
||||||
Get.toNamed(Routers.lockSetPage, arguments: {
|
Get.toNamed(Routers.lockSetPage, arguments: <String, Object?>{
|
||||||
"lockId": state.keyInfos.value.lockId,
|
'lockId': state.keyInfos.value.lockId,
|
||||||
"isOnlyOneData": state.isOnlyOneData
|
'isOnlyOneData': state.isOnlyOneData
|
||||||
});
|
});
|
||||||
}));
|
}));
|
||||||
|
|
||||||
@ -945,7 +941,7 @@ class _LockDetailPageState extends State<LockDetailPage>
|
|||||||
|
|
||||||
// 授权管理员、超级管理员字段
|
// 授权管理员、超级管理员字段
|
||||||
List<Widget> getAllWidget() {
|
List<Widget> getAllWidget() {
|
||||||
var showWidgetArr = <Widget>[];
|
final List<Widget> showWidgetArr = <Widget>[];
|
||||||
// 考勤
|
// 考勤
|
||||||
if (state.isAttendance.value == 1) {
|
if (state.isAttendance.value == 1) {
|
||||||
showWidgetArr.add(bottomItem(
|
showWidgetArr.add(bottomItem(
|
||||||
@ -971,7 +967,9 @@ class _LockDetailPageState extends State<LockDetailPage>
|
|||||||
TranslationLoader.lanKeys!.password!.tr,
|
TranslationLoader.lanKeys!.password!.tr,
|
||||||
state.bottomBtnisEable.value, () {
|
state.bottomBtnisEable.value, () {
|
||||||
Get.toNamed(Routers.passwordKeyListPage,
|
Get.toNamed(Routers.passwordKeyListPage,
|
||||||
arguments: {"keyInfo": state.keyInfos.value});
|
arguments: <String, LockListInfoItemEntity>{
|
||||||
|
'keyInfo': state.keyInfos.value
|
||||||
|
});
|
||||||
}));
|
}));
|
||||||
|
|
||||||
// ic卡
|
// ic卡
|
||||||
@ -980,8 +978,8 @@ class _LockDetailPageState extends State<LockDetailPage>
|
|||||||
'images/main/icon_main_icCard.png',
|
'images/main/icon_main_icCard.png',
|
||||||
TranslationLoader.lanKeys!.card!.tr,
|
TranslationLoader.lanKeys!.card!.tr,
|
||||||
state.bottomBtnisEable.value, () {
|
state.bottomBtnisEable.value, () {
|
||||||
Get.toNamed(Routers.cardListPage, arguments: {
|
Get.toNamed(Routers.cardListPage, arguments: <String, int?>{
|
||||||
"lockId": state.keyInfos.value.lockId,
|
'lockId': state.keyInfos.value.lockId,
|
||||||
});
|
});
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
@ -992,8 +990,8 @@ class _LockDetailPageState extends State<LockDetailPage>
|
|||||||
'images/main/icon_main_fingerprint.png',
|
'images/main/icon_main_fingerprint.png',
|
||||||
TranslationLoader.lanKeys!.fingerprint!.tr,
|
TranslationLoader.lanKeys!.fingerprint!.tr,
|
||||||
state.bottomBtnisEable.value, () {
|
state.bottomBtnisEable.value, () {
|
||||||
Get.toNamed(Routers.fingerprintListPage, arguments: {
|
Get.toNamed(Routers.fingerprintListPage, arguments: <String, int?>{
|
||||||
"lockId": state.keyInfos.value.lockId,
|
'lockId': state.keyInfos.value.lockId,
|
||||||
});
|
});
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
@ -1015,8 +1013,8 @@ class _LockDetailPageState extends State<LockDetailPage>
|
|||||||
'images/main/icon_face.png',
|
'images/main/icon_face.png',
|
||||||
TranslationLoader.lanKeys!.humanFace!.tr,
|
TranslationLoader.lanKeys!.humanFace!.tr,
|
||||||
state.bottomBtnisEable.value, () {
|
state.bottomBtnisEable.value, () {
|
||||||
Get.toNamed(Routers.faceListPage, arguments: {
|
Get.toNamed(Routers.faceListPage, arguments: <String, int?>{
|
||||||
"lockId": state.keyInfos.value.lockId,
|
'lockId': state.keyInfos.value.lockId,
|
||||||
});
|
});
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
@ -1027,8 +1025,8 @@ class _LockDetailPageState extends State<LockDetailPage>
|
|||||||
bottomItem(
|
bottomItem(
|
||||||
'images/main/icon_iris.png', '虹膜'.tr, state.bottomBtnisEable.value,
|
'images/main/icon_iris.png', '虹膜'.tr, state.bottomBtnisEable.value,
|
||||||
() {
|
() {
|
||||||
Get.toNamed(Routers.irisListPage, arguments: {
|
Get.toNamed(Routers.irisListPage, arguments: <String, int?>{
|
||||||
"lockId": state.keyInfos.value.lockId,
|
'lockId': state.keyInfos.value.lockId,
|
||||||
});
|
});
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
@ -1039,8 +1037,8 @@ class _LockDetailPageState extends State<LockDetailPage>
|
|||||||
bottomItem(
|
bottomItem(
|
||||||
'images/main/icon_palm.png', '手掌'.tr, state.bottomBtnisEable.value,
|
'images/main/icon_palm.png', '手掌'.tr, state.bottomBtnisEable.value,
|
||||||
() {
|
() {
|
||||||
Get.toNamed(Routers.palmListPage, arguments: {
|
Get.toNamed(Routers.palmListPage, arguments: <String, int?>{
|
||||||
"lockId": state.keyInfos.value.lockId,
|
'lockId': state.keyInfos.value.lockId,
|
||||||
});
|
});
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
@ -1053,9 +1051,9 @@ class _LockDetailPageState extends State<LockDetailPage>
|
|||||||
'images/main/icon_catEyes.png',
|
'images/main/icon_catEyes.png',
|
||||||
TranslationLoader.lanKeys!.monitoring!.tr,
|
TranslationLoader.lanKeys!.monitoring!.tr,
|
||||||
state.bottomBtnisEable.value, () {
|
state.bottomBtnisEable.value, () {
|
||||||
Get.toNamed(Routers.realTimePicturePage, arguments: {
|
Get.toNamed(Routers.realTimePicturePage, arguments: <String, Object?>{
|
||||||
"lockName": state.keyInfos.value.lockName,
|
'lockName': state.keyInfos.value.lockName,
|
||||||
"isMonitoring": true
|
'isMonitoring': true
|
||||||
});
|
});
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
@ -1068,11 +1066,13 @@ class _LockDetailPageState extends State<LockDetailPage>
|
|||||||
TranslationLoader.lanKeys!.authorizedAdmin!.tr,
|
TranslationLoader.lanKeys!.authorizedAdmin!.tr,
|
||||||
state.bottomBtnisEable.value, () {
|
state.bottomBtnisEable.value, () {
|
||||||
Get.toNamed(Routers.authorizedAdminListPage,
|
Get.toNamed(Routers.authorizedAdminListPage,
|
||||||
arguments: {"keyInfo": state.keyInfos.value});
|
arguments: <String, LockListInfoItemEntity>{
|
||||||
|
'keyInfo': state.keyInfos.value
|
||||||
|
});
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
var endWiddget = <Widget>[];
|
final List<Widget> endWiddget = <Widget>[];
|
||||||
endWiddget.add(
|
endWiddget.add(
|
||||||
// 操作记录
|
// 操作记录
|
||||||
bottomItem(
|
bottomItem(
|
||||||
@ -1082,7 +1082,9 @@ class _LockDetailPageState extends State<LockDetailPage>
|
|||||||
// Get.toNamed(Routers.lockOperatingRecordPage,
|
// Get.toNamed(Routers.lockOperatingRecordPage,
|
||||||
// arguments: {"keyInfo": state.keyInfos.value});
|
// arguments: {"keyInfo": state.keyInfos.value});
|
||||||
Get.toNamed(Routers.doorLockLogPage,
|
Get.toNamed(Routers.doorLockLogPage,
|
||||||
arguments: {"keyInfo": state.keyInfos.value});
|
arguments: <String, LockListInfoItemEntity>{
|
||||||
|
'keyInfo': state.keyInfos.value
|
||||||
|
});
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -1092,8 +1094,8 @@ class _LockDetailPageState extends State<LockDetailPage>
|
|||||||
'images/main/icon_lockDetail_videoLog.png',
|
'images/main/icon_lockDetail_videoLog.png',
|
||||||
TranslationLoader.lanKeys!.videoLog!.tr,
|
TranslationLoader.lanKeys!.videoLog!.tr,
|
||||||
state.bottomBtnisEable.value, () {
|
state.bottomBtnisEable.value, () {
|
||||||
Get.toNamed(Routers.videoLogPage, arguments: {
|
Get.toNamed(Routers.videoLogPage, arguments: <String, int?>{
|
||||||
"lockId": state.keyInfos.value.lockId,
|
'lockId': state.keyInfos.value.lockId,
|
||||||
});
|
});
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
@ -1103,8 +1105,8 @@ class _LockDetailPageState extends State<LockDetailPage>
|
|||||||
'images/main/icon_lockDetail_messageReminding.png',
|
'images/main/icon_lockDetail_messageReminding.png',
|
||||||
TranslationLoader.lanKeys!.messageReminding!.tr,
|
TranslationLoader.lanKeys!.messageReminding!.tr,
|
||||||
state.bottomBtnisEable.value, () {
|
state.bottomBtnisEable.value, () {
|
||||||
Get.toNamed(Routers.msgNotificationPage, arguments: {
|
Get.toNamed(Routers.msgNotificationPage, arguments: <String, int?>{
|
||||||
"lockId": state.keyInfos.value.lockId,
|
'lockId': state.keyInfos.value.lockId,
|
||||||
});
|
});
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
@ -1114,9 +1116,9 @@ class _LockDetailPageState extends State<LockDetailPage>
|
|||||||
bottomItem('images/main/icon_main_set.png',
|
bottomItem('images/main/icon_main_set.png',
|
||||||
TranslationLoader.lanKeys!.set!.tr, true, () {
|
TranslationLoader.lanKeys!.set!.tr, true, () {
|
||||||
// logic.clickItemBtnAction(10);
|
// logic.clickItemBtnAction(10);
|
||||||
Get.toNamed(Routers.lockSetPage, arguments: {
|
Get.toNamed(Routers.lockSetPage, arguments: <String, Object?>{
|
||||||
"lockId": state.keyInfos.value.lockId,
|
'lockId': state.keyInfos.value.lockId,
|
||||||
"isOnlyOneData": state.isOnlyOneData,
|
'isOnlyOneData': state.isOnlyOneData,
|
||||||
});
|
});
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
@ -1126,12 +1128,12 @@ class _LockDetailPageState extends State<LockDetailPage>
|
|||||||
|
|
||||||
Widget bottomItem(
|
Widget bottomItem(
|
||||||
String iconUrl, String name, bool bottomBtnisEable, Function() onClick) {
|
String iconUrl, String name, bool bottomBtnisEable, Function() onClick) {
|
||||||
Widget child = F.sw(
|
final Widget child = F.sw(
|
||||||
defaultCall: () => Container(
|
defaultCall: () => Container(
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
children: [
|
children: <Widget>[
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: 42.w,
|
width: 42.w,
|
||||||
height: 42.h,
|
height: 42.h,
|
||||||
@ -1164,7 +1166,7 @@ class _LockDetailPageState extends State<LockDetailPage>
|
|||||||
padding: EdgeInsets.symmetric(vertical: 15.h, horizontal: 15.w),
|
padding: EdgeInsets.symmetric(vertical: 15.h, horizontal: 15.w),
|
||||||
child: Row(
|
child: Row(
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
children: [
|
children: <Widget>[
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: 42.w,
|
width: 42.w,
|
||||||
height: 42.h,
|
height: 42.h,
|
||||||
@ -1195,19 +1197,19 @@ class _LockDetailPageState extends State<LockDetailPage>
|
|||||||
onTap: bottomBtnisEable
|
onTap: bottomBtnisEable
|
||||||
? onClick
|
? onClick
|
||||||
: () {
|
: () {
|
||||||
logic.showToast("请在锁旁边完成第一次开锁".tr);
|
logic.showToast('请在锁旁边完成第一次开锁'.tr);
|
||||||
},
|
},
|
||||||
child: child,
|
child: child,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
listeningAnimations() async {
|
Future<void> listeningAnimations() async {
|
||||||
await Future.delayed(Duration.zero, () {
|
await Future<void>.delayed(Duration.zero, () {
|
||||||
state.animationController = AnimationController(
|
state.animationController = AnimationController(
|
||||||
duration: const Duration(seconds: 1), vsync: this);
|
duration: const Duration(seconds: 1), vsync: this);
|
||||||
state.animationController!.repeat();
|
state.animationController!.repeat();
|
||||||
//动画开始、结束、向前移动或向后移动时会调用StatusListener
|
//动画开始、结束、向前移动或向后移动时会调用StatusListener
|
||||||
state.animationController!.addStatusListener((status) {
|
state.animationController!.addStatusListener((AnimationStatus status) {
|
||||||
if (status == AnimationStatus.completed) {
|
if (status == AnimationStatus.completed) {
|
||||||
state.animationController!.reset();
|
state.animationController!.reset();
|
||||||
state.animationController!.forward();
|
state.animationController!.forward();
|
||||||
@ -1237,7 +1239,7 @@ class _LockDetailPageState extends State<LockDetailPage>
|
|||||||
Widget _unlockSuccessWidget() {
|
Widget _unlockSuccessWidget() {
|
||||||
return Center(
|
return Center(
|
||||||
child: Stack(
|
child: Stack(
|
||||||
children: [
|
children: <Widget>[
|
||||||
Image.asset(
|
Image.asset(
|
||||||
state.iSOpenLock.value == true
|
state.iSOpenLock.value == true
|
||||||
? 'images/main/unlocked_bg.png'
|
? 'images/main/unlocked_bg.png'
|
||||||
@ -1250,7 +1252,7 @@ class _LockDetailPageState extends State<LockDetailPage>
|
|||||||
left: 55.w,
|
left: 55.w,
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
children: <Widget>[
|
||||||
Text(
|
Text(
|
||||||
state.keyInfos.value.lockAlias!,
|
state.keyInfos.value.lockAlias!,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
@ -1289,9 +1291,9 @@ class _LockDetailPageState extends State<LockDetailPage>
|
|||||||
|
|
||||||
String getCurrentFormattedTime() {
|
String getCurrentFormattedTime() {
|
||||||
// 获取当前时间
|
// 获取当前时间
|
||||||
DateTime now = DateTime.now();
|
final DateTime now = DateTime.now();
|
||||||
// 格式化日期和时间
|
// 格式化日期和时间
|
||||||
String formattedTime = DateFormat('MM/dd HH:mm').format(now);
|
final String formattedTime = DateFormat('MM/dd HH:mm').format(now);
|
||||||
return formattedTime;
|
return formattedTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1303,24 +1305,20 @@ class _LockDetailPageState extends State<LockDetailPage>
|
|||||||
DateTool().compareTimeIsOvertime(state.nextAuthTime.value) == true) {
|
DateTool().compareTimeIsOvertime(state.nextAuthTime.value) == true) {
|
||||||
AliyunRealNameAuthProvider(
|
AliyunRealNameAuthProvider(
|
||||||
getLockInfo: state.keyInfos.value,
|
getLockInfo: state.keyInfos.value,
|
||||||
onCertifyResultWithTime: ((bool isSuccess, int getNextAuthTime) {
|
onCertifyResultWithTime: (bool isSuccess, int getNextAuthTime) {
|
||||||
state.nextAuthTime.value = getNextAuthTime;
|
state.nextAuthTime.value = getNextAuthTime;
|
||||||
if (isSuccess) {
|
if (isSuccess) {
|
||||||
// 认证成功,去开锁
|
// 认证成功,去开锁
|
||||||
setState(() {
|
setState(startOpenLock);
|
||||||
startOpenLock();
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
})).initAliyunRealNameAuth();
|
}).initAliyunRealNameAuth();
|
||||||
} else {
|
} else {
|
||||||
//无需认证,直接开锁
|
//无需认证,直接开锁
|
||||||
setState(() {
|
setState(startOpenLock);
|
||||||
startOpenLock();
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
startOpenLock() {
|
void startOpenLock() {
|
||||||
if (state.openLockBtnState.value == 1) {
|
if (state.openLockBtnState.value == 1) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1329,21 +1327,21 @@ class _LockDetailPageState extends State<LockDetailPage>
|
|||||||
state.openLockBtnState.value = 1;
|
state.openLockBtnState.value = 1;
|
||||||
state.animationController!.forward();
|
state.animationController!.forward();
|
||||||
|
|
||||||
AppLog.log("点击开锁");
|
AppLog.log('点击开锁');
|
||||||
if (state.isOpenLockNeedOnline.value == 0) {
|
if (state.isOpenLockNeedOnline.value == 0) {
|
||||||
// 不需要联网
|
// 不需要联网
|
||||||
state.openDoorModel = 0;
|
state.openDoorModel = 0;
|
||||||
AppLog.log("点击开锁 state.openDoorModel = 0 不需要联网");
|
AppLog.log('点击开锁 state.openDoorModel = 0 不需要联网');
|
||||||
logic.openDoorAction();
|
logic.openDoorAction();
|
||||||
} else {
|
} else {
|
||||||
// 需要联网
|
// 需要联网
|
||||||
state.openDoorModel = 2;
|
state.openDoorModel = 2;
|
||||||
AppLog.log("点击开锁 state.openDoorModel = 2 需要联网");
|
AppLog.log('点击开锁 state.openDoorModel = 2 需要联网');
|
||||||
logic.getLockNetToken();
|
logic.getLockNetToken();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
startUnLock() {
|
void startUnLock() {
|
||||||
if (state.openLockBtnState.value == 1) {
|
if (state.openLockBtnState.value == 1) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1352,16 +1350,16 @@ class _LockDetailPageState extends State<LockDetailPage>
|
|||||||
state.openLockBtnState.value = 1;
|
state.openLockBtnState.value = 1;
|
||||||
state.animationController!.forward();
|
state.animationController!.forward();
|
||||||
|
|
||||||
EasyLoading.showToast("正在尝试闭锁……".tr, duration: 2000.milliseconds);
|
EasyLoading.showToast('正在尝试闭锁……'.tr, duration: 2000.milliseconds);
|
||||||
AppLog.log("长按闭锁");
|
AppLog.log('长按闭锁');
|
||||||
if (state.isOpenLockNeedOnline.value == 0) {
|
if (state.isOpenLockNeedOnline.value == 0) {
|
||||||
// 不需要联网
|
// 不需要联网
|
||||||
AppLog.log("长按闭锁 state.openDoorModel = 32 不需要联网");
|
AppLog.log('长按闭锁 state.openDoorModel = 32 不需要联网');
|
||||||
state.openDoorModel = 32;
|
state.openDoorModel = 32;
|
||||||
logic.openDoorAction();
|
logic.openDoorAction();
|
||||||
} else {
|
} else {
|
||||||
// 需要联网
|
// 需要联网
|
||||||
AppLog.log("长按闭锁 state.openDoorModel = 34 需要联网");
|
AppLog.log('长按闭锁 state.openDoorModel = 34 需要联网');
|
||||||
state.openDoorModel = 34;
|
state.openDoorModel = 34;
|
||||||
logic.getLockNetToken();
|
logic.getLockNetToken();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -15,10 +15,11 @@ import 'lockMain_state.dart';
|
|||||||
class LockMainLogic extends BaseGetXController {
|
class LockMainLogic extends BaseGetXController {
|
||||||
final LockMainState state = LockMainState();
|
final LockMainState state = LockMainState();
|
||||||
|
|
||||||
Future<LockListInfoEntity> getStarLockInfo() async {
|
Future<LockListInfoEntity> getStarLockInfo({bool isUnShowLoading = false}) async {
|
||||||
LockListInfoEntity entity = await ApiRepository.to.getStarLockListInfo(
|
LockListInfoEntity entity = await ApiRepository.to.getStarLockListInfo(
|
||||||
pageNo: pageNo,
|
pageNo: pageNo,
|
||||||
pageSize: 50,
|
pageSize: 50,
|
||||||
|
isUnShowLoading: isUnShowLoading,
|
||||||
);
|
);
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
loadMainDataLogic(entity.data!);
|
loadMainDataLogic(entity.data!);
|
||||||
|
|||||||
@ -37,14 +37,15 @@ class _StarLockMainPageState extends State<StarLockMainPage> with BaseWidget {
|
|||||||
final logic = Get.put(LockMainLogic());
|
final logic = Get.put(LockMainLogic());
|
||||||
final state = Get.find<LockMainLogic>().state;
|
final state = Get.find<LockMainLogic>().state;
|
||||||
|
|
||||||
Future<void> getHttpData({bool clearScanDevices = false}) async {
|
Future<void> getHttpData(
|
||||||
|
{bool clearScanDevices = false, bool isUnShowLoading = false}) async {
|
||||||
LockListInfoGroupEntity? lockListInfoGroupEntity =
|
LockListInfoGroupEntity? lockListInfoGroupEntity =
|
||||||
await Storage.getLockMainListData();
|
await Storage.getLockMainListData();
|
||||||
if (lockListInfoGroupEntity != null) {
|
if (lockListInfoGroupEntity != null) {
|
||||||
var localLockListInfoGroupEntity = lockListInfoGroupEntity;
|
var localLockListInfoGroupEntity = lockListInfoGroupEntity;
|
||||||
await logic.loadMainDataLogic(localLockListInfoGroupEntity);
|
await logic.loadMainDataLogic(localLockListInfoGroupEntity);
|
||||||
}
|
}
|
||||||
await logic.getStarLockInfo();
|
await logic.getStarLockInfo(isUnShowLoading: isUnShowLoading);
|
||||||
await Future.delayed(const Duration(milliseconds: 200));
|
await Future.delayed(const Duration(milliseconds: 200));
|
||||||
if (clearScanDevices) {
|
if (clearScanDevices) {
|
||||||
BlueManage().scanDevices.clear();
|
BlueManage().scanDevices.clear();
|
||||||
@ -237,7 +238,9 @@ class _StarLockMainPageState extends State<StarLockMainPage> with BaseWidget {
|
|||||||
void _initLoadDataAction() {
|
void _initLoadDataAction() {
|
||||||
_teamEvent = eventBus.on<RefreshLockListInfoDataEvent>().listen((event) {
|
_teamEvent = eventBus.on<RefreshLockListInfoDataEvent>().listen((event) {
|
||||||
logic.pageNo = 1;
|
logic.pageNo = 1;
|
||||||
getHttpData(clearScanDevices: event.clearScanDevices);
|
getHttpData(
|
||||||
|
clearScanDevices: event.clearScanDevices,
|
||||||
|
isUnShowLoading: event.isUnShowLoading);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -171,7 +171,7 @@ class ApiProvider extends BaseProvider {
|
|||||||
'idCardNumber': idCardNumber
|
'idCardNumber': idCardNumber
|
||||||
}));
|
}));
|
||||||
|
|
||||||
Future<Response> uploadElectricQuantity(
|
Future<Response<dynamic>> uploadElectricQuantity(
|
||||||
String electricQuantity,
|
String electricQuantity,
|
||||||
String electricQuantityStandby,
|
String electricQuantityStandby,
|
||||||
String lockId,
|
String lockId,
|
||||||
@ -374,12 +374,12 @@ class ApiProvider extends BaseProvider {
|
|||||||
}));
|
}));
|
||||||
|
|
||||||
// 获取锁信息列表
|
// 获取锁信息列表
|
||||||
Future<Response> getStarLockListInfo(int pageNo, int pageSize) => post(
|
Future<Response> getStarLockListInfo(int pageNo, int pageSize,{bool isUnShowLoading = true}) => post(
|
||||||
getStarLockInfoURL.toUrl,
|
getStarLockInfoURL.toUrl,
|
||||||
jsonEncode({
|
jsonEncode({
|
||||||
"pageNo": pageNo,
|
"pageNo": pageNo,
|
||||||
'pageSize': pageSize,
|
'pageSize': pageSize,
|
||||||
}));
|
}),isUnShowLoading: isUnShowLoading);
|
||||||
|
|
||||||
// 获取所有锁设置信息
|
// 获取所有锁设置信息
|
||||||
Future<Response> getLockSettingInfoData(String lockId) => post(
|
Future<Response> getLockSettingInfoData(String lockId) => post(
|
||||||
|
|||||||
@ -37,7 +37,6 @@ class BaseProvider extends GetConnect with Api {
|
|||||||
}) async {
|
}) async {
|
||||||
AppLog.log("post: url:$url body:$body");
|
AppLog.log("post: url:$url body:$body");
|
||||||
if (isUnShowLoading == false){
|
if (isUnShowLoading == false){
|
||||||
// AppLog.log("post: url:$url show loading");
|
|
||||||
EasyLoading.show();
|
EasyLoading.show();
|
||||||
}
|
}
|
||||||
if (isUserBaseUrl == false) {
|
if (isUserBaseUrl == false) {
|
||||||
|
|||||||
@ -421,8 +421,8 @@ class ApiRepository {
|
|||||||
|
|
||||||
// 获取锁信息列表
|
// 获取锁信息列表
|
||||||
Future<LockListInfoEntity> getStarLockListInfo(
|
Future<LockListInfoEntity> getStarLockListInfo(
|
||||||
{required int pageNo, required int pageSize}) async {
|
{required int pageNo, required int pageSize,required bool isUnShowLoading}) async {
|
||||||
final res = await apiProvider.getStarLockListInfo(pageNo, pageSize);
|
final res = await apiProvider.getStarLockListInfo(pageNo, pageSize,isUnShowLoading:isUnShowLoading);
|
||||||
return LockListInfoEntity.fromJson(res.body);
|
return LockListInfoEntity.fromJson(res.body);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -9,8 +9,10 @@ EventBus eventBus = EventBus();
|
|||||||
class RefreshLockListInfoDataEvent {
|
class RefreshLockListInfoDataEvent {
|
||||||
//是否清除蓝牙设备列表缓存
|
//是否清除蓝牙设备列表缓存
|
||||||
bool clearScanDevices;
|
bool clearScanDevices;
|
||||||
|
bool isUnShowLoading;
|
||||||
|
|
||||||
RefreshLockListInfoDataEvent({this.clearScanDevices = false});
|
RefreshLockListInfoDataEvent(
|
||||||
|
{this.clearScanDevices = false, this.isUnShowLoading = false});
|
||||||
}
|
}
|
||||||
|
|
||||||
/// 蓝牙添加用户成功
|
/// 蓝牙添加用户成功
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user