fix:修复添加锁之后不出现在列表的问题
This commit is contained in:
parent
9ac54cc971
commit
cf2fd775ec
@ -189,6 +189,7 @@ class ConfiguringWifiLogic extends BaseGetXController {
|
||||
Get.offAllNamed(Routers.starLockMain);
|
||||
}
|
||||
eventBus.fire(SuccessfulDistributionNetwork());
|
||||
eventBus.fire(RefreshLockListInfoDataEvent());
|
||||
});
|
||||
|
||||
// 获取锁设置
|
||||
|
||||
@ -61,7 +61,7 @@ class LockListLogic extends BaseGetXController {
|
||||
void setLockListInfoGroupEntity(LockListInfoGroupEntity entity) {
|
||||
this.entity = entity;
|
||||
// if (entity.pageNo == 1) {
|
||||
_groupDataList = <GroupList>[];
|
||||
_groupDataList = <GroupList>[];
|
||||
// }
|
||||
_groupDataList.addAll(entity.groupList!);
|
||||
update();
|
||||
@ -69,6 +69,7 @@ class LockListLogic extends BaseGetXController {
|
||||
|
||||
// 监听蓝牙协议返回结果
|
||||
late StreamSubscription<Reply> _replySubscription;
|
||||
late StreamSubscription _setLockListInfoGroupEntity;
|
||||
|
||||
void _initReplySubscription() {
|
||||
_replySubscription =
|
||||
@ -336,6 +337,7 @@ class LockListLogic extends BaseGetXController {
|
||||
void onReady() {
|
||||
super.onReady();
|
||||
_initReplySubscription();
|
||||
_initEventHandler();
|
||||
}
|
||||
|
||||
@override
|
||||
@ -348,5 +350,14 @@ class LockListLogic extends BaseGetXController {
|
||||
@override
|
||||
void onClose() {
|
||||
_replySubscription.cancel();
|
||||
_setLockListInfoGroupEntity.cancel();
|
||||
}
|
||||
|
||||
void _initEventHandler() {
|
||||
_setLockListInfoGroupEntity = eventBus
|
||||
.on<SetLockListInfoGroupEntity>()
|
||||
.listen((SetLockListInfoGroupEntity event) async {
|
||||
setLockListInfoGroupEntity(event.lockListInfoGroupEntity);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@ -132,20 +132,21 @@ class LockMainLogic extends BaseGetXController {
|
||||
state.lockListInfoGroupEntity.refresh();
|
||||
// AppLog.log('entity:$entity state.lockListInfoGroupEntity.value.groupList!.length:${state.lockListInfoGroupEntity.value.groupList![0].lockList!.length}');
|
||||
//检测控制器是否存在
|
||||
if (Get.isRegistered<LockListLogic>()) {
|
||||
//设置控制器数据并刷新
|
||||
// AppLog.log('检测控制器是否存 调用了 setLockListInfoGroupEntity');
|
||||
Get.find<LockListLogic>().setLockListInfoGroupEntity(entity);
|
||||
} else {
|
||||
//延迟加载
|
||||
Future<dynamic>.delayed(200.milliseconds, () {
|
||||
if (Get.isRegistered<LockListLogic>()) {
|
||||
//设置控制器数据并刷新
|
||||
// AppLog.log('检测控制器是否存 延迟调用了 setLockListInfoGroupEntity');
|
||||
Get.find<LockListLogic>().setLockListInfoGroupEntity(entity);
|
||||
}
|
||||
});
|
||||
}
|
||||
eventBus.fire(SetLockListInfoGroupEntity(lockListInfoGroupEntity: entity));
|
||||
// if (Get.isRegistered<LockListLogic>()) {
|
||||
// //设置控制器数据并刷新
|
||||
// // AppLog.log('检测控制器是否存 调用了 setLockListInfoGroupEntity');
|
||||
// Get.find<LockListLogic>().setLockListInfoGroupEntity(entity);
|
||||
// } else {
|
||||
// //延迟加载
|
||||
// Future<dynamic>.delayed(500.milliseconds, () {
|
||||
// if (Get.isRegistered<LockListLogic>()) {
|
||||
// //设置控制器数据并刷新
|
||||
// // AppLog.log('检测控制器是否存 延迟调用了 setLockListInfoGroupEntity');
|
||||
// Get.find<LockListLogic>().setLockListInfoGroupEntity(entity);
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
|
||||
if (state.dataLength.value == 1) {
|
||||
if (Get.isRegistered<LockDetailLogic>()) {
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
import 'package:event_bus/event_bus.dart';
|
||||
import 'package:star_lock/main/lockMian/entity/lockListInfo_entity.dart';
|
||||
|
||||
import '../main/lockDetail/lockSet/lockSet/lockSetInfo_entity.dart';
|
||||
|
||||
@ -195,6 +196,7 @@ class RogerThatLockInfoDataEvent {
|
||||
class GetGatewayListRefreshUI {
|
||||
GetGatewayListRefreshUI();
|
||||
}
|
||||
|
||||
/// 同意隐私协议
|
||||
class AgreePrivacyAgreement {
|
||||
AgreePrivacyAgreement();
|
||||
@ -204,3 +206,10 @@ class AgreePrivacyAgreement {
|
||||
class SuccessfulDistributionNetwork {
|
||||
SuccessfulDistributionNetwork();
|
||||
}
|
||||
|
||||
/// 设置锁列表数据
|
||||
class SetLockListInfoGroupEntity {
|
||||
SetLockListInfoGroupEntity({required this.lockListInfoGroupEntity});
|
||||
|
||||
LockListInfoGroupEntity lockListInfoGroupEntity;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user