fix:修复登录时设备列表会显示无数据
This commit is contained in:
parent
e30530f3d5
commit
178dbdb937
@ -36,16 +36,16 @@ class LockMainLogic extends BaseGetXController {
|
|||||||
isUnShowLoading: isUnShowLoading,
|
isUnShowLoading: isUnShowLoading,
|
||||||
);
|
);
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
loadMainDataLogic(entity.data!);
|
await loadMainDataLogic(entity.data!);
|
||||||
}
|
}
|
||||||
return entity;
|
return entity;
|
||||||
}
|
}
|
||||||
|
|
||||||
void loadMainDataLogic(LockListInfoGroupEntity entity) {
|
Future<void> loadMainDataLogic(LockListInfoGroupEntity entity) async {
|
||||||
final bool every = entity.groupList?.every((GroupList list) =>
|
final bool every = entity.groupList?.every((GroupList list) =>
|
||||||
(list.lockList ?? <LockListInfoItemEntity>[]).isEmpty) ??
|
(list.lockList ?? <LockListInfoItemEntity>[]).isEmpty) ??
|
||||||
false;
|
true;
|
||||||
if ((entity.groupList??<GroupList>[]).isEmpty || every) {
|
if ((entity.groupList ?? <GroupList>[]).isEmpty || every) {
|
||||||
state.dataLength.value = 0;
|
state.dataLength.value = 0;
|
||||||
} else if (entity.groupList!.length == 1) {
|
} else if (entity.groupList!.length == 1) {
|
||||||
final GroupList groupList = entity.groupList![0];
|
final GroupList groupList = entity.groupList![0];
|
||||||
@ -71,7 +71,7 @@ class LockMainLogic extends BaseGetXController {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
Storage.saveMainListData(entity);
|
await Storage.saveMainListData(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// 获取联网类型
|
/// 获取联网类型
|
||||||
|
|||||||
@ -45,27 +45,25 @@ class _StarLockMainPageState extends State<StarLockMainPage>
|
|||||||
await Storage.getLockMainListData();
|
await Storage.getLockMainListData();
|
||||||
if (lockListInfoGroupEntity != null) {
|
if (lockListInfoGroupEntity != null) {
|
||||||
logic.loadMainDataLogic(lockListInfoGroupEntity);
|
logic.loadMainDataLogic(lockListInfoGroupEntity);
|
||||||
|
setState(() {});
|
||||||
}
|
}
|
||||||
lockListInfoGroupEntity =
|
lockListInfoGroupEntity =
|
||||||
(await logic.getStarLockInfo(isUnShowLoading: isUnShowLoading)).data;
|
(await logic.getStarLockInfo(isUnShowLoading: isUnShowLoading)).data;
|
||||||
if (lockListInfoGroupEntity != null) {
|
if (lockListInfoGroupEntity != null) {
|
||||||
logic.loadMainDataLogic(lockListInfoGroupEntity);
|
logic.loadMainDataLogic(lockListInfoGroupEntity);
|
||||||
|
setState(() {});
|
||||||
}
|
}
|
||||||
if (clearScanDevices) {
|
if (clearScanDevices) {
|
||||||
BlueManage().scanDevices.clear();
|
BlueManage().scanDevices.clear();
|
||||||
}
|
}
|
||||||
setState(() {});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
WidgetsBinding.instance.addPostFrameCallback((_) async {
|
logic.pageNo = 1;
|
||||||
logic.pageNo = 1;
|
getHttpData();
|
||||||
getHttpData();
|
_initLoadDataAction();
|
||||||
_initLoadDataAction();
|
|
||||||
setState(() {});
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user