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