fix:修复 event

This commit is contained in:
anfe 2024-05-20 16:28:11 +08:00
parent 11c90ca414
commit 3da93adfb5
8 changed files with 292 additions and 277 deletions

View File

@ -1,4 +1,3 @@
import 'dart:async';
import 'package:flutter/scheduler.dart';
@ -7,6 +6,8 @@ import 'package:get/get.dart';
import 'package:intl/intl.dart';
import 'package:permission_handler/permission_handler.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';
@ -35,7 +36,7 @@ class LockDetailLogic extends BaseGetXController {
//
void initReplySubscription() {
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) {
_replyOpenLock(reply);
@ -51,7 +52,7 @@ class LockDetailLogic extends BaseGetXController {
//
Future<void> _replyOpenLock(Reply reply) async {
int status = reply.data[6];
final int status = reply.data[6];
switch (status) {
case 0x00:
@ -62,19 +63,20 @@ class LockDetailLogic extends BaseGetXController {
state.iSClosedUnlockSuccessfulPopup.value = true;
state.closedUnlockSuccessfulTimer?.cancel();
// 3
state.closedUnlockSuccessfulTimer = Timer.periodic(3.seconds, (timer) {
state.closedUnlockSuccessfulTimer =
Timer.periodic(3.seconds, (Timer timer) {
state.iSClosedUnlockSuccessfulPopup.value = false;
timer.cancel();
eventBus.fire(RefreshLockDetailInfoDataEvent());
});
//
int power = reply.data[7];
final int power = reply.data[7];
state.electricQuantity.value = power;
//
if (state.keyInfos.value.lockFeature!.isSupportBackupBattery == 1) {
int powerStandby = reply.data[9];
final int powerStandby = reply.data[9];
state.electricQuantityStandby.value = powerStandby;
}
//
@ -85,14 +87,17 @@ class LockDetailLogic extends BaseGetXController {
break;
case 0x06:
//
var privateKey = await Storage.getStringList(saveBluePrivateKey);
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
final List<String>? privateKey =
await Storage.getStringList(saveBluePrivateKey);
final List<int> getPrivateKeyList =
changeStringListToIntList(privateKey!);
var signKey = await Storage.getStringList(saveBlueSignKey);
List<int> signKeyDataList = changeStringListToIntList(signKey!);
final List<String>? signKey =
await Storage.getStringList(saveBlueSignKey);
final List<int> signKeyDataList = changeStringListToIntList(signKey!);
var tokenData = reply.data.sublist(2, 6);
var saveStrList = changeIntListToStringList(tokenData);
final List<int> tokenData = reply.data.sublist(2, 6);
final List<String> saveStrList = changeIntListToStringList(tokenData);
Storage.setStringList(saveBlueToken, saveStrList);
IoSenderManage.senderOpenLock(
@ -110,7 +115,7 @@ class LockDetailLogic extends BaseGetXController {
case 0x16:
// ...
resetOpenDoorState();
showToast("正在开锁中...".tr, something: () {
showToast('正在开锁中...'.tr, something: () {
cancelBlueConnetctToastTimer();
});
break;
@ -132,7 +137,7 @@ class LockDetailLogic extends BaseGetXController {
break;
case 0x0a:
//
showToast("钥匙不存在");
showToast('钥匙不存在');
resetOpenDoorState();
cancelBlueConnetctToastTimer();
@ -140,7 +145,7 @@ class LockDetailLogic extends BaseGetXController {
break;
case 0x0c:
//
showToast("钥匙数量已到上限");
showToast('钥匙数量已到上限');
resetOpenDoorState();
cancelBlueConnetctToastTimer();
@ -148,7 +153,7 @@ class LockDetailLogic extends BaseGetXController {
break;
case 0x0e:
//
showToast("钥匙已存在");
showToast('钥匙已存在');
resetOpenDoorState();
cancelBlueConnetctToastTimer();
@ -156,7 +161,7 @@ class LockDetailLogic extends BaseGetXController {
break;
case 0x0f:
//
showToast("用户已存在");
showToast('用户已存在');
resetOpenDoorState();
cancelBlueConnetctToastTimer();
@ -164,7 +169,7 @@ class LockDetailLogic extends BaseGetXController {
break;
default:
//
AppLog.log("开锁失败");
AppLog.log('开锁失败');
// state.animationController!.stop();
resetOpenDoorState();
cancelBlueConnetctToastTimer();
@ -183,11 +188,11 @@ class LockDetailLogic extends BaseGetXController {
//
Future<void> _replyReferEventRecordTime(Reply reply) async {
int status = reply.data[2];
final int status = reply.data[2];
switch (status) {
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");
if (dataLength > 0) {
reply.data.removeRange(0, 7);
@ -195,32 +200,32 @@ class LockDetailLogic extends BaseGetXController {
if (reply.data.length < 17) {
return;
}
var getList = splitList(reply.data, 17);
final List<List<int>> getList = splitList(reply.data, 17);
// AppLog.log("getList:$getList");
var uploadList = [];
final List uploadList = [];
for (int i = 0; i < getList.length; i++) {
var indexList = getList[i];
final List<int> indexList = getList[i];
// AppLog.log("indexList:$indexList");
var indexMap = {};
indexMap["type"] = indexList[0].toString();
final Map indexMap = {};
indexMap['type'] = indexList[0].toString();
int operateDate = 0;
if (indexList[0] == 2) {
var passwordData = reply.data.sublist(7, 17);
var password = utf8String(passwordData);
indexMap["user"] = password.toString();
final List<int> passwordData = reply.data.sublist(7, 17);
final String password = utf8String(passwordData);
indexMap['user'] = password.toString();
} else {
int userNo = (indexList[1] * 256) + indexList[2];
indexMap["user"] = userNo.toString();
final int userNo = (indexList[1] * 256) + indexList[2];
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[5]) << 8 |
(0xFF & indexList[6]));
operateDate = time * 1000;
indexMap["date"] = "$operateDate";
indexMap['date'] = '$operateDate';
uploadList.add(indexMap);
if (i == getList.length - 1) {
@ -256,14 +261,15 @@ class LockDetailLogic extends BaseGetXController {
// BlueManage().stopScan();
BlueManage().disconnect();
});
var privateKey = await Storage.getStringList(saveBluePrivateKey);
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
final List<String>? privateKey =
await Storage.getStringList(saveBluePrivateKey);
final List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
var signKey = await Storage.getStringList(saveBlueSignKey);
List<int> signKeyDataList = changeStringListToIntList(signKey!);
final List<String>? signKey = await Storage.getStringList(saveBlueSignKey);
final List<int> signKeyDataList = changeStringListToIntList(signKey!);
var token = await Storage.getStringList(saveBlueToken);
List<int> getTokenList = changeStringListToIntList(token!);
final List<String>? token = await Storage.getStringList(saveBlueToken);
final List<int> getTokenList = changeStringListToIntList(token!);
BlueManage()
.bludSendData(state.keyInfos.value.bluetooth!.bluetoothDeviceName!,
@ -303,14 +309,18 @@ class LockDetailLogic extends BaseGetXController {
BlueManage().bludSendData(BlueManage().connectDeviceName,
(BluetoothConnectionState connectionState) async {
if (connectionState == BluetoothConnectionState.connected) {
var privateKey = await Storage.getStringList(saveBluePrivateKey);
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
final List<String>? privateKey =
await Storage.getStringList(saveBluePrivateKey);
final List<int> getPrivateKeyList =
changeStringListToIntList(privateKey!);
var token = await Storage.getStringList(saveBlueToken);
List<int> getTokenList = changeStringListToIntList(token!);
final List<String>? token = await Storage.getStringList(saveBlueToken);
final List<int> getTokenList = changeStringListToIntList(token!);
var publicKey = await Storage.getStringList(saveBluePublicKey);
List<int> getPublicKeyList = changeStringListToIntList(publicKey!);
final List<String>? publicKey =
await Storage.getStringList(saveBluePublicKey);
final List<int> getPublicKeyList =
changeStringListToIntList(publicKey!);
IoSenderManage.senderReferEventRecordTimeCommand(
keyID: BlueManage().connectDeviceName,
@ -329,7 +339,8 @@ class LockDetailLogic extends BaseGetXController {
//
void getServerDatetime() async {
var entity = await ApiRepository.to.getServerDatetimeData();
final GetServerDatetimeEntity entity =
await ApiRepository.to.getServerDatetimeData();
if (entity.errorCode!.codeIsSuccessful) {
state.differentialTime = entity.data!.date! ~/ 1000 -
DateTime.now().millisecondsSinceEpoch ~/ 1000;
@ -344,17 +355,17 @@ class LockDetailLogic extends BaseGetXController {
// token
void getLockNetToken() async {
LockNetTokenEntity entity = await ApiRepository.to
final LockNetTokenEntity entity = await ApiRepository.to
.getLockNetToken(lockId: state.keyInfos.value.lockId.toString());
if (entity.errorCode!.codeIsSuccessful) {
state.lockNetToken = entity.data!.token!.toString();
AppLog.log("从服务器获取联网token:${state.lockNetToken}");
AppLog.log('从服务器获取联网token:${state.lockNetToken}');
openDoorAction();
} else {
showToast("网络访问失败,请检查网络是否正常".tr, something: () {
showToast('网络访问失败,请检查网络是否正常'.tr, something: () {
resetOpenDoorState();
cancelBlueConnetctToastTimer();
state.lockNetToken = "0";
state.lockNetToken = '0';
openDoorAction();
});
}
@ -362,7 +373,7 @@ class LockDetailLogic extends BaseGetXController {
//
Future<void> uploadElectricQuantityRequest() async {
KeyOperationRecordEntity entity = await ApiRepository.to
final KeyOperationRecordEntity entity = await ApiRepository.to
.uploadElectricQuantity(
electricQuantity: state.electricQuantity.value.toString(),
electricQuantityStandby:
@ -371,15 +382,15 @@ class LockDetailLogic extends BaseGetXController {
isUnShowLoading: true);
if (entity.errorCode!.codeIsSuccessful) {
SchedulerBinding.instance.addPostFrameCallback((_) {
eventBus.fire(RefreshLockListInfoDataEvent());
eventBus.fire(RefreshLockListInfoDataEvent(isUnShowLoading: true));
});
}
}
//
void getLockRecordLastUploadDataTime() async {
LockOperatingRecordGetLastRecordTimeEntity entity = await ApiRepository.to
.getLockRecordLastUploadDataTime(
final LockOperatingRecordGetLastRecordTimeEntity entity =
await ApiRepository.to.getLockRecordLastUploadDataTime(
lockId: state.keyInfos.value.lockId.toString());
if (entity.errorCode!.codeIsSuccessful) {
state.operateDate = entity.data!.operateDate! ~/ 1000;
@ -388,14 +399,14 @@ class LockDetailLogic extends BaseGetXController {
}
//
void lockRecordUploadData(List list) async {
KeyOperationRecordEntity entity = await ApiRepository.to
Future<void> lockRecordUploadData(List list) async {
final KeyOperationRecordEntity entity = await ApiRepository.to
.lockRecordUploadData(
lockId: state.keyInfos.value.lockId.toString(), records: list);
if (entity.errorCode!.codeIsSuccessful) {
// mockNetworkDataRequest();
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) {
//
deletKeyData();
@ -405,10 +416,11 @@ class LockDetailLogic extends BaseGetXController {
//
void deletKeyData() async {
var entity = await ApiRepository.to.deleteElectronicKey(
keyId: state.keyInfos.value.keyId.toString(), includeUnderlings: 0);
final ElectronicKeyListEntity entity = await ApiRepository.to
.deleteElectronicKey(
keyId: state.keyInfos.value.keyId.toString(), includeUnderlings: 0);
if (entity.errorCode!.codeIsSuccessful) {
BlueManage().connectDeviceMacAddress = "";
BlueManage().connectDeviceMacAddress = '';
SchedulerBinding.instance.addPostFrameCallback((_) {
eventBus.fire(RefreshLockListInfoDataEvent());
});
@ -422,7 +434,7 @@ class LockDetailLogic extends BaseGetXController {
state.lockSetOpenOrCloseCheckInRefreshLockDetailWithAttendanceEvent =
eventBus
.on<LockSetChangeSetRefreshLockDetailWithType>()
.listen((event) {
.listen((LockSetChangeSetRefreshLockDetailWithType event) {
if (event.type == 0) {
// 0
state.isAttendance.value = int.parse(event.setResult);
@ -433,7 +445,7 @@ class LockDetailLogic extends BaseGetXController {
state.isOpenLockNeedOnline.value = int.parse(event.setResult);
state.keyInfos.value.lockSetting!.appUnlockOnline =
int.parse(event.setResult);
state.lockNetToken = ""; // token
state.lockNetToken = ''; // token
} else if (event.type == 2) {
// 2
state.isOpenPassageMode.value = int.parse(event.setResult);
@ -458,7 +470,7 @@ class LockDetailLogic extends BaseGetXController {
}
String getKeyStatusTextAndShow() {
String text = "";
String text = '';
if (state.keyInfos.value.keyStatus ==
XSConstantMacro.keyStatusWaitIneffective ||
state.keyInfos.value.keyStatus == XSConstantMacro.keyStatusFrozen ||
@ -469,7 +481,7 @@ class LockDetailLogic extends BaseGetXController {
"${"你的钥匙".tr}${XSConstantMacro.getKeyStatusStr(state.keyInfos.value.keyStatus!)}";
} else {
text = state.isOpenPassageMode.value == 1
? "常开模式启动!长按闭锁".tr
? '常开模式启动!长按闭锁'.tr
: TranslationLoader.lanKeys!.clickUnlockAndHoldDownClose!.tr;
}
return text;
@ -477,9 +489,9 @@ class LockDetailLogic extends BaseGetXController {
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;
}

View File

@ -8,6 +8,7 @@ import 'package:intl/intl.dart';
import 'package:star_lock/app_settings/app_colors.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_state.dart';
import 'package:star_lock/tools/aliyunRealNameAuth/aliyunRealNameAuthHandle.dart';
import 'package:star_lock/tools/showCupertinoAlertView.dart';
import 'package:star_lock/tools/showTipView.dart';
@ -44,8 +45,8 @@ class LockDetailPage extends StatefulWidget {
class _LockDetailPageState extends State<LockDetailPage>
with TickerProviderStateMixin, RouteAware {
// with RouteAware
final logic = Get.put(LockDetailLogic());
final state = Get.find<LockDetailLogic>().state;
final LockDetailLogic logic = Get.put(LockDetailLogic());
final LockDetailState state = Get.find<LockDetailLogic>().state;
@override
void initState() {
@ -75,8 +76,9 @@ class _LockDetailPageState extends State<LockDetailPage>
void _initRefreshLockDetailInfoDataEventAction() {
// eventBus
_lockRefreshLockDetailInfoDataEvent =
eventBus.on<RefreshLockDetailInfoDataEvent>().listen((event) {
_lockRefreshLockDetailInfoDataEvent = eventBus
.on<RefreshLockDetailInfoDataEvent>()
.listen((RefreshLockDetailInfoDataEvent event) {
setState(() {});
});
}
@ -114,26 +116,28 @@ class _LockDetailPageState extends State<LockDetailPage>
BlueManage().connectDeviceName =
state.keyInfos.value.bluetooth!.bluetoothDeviceName!;
List<int> publicKeyData =
final List<int> publicKeyData =
state.keyInfos.value.bluetooth!.publicKey!.cast<int>();
var saveStrList = changeIntListToStringList(publicKeyData);
final List<String> saveStrList = changeIntListToStringList(publicKeyData);
Storage.setStringList(saveBluePublicKey, saveStrList);
//
List<int> privateKeyData =
final List<int> privateKeyData =
state.keyInfos.value.bluetooth!.privateKey!.cast<int>();
var savePrivateKeyList = changeIntListToStringList(privateKeyData);
final List<String> savePrivateKeyList =
changeIntListToStringList(privateKeyData);
Storage.setStringList(saveBluePrivateKey, savePrivateKeyList);
// signKey
List<int> signKeyData =
final List<int> signKeyData =
state.keyInfos.value.bluetooth!.signKey!.cast<int>();
var saveSignKeyList = changeIntListToStringList(signKeyData);
final List<String> saveSignKeyList = changeIntListToStringList(signKeyData);
Storage.setStringList(saveBlueSignKey, saveSignKeyList);
bool ifHaveKey = await Storage.ifHaveKey(saveBlueToken);
final bool ifHaveKey = await Storage.ifHaveKey(saveBlueToken);
if (!ifHaveKey) {
var saveTokenList = changeIntListToStringList([0, 0, 0, 0]);
final List<String> saveTokenList =
changeIntListToStringList(<int>[0, 0, 0, 0]);
Storage.setStringList(saveBlueToken, saveTokenList);
}
}
@ -141,7 +145,7 @@ class _LockDetailPageState extends State<LockDetailPage>
@override
Widget build(BuildContext context) {
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,
body: Obx(() {
return Stack(
children: [
children: <Widget>[
Column(
children: [
children: <Widget>[
SizedBox(
height: 35.h,
),
@ -193,7 +197,7 @@ class _LockDetailPageState extends State<LockDetailPage>
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(16.r),
boxShadow: [
boxShadow: <BoxShadow>[
BoxShadow(
color: Colors.black.withOpacity(0.15),
offset: const Offset(0, 0),
@ -202,7 +206,7 @@ class _LockDetailPageState extends State<LockDetailPage>
),
]),
child: Row(
children: [
children: <Widget>[
Image.asset(
img,
width: 32.r,
@ -236,7 +240,7 @@ class _LockDetailPageState extends State<LockDetailPage>
fit: BoxFit.cover,
),
borderRadius: BorderRadius.circular(20.r),
boxShadow: [
boxShadow: <BoxShadow>[
BoxShadow(
color: Colors.black.withOpacity(0.15),
offset: const Offset(0, 0),
@ -247,19 +251,15 @@ class _LockDetailPageState extends State<LockDetailPage>
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
children: <Widget>[
const Spacer(),
GestureDetector(
onTap: state.openDoorBtnisUneable.value == true
? () {
isNeedRealNameAuthThenOpenLock();
}
? isNeedRealNameAuthThenOpenLock
: null,
onLongPressStart: state.openDoorBtnisUneable.value == true
? (details) {
setState(() {
startUnLock();
});
? (LongPressStartDetails details) {
setState(startUnLock);
}
: null,
child: Container(
@ -268,7 +268,7 @@ class _LockDetailPageState extends State<LockDetailPage>
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(100.w),
boxShadow: [
boxShadow: <BoxShadow>[
BoxShadow(
color: Colors.black.withOpacity(0.3),
offset: const Offset(0, 0),
@ -279,42 +279,44 @@ class _LockDetailPageState extends State<LockDetailPage>
margin: EdgeInsets.only(left: 35.w, bottom: 15.h),
child: Stack(
alignment: AlignmentDirectional.center,
children: [
state.openDoorBtnisUneable.value == false
? Icon(
Icons.bluetooth_searching,
size: 48.r,
color: AppColors.mainColor,
)
: Image.asset(
state.isOpenPassageMode.value == 1
? 'images/icon_lock_err.png'
: 'images/icon_lock_fill.png',
width: 38.r,
height: 38.r,
color: AppColors.mainColor,
),
state.openDoorBtnisUneable.value == false
? Positioned(
child: Icon(
Icons.bluetooth_searching,
size: 96.r,
),
)
: state.openLockBtnState.value == 1
? xhjBuildRotationTransition(
width: 88.r,
height: 88.r,
)
: Positioned(
child: Image.asset(
'images/icon_circle_dotted.png',
width: 88.r,
height: 88.r,
color: state.isOpenPassageMode.value == 1
? Colors.red
: AppColors.mainColor,
)),
children: <Widget>[
if (state.openDoorBtnisUneable.value == false)
Icon(
Icons.bluetooth_searching,
size: 48.r,
color: AppColors.mainColor,
)
else
Image.asset(
state.isOpenPassageMode.value == 1
? 'images/icon_lock_err.png'
: 'images/icon_lock_fill.png',
width: 38.r,
height: 38.r,
color: AppColors.mainColor,
),
if (state.openDoorBtnisUneable.value == false)
Positioned(
child: Icon(
Icons.bluetooth_searching,
size: 96.r,
),
)
else
state.openLockBtnState.value == 1
? xhjBuildRotationTransition(
width: 88.r,
height: 88.r,
)
: Positioned(
child: Image.asset(
'images/icon_circle_dotted.png',
width: 88.r,
height: 88.r,
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),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
children: <Widget>[
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
children: <Widget>[
Text(
TranslationLoader
.lanKeys!.clickUnlockAndHoldDownClose!.tr,
@ -341,16 +343,16 @@ class _LockDetailPageState extends State<LockDetailPage>
Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
children: <Widget>[
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
children: <Widget>[
Image.asset(
showElectricIcon(state.electricQuantity.value),
width: 30.w,
height: 24.w),
SizedBox(width: 2.w),
Text("${state.electricQuantity.value}%",
Text('${state.electricQuantity.value}%',
style: TextStyle(
fontSize: 18.sp,
color: AppColors.darkGrayTextColor)),
@ -368,13 +370,13 @@ class _LockDetailPageState extends State<LockDetailPage>
),
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
children: <Widget>[
Image.asset(
showElectricIcon(state.electricQuantity.value),
width: 30.w,
height: 24.w),
SizedBox(width: 2.w),
Text("--%",
Text('--%',
style: TextStyle(
fontSize: 18.sp,
color: AppColors.darkGrayTextColor)),
@ -400,32 +402,30 @@ class _LockDetailPageState extends State<LockDetailPage>
//
Widget skWidget() {
return ListView(
children: [
children: <Widget>[
Visibility(
visible:
((state.keyInfos.value.keyType == XSConstantMacro.keyTypeTime ||
state.keyInfos.value.keyType ==
XSConstantMacro.keyTypeLoop) && //
(DateTool().compareTimeGetDaysFromNow(
state.keyInfos.value.endDate!) <=
15 &&
DateTool().compareTimeGetDaysFromNow(
state.keyInfos.value.endDate!) >=
0) && // 030
(state.keyInfos.value.keyStatus ==
XSConstantMacro.keyStatusNormalUse ||
state.keyInfos.value.keyStatus ==
XSConstantMacro.keyStatusWaitReceive) // 使
)
? true
: false,
(state.keyInfos.value.keyType == XSConstantMacro.keyTypeTime ||
state.keyInfos.value.keyType ==
XSConstantMacro.keyTypeLoop) && //
(DateTool().compareTimeGetDaysFromNow(
state.keyInfos.value.endDate!) <=
15 &&
DateTool().compareTimeGetDaysFromNow(
state.keyInfos.value.endDate!) >=
0) && // 030
(state.keyInfos.value.keyStatus ==
XSConstantMacro.keyStatusNormalUse ||
state.keyInfos.value.keyStatus ==
XSConstantMacro.keyStatusWaitReceive) // 使
,
child: Container(
// height: 30.h,
color: const Color(0xFFFBEFD4),
padding: EdgeInsets.only(top: 8.h, bottom: 8.h),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
children: <Widget>[
Text(
"${"钥匙将在".tr}${DateTool().compareTimeGetDaysFromNow(state.keyInfos.value.endDate!)}${"天后失效".tr}",
style: TextStyle(
@ -434,26 +434,26 @@ class _LockDetailPageState extends State<LockDetailPage>
),
),
),
Stack(children: [
Stack(children: <Widget>[
Container(
width: 1.sw,
height: 1.sh - ScreenUtil().statusBarHeight,
color: Colors.white,
child: Column(
children: [
children: <Widget>[
topWidget(),
SizedBox(
height: 10.h,
),
Obx(() => buildPageIndicator()),
Obx(buildPageIndicator),
Expanded(
child: Container(
margin: EdgeInsets.only(left: 10.w, right: 10.w, top: 30.h),
child: PageView(
scrollDirection: Axis.horizontal,
controller: state.pageController,
children: [
Obx(() => bottomWidget()),
children: <Widget>[
Obx(bottomWidget),
attachmentWidget(),
],
),
@ -476,7 +476,7 @@ class _LockDetailPageState extends State<LockDetailPage>
Widget topWidget() {
return Column(
children: [
children: <Widget>[
F.sw(
defaultCall: () => SizedBox(height: 50.h),
xhjCall: () => Padding(
@ -490,7 +490,7 @@ class _LockDetailPageState extends State<LockDetailPage>
),
),
Stack(
children: [
children: <Widget>[
Center(
child: Text(
state.lockAlias.value,
@ -504,7 +504,7 @@ class _LockDetailPageState extends State<LockDetailPage>
Positioned(
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
children: <Widget>[
GestureDetector(
onTap: () {
ShowTipView().showSureAlertDialog(
@ -512,7 +512,7 @@ class _LockDetailPageState extends State<LockDetailPage>
},
child: Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
children: <Widget>[
FlavorsImg(
child: Image.asset(
showElectricIcon(state.electricQuantity.value),
@ -520,7 +520,7 @@ class _LockDetailPageState extends State<LockDetailPage>
height: 24.w),
),
SizedBox(width: 2.w),
Text("${state.electricQuantity.value}%",
Text('${state.electricQuantity.value}%',
style: TextStyle(
fontSize: 18.sp,
color: AppColors.darkGrayTextColor)),
@ -542,7 +542,7 @@ class _LockDetailPageState extends State<LockDetailPage>
1,
child: Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
children: <Widget>[
FlavorsImg(
child: Image.asset(
showElectricIcon(
@ -551,7 +551,7 @@ class _LockDetailPageState extends State<LockDetailPage>
height: 24.w),
),
SizedBox(width: 2.w),
Text("${state.electricQuantityStandby.value}%",
Text('${state.electricQuantityStandby.value}%',
style: TextStyle(
fontSize: 18.sp,
color: AppColors.darkGrayTextColor)),
@ -580,23 +580,19 @@ class _LockDetailPageState extends State<LockDetailPage>
color: Colors.white,
height: 330.w,
child: Stack(
children: [
children: <Widget>[
Center(
child: GestureDetector(
onTap: state.openDoorBtnisUneable.value == true
? () {
isNeedRealNameAuthThenOpenLock();
}
? isNeedRealNameAuthThenOpenLock
: null,
onLongPressStart: state.openDoorBtnisUneable.value == true
? (details) {
setState(() {
startUnLock();
});
? (LongPressStartDetails details) {
setState(startUnLock);
}
: null,
child: Stack(
children: [
children: <Widget>[
FlavorsImg(
child: Image.asset(
state.openDoorBtnisUneable.value == false
@ -609,31 +605,32 @@ class _LockDetailPageState extends State<LockDetailPage>
// color: AppColors.primaryTopColor,
),
),
state.openDoorBtnisUneable.value == false
? Positioned(
child: FlavorsImg(
if (state.openDoorBtnisUneable.value == false)
Positioned(
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(
'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,
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,
bottom: 1,
child: Obx(() => Visibility(
visible: state.keyInfos.value.lockSetting!.remoteUnlock == 1
? true
: false,
visible:
state.keyInfos.value.lockSetting!.remoteUnlock == 1,
child: GestureDetector(
onTap: () {
ShowCupertinoAlertView().isToRemoteUnLockAlert(
@ -672,7 +668,7 @@ class _LockDetailPageState extends State<LockDetailPage>
),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
children: <Widget>[
Text(
logic.getKeyStatusTextAndShow(),
style: TextStyle(
@ -685,9 +681,7 @@ class _LockDetailPageState extends State<LockDetailPage>
SizedBox(
height: 30.h,
),
F.sw(
defaultCall: () => adminInfoView(),
xhjCall: () => const SizedBox()),
F.sw(defaultCall: adminInfoView, xhjCall: () => const SizedBox()),
SizedBox(
height: 20.h,
),
@ -707,7 +701,7 @@ class _LockDetailPageState extends State<LockDetailPage>
mainAxisAlignment:
center ? MainAxisAlignment.center : MainAxisAlignment.start,
mainAxisSize: max ? MainAxisSize.max : MainAxisSize.min,
children: [
children: <Widget>[
Image.asset(
'images/icon_electronicKey_admin.png',
width: 24.w,
@ -742,7 +736,7 @@ class _LockDetailPageState extends State<LockDetailPage>
? AppColors.mainColor
: AppColors.btnDisableColor),
),
if (add) ...[
if (add) ...<Widget>[
const Spacer(),
GestureDetector(
onTap: () {
@ -752,7 +746,7 @@ class _LockDetailPageState extends State<LockDetailPage>
padding: const EdgeInsets.all(8.0),
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
children: <Widget>[
FlavorsImg(
child: Image.asset(
'images/mine/icon_mine_main_addLock.png',
@ -823,7 +817,7 @@ class _LockDetailPageState extends State<LockDetailPage>
Widget buildPageIndicator() {
return Row(
mainAxisAlignment: MainAxisAlignment.center,
children: List.generate(2, (index) {
children: List.generate(2, (int index) {
return Container(
width: 10.0.w,
height: 10.0.w,
@ -855,7 +849,7 @@ class _LockDetailPageState extends State<LockDetailPage>
//
List<Widget> getAttachmentWidget() {
var showWidgetArr = <Widget>[];
final List<Widget> showWidgetArr = <Widget>[];
// 线
// if (state.isAttendance.value == 1) {
// showWidgetArr.add(bottomItem(
@ -911,7 +905,7 @@ class _LockDetailPageState extends State<LockDetailPage>
//
List<Widget> getNormalWidget() {
List<Widget> showWidgetArr = <Widget>[];
final List<Widget> showWidgetArr = <Widget>[];
//
if (state.isAttendance.value == 1) {
showWidgetArr.add(bottomItem(
@ -928,15 +922,17 @@ class _LockDetailPageState extends State<LockDetailPage>
TranslationLoader.lanKeys!.operatingRecord!.tr,
state.bottomBtnisEable.value, () {
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',
TranslationLoader.lanKeys!.set!.tr, true, () {
Get.toNamed(Routers.lockSetPage, arguments: {
"lockId": state.keyInfos.value.lockId,
"isOnlyOneData": state.isOnlyOneData
Get.toNamed(Routers.lockSetPage, arguments: <String, Object?>{
'lockId': state.keyInfos.value.lockId,
'isOnlyOneData': state.isOnlyOneData
});
}));
@ -945,7 +941,7 @@ class _LockDetailPageState extends State<LockDetailPage>
//
List<Widget> getAllWidget() {
var showWidgetArr = <Widget>[];
final List<Widget> showWidgetArr = <Widget>[];
//
if (state.isAttendance.value == 1) {
showWidgetArr.add(bottomItem(
@ -971,7 +967,9 @@ class _LockDetailPageState extends State<LockDetailPage>
TranslationLoader.lanKeys!.password!.tr,
state.bottomBtnisEable.value, () {
Get.toNamed(Routers.passwordKeyListPage,
arguments: {"keyInfo": state.keyInfos.value});
arguments: <String, LockListInfoItemEntity>{
'keyInfo': state.keyInfos.value
});
}));
// ic卡
@ -980,8 +978,8 @@ class _LockDetailPageState extends State<LockDetailPage>
'images/main/icon_main_icCard.png',
TranslationLoader.lanKeys!.card!.tr,
state.bottomBtnisEable.value, () {
Get.toNamed(Routers.cardListPage, arguments: {
"lockId": state.keyInfos.value.lockId,
Get.toNamed(Routers.cardListPage, arguments: <String, int?>{
'lockId': state.keyInfos.value.lockId,
});
}));
}
@ -992,8 +990,8 @@ class _LockDetailPageState extends State<LockDetailPage>
'images/main/icon_main_fingerprint.png',
TranslationLoader.lanKeys!.fingerprint!.tr,
state.bottomBtnisEable.value, () {
Get.toNamed(Routers.fingerprintListPage, arguments: {
"lockId": state.keyInfos.value.lockId,
Get.toNamed(Routers.fingerprintListPage, arguments: <String, int?>{
'lockId': state.keyInfos.value.lockId,
});
}));
}
@ -1015,8 +1013,8 @@ class _LockDetailPageState extends State<LockDetailPage>
'images/main/icon_face.png',
TranslationLoader.lanKeys!.humanFace!.tr,
state.bottomBtnisEable.value, () {
Get.toNamed(Routers.faceListPage, arguments: {
"lockId": state.keyInfos.value.lockId,
Get.toNamed(Routers.faceListPage, arguments: <String, int?>{
'lockId': state.keyInfos.value.lockId,
});
}),
);
@ -1027,8 +1025,8 @@ class _LockDetailPageState extends State<LockDetailPage>
bottomItem(
'images/main/icon_iris.png', '虹膜'.tr, state.bottomBtnisEable.value,
() {
Get.toNamed(Routers.irisListPage, arguments: {
"lockId": state.keyInfos.value.lockId,
Get.toNamed(Routers.irisListPage, arguments: <String, int?>{
'lockId': state.keyInfos.value.lockId,
});
}),
);
@ -1039,8 +1037,8 @@ class _LockDetailPageState extends State<LockDetailPage>
bottomItem(
'images/main/icon_palm.png', '手掌'.tr, state.bottomBtnisEable.value,
() {
Get.toNamed(Routers.palmListPage, arguments: {
"lockId": state.keyInfos.value.lockId,
Get.toNamed(Routers.palmListPage, arguments: <String, int?>{
'lockId': state.keyInfos.value.lockId,
});
}),
);
@ -1053,9 +1051,9 @@ class _LockDetailPageState extends State<LockDetailPage>
'images/main/icon_catEyes.png',
TranslationLoader.lanKeys!.monitoring!.tr,
state.bottomBtnisEable.value, () {
Get.toNamed(Routers.realTimePicturePage, arguments: {
"lockName": state.keyInfos.value.lockName,
"isMonitoring": true
Get.toNamed(Routers.realTimePicturePage, arguments: <String, Object?>{
'lockName': state.keyInfos.value.lockName,
'isMonitoring': true
});
}),
);
@ -1068,11 +1066,13 @@ class _LockDetailPageState extends State<LockDetailPage>
TranslationLoader.lanKeys!.authorizedAdmin!.tr,
state.bottomBtnisEable.value, () {
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(
//
bottomItem(
@ -1082,7 +1082,9 @@ class _LockDetailPageState extends State<LockDetailPage>
// Get.toNamed(Routers.lockOperatingRecordPage,
// arguments: {"keyInfo": state.keyInfos.value});
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',
TranslationLoader.lanKeys!.videoLog!.tr,
state.bottomBtnisEable.value, () {
Get.toNamed(Routers.videoLogPage, arguments: {
"lockId": state.keyInfos.value.lockId,
Get.toNamed(Routers.videoLogPage, arguments: <String, int?>{
'lockId': state.keyInfos.value.lockId,
});
}));
}
@ -1103,8 +1105,8 @@ class _LockDetailPageState extends State<LockDetailPage>
'images/main/icon_lockDetail_messageReminding.png',
TranslationLoader.lanKeys!.messageReminding!.tr,
state.bottomBtnisEable.value, () {
Get.toNamed(Routers.msgNotificationPage, arguments: {
"lockId": state.keyInfos.value.lockId,
Get.toNamed(Routers.msgNotificationPage, arguments: <String, int?>{
'lockId': state.keyInfos.value.lockId,
});
}),
);
@ -1114,9 +1116,9 @@ class _LockDetailPageState extends State<LockDetailPage>
bottomItem('images/main/icon_main_set.png',
TranslationLoader.lanKeys!.set!.tr, true, () {
// logic.clickItemBtnAction(10);
Get.toNamed(Routers.lockSetPage, arguments: {
"lockId": state.keyInfos.value.lockId,
"isOnlyOneData": state.isOnlyOneData,
Get.toNamed(Routers.lockSetPage, arguments: <String, Object?>{
'lockId': state.keyInfos.value.lockId,
'isOnlyOneData': state.isOnlyOneData,
});
}),
);
@ -1126,12 +1128,12 @@ class _LockDetailPageState extends State<LockDetailPage>
Widget bottomItem(
String iconUrl, String name, bool bottomBtnisEable, Function() onClick) {
Widget child = F.sw(
final Widget child = F.sw(
defaultCall: () => Container(
color: Colors.white,
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
children: <Widget>[
SizedBox(
width: 42.w,
height: 42.h,
@ -1164,7 +1166,7 @@ class _LockDetailPageState extends State<LockDetailPage>
padding: EdgeInsets.symmetric(vertical: 15.h, horizontal: 15.w),
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
children: <Widget>[
SizedBox(
width: 42.w,
height: 42.h,
@ -1195,19 +1197,19 @@ class _LockDetailPageState extends State<LockDetailPage>
onTap: bottomBtnisEable
? onClick
: () {
logic.showToast("请在锁旁边完成第一次开锁".tr);
logic.showToast('请在锁旁边完成第一次开锁'.tr);
},
child: child,
);
}
listeningAnimations() async {
await Future.delayed(Duration.zero, () {
Future<void> listeningAnimations() async {
await Future<void>.delayed(Duration.zero, () {
state.animationController = AnimationController(
duration: const Duration(seconds: 1), vsync: this);
state.animationController!.repeat();
//StatusListener
state.animationController!.addStatusListener((status) {
state.animationController!.addStatusListener((AnimationStatus status) {
if (status == AnimationStatus.completed) {
state.animationController!.reset();
state.animationController!.forward();
@ -1237,7 +1239,7 @@ class _LockDetailPageState extends State<LockDetailPage>
Widget _unlockSuccessWidget() {
return Center(
child: Stack(
children: [
children: <Widget>[
Image.asset(
state.iSOpenLock.value == true
? 'images/main/unlocked_bg.png'
@ -1250,7 +1252,7 @@ class _LockDetailPageState extends State<LockDetailPage>
left: 55.w,
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
children: <Widget>[
Text(
state.keyInfos.value.lockAlias!,
style: TextStyle(
@ -1289,9 +1291,9 @@ class _LockDetailPageState extends State<LockDetailPage>
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;
}
@ -1303,24 +1305,20 @@ class _LockDetailPageState extends State<LockDetailPage>
DateTool().compareTimeIsOvertime(state.nextAuthTime.value) == true) {
AliyunRealNameAuthProvider(
getLockInfo: state.keyInfos.value,
onCertifyResultWithTime: ((bool isSuccess, int getNextAuthTime) {
onCertifyResultWithTime: (bool isSuccess, int getNextAuthTime) {
state.nextAuthTime.value = getNextAuthTime;
if (isSuccess) {
//
setState(() {
startOpenLock();
});
setState(startOpenLock);
}
})).initAliyunRealNameAuth();
}).initAliyunRealNameAuth();
} else {
//
setState(() {
startOpenLock();
});
setState(startOpenLock);
}
}
startOpenLock() {
void startOpenLock() {
if (state.openLockBtnState.value == 1) {
return;
}
@ -1329,21 +1327,21 @@ class _LockDetailPageState extends State<LockDetailPage>
state.openLockBtnState.value = 1;
state.animationController!.forward();
AppLog.log("点击开锁");
AppLog.log('点击开锁');
if (state.isOpenLockNeedOnline.value == 0) {
//
state.openDoorModel = 0;
AppLog.log("点击开锁 state.openDoorModel = 0 不需要联网");
AppLog.log('点击开锁 state.openDoorModel = 0 不需要联网');
logic.openDoorAction();
} else {
//
state.openDoorModel = 2;
AppLog.log("点击开锁 state.openDoorModel = 2 需要联网");
AppLog.log('点击开锁 state.openDoorModel = 2 需要联网');
logic.getLockNetToken();
}
}
startUnLock() {
void startUnLock() {
if (state.openLockBtnState.value == 1) {
return;
}
@ -1352,16 +1350,16 @@ class _LockDetailPageState extends State<LockDetailPage>
state.openLockBtnState.value = 1;
state.animationController!.forward();
EasyLoading.showToast("正在尝试闭锁……".tr, duration: 2000.milliseconds);
AppLog.log("长按闭锁");
EasyLoading.showToast('正在尝试闭锁……'.tr, duration: 2000.milliseconds);
AppLog.log('长按闭锁');
if (state.isOpenLockNeedOnline.value == 0) {
//
AppLog.log("长按闭锁 state.openDoorModel = 32 不需要联网");
AppLog.log('长按闭锁 state.openDoorModel = 32 不需要联网');
state.openDoorModel = 32;
logic.openDoorAction();
} else {
//
AppLog.log("长按闭锁 state.openDoorModel = 34 需要联网");
AppLog.log('长按闭锁 state.openDoorModel = 34 需要联网');
state.openDoorModel = 34;
logic.getLockNetToken();
}

View File

@ -15,10 +15,11 @@ import 'lockMain_state.dart';
class LockMainLogic extends BaseGetXController {
final LockMainState state = LockMainState();
Future<LockListInfoEntity> getStarLockInfo() async {
Future<LockListInfoEntity> getStarLockInfo({bool isUnShowLoading = false}) async {
LockListInfoEntity entity = await ApiRepository.to.getStarLockListInfo(
pageNo: pageNo,
pageSize: 50,
isUnShowLoading: isUnShowLoading,
);
if (entity.errorCode!.codeIsSuccessful) {
loadMainDataLogic(entity.data!);

View File

@ -37,14 +37,15 @@ class _StarLockMainPageState extends State<StarLockMainPage> with BaseWidget {
final logic = Get.put(LockMainLogic());
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 =
await Storage.getLockMainListData();
if (lockListInfoGroupEntity != null) {
var localLockListInfoGroupEntity = lockListInfoGroupEntity;
await logic.loadMainDataLogic(localLockListInfoGroupEntity);
}
await logic.getStarLockInfo();
await logic.getStarLockInfo(isUnShowLoading: isUnShowLoading);
await Future.delayed(const Duration(milliseconds: 200));
if (clearScanDevices) {
BlueManage().scanDevices.clear();
@ -237,7 +238,9 @@ class _StarLockMainPageState extends State<StarLockMainPage> with BaseWidget {
void _initLoadDataAction() {
_teamEvent = eventBus.on<RefreshLockListInfoDataEvent>().listen((event) {
logic.pageNo = 1;
getHttpData(clearScanDevices: event.clearScanDevices);
getHttpData(
clearScanDevices: event.clearScanDevices,
isUnShowLoading: event.isUnShowLoading);
});
}

View File

@ -171,7 +171,7 @@ class ApiProvider extends BaseProvider {
'idCardNumber': idCardNumber
}));
Future<Response> uploadElectricQuantity(
Future<Response<dynamic>> uploadElectricQuantity(
String electricQuantity,
String electricQuantityStandby,
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,
jsonEncode({
"pageNo": pageNo,
'pageSize': pageSize,
}));
}),isUnShowLoading: isUnShowLoading);
//
Future<Response> getLockSettingInfoData(String lockId) => post(

View File

@ -37,7 +37,6 @@ class BaseProvider extends GetConnect with Api {
}) async {
AppLog.log("post: url:$url body:$body");
if (isUnShowLoading == false){
// AppLog.log("post: url:$url show loading");
EasyLoading.show();
}
if (isUserBaseUrl == false) {

View File

@ -421,8 +421,8 @@ class ApiRepository {
//
Future<LockListInfoEntity> getStarLockListInfo(
{required int pageNo, required int pageSize}) async {
final res = await apiProvider.getStarLockListInfo(pageNo, pageSize);
{required int pageNo, required int pageSize,required bool isUnShowLoading}) async {
final res = await apiProvider.getStarLockListInfo(pageNo, pageSize,isUnShowLoading:isUnShowLoading);
return LockListInfoEntity.fromJson(res.body);
}

View File

@ -9,8 +9,10 @@ EventBus eventBus = EventBus();
class RefreshLockListInfoDataEvent {
//
bool clearScanDevices;
bool isUnShowLoading;
RefreshLockListInfoDataEvent({this.clearScanDevices = false});
RefreshLockListInfoDataEvent(
{this.clearScanDevices = false, this.isUnShowLoading = false});
}
///