fix:修复添加锁之后不出现在列表的问题
This commit is contained in:
parent
cf2fd775ec
commit
310062513b
@ -189,7 +189,7 @@ class ConfiguringWifiLogic extends BaseGetXController {
|
||||
Get.offAllNamed(Routers.starLockMain);
|
||||
}
|
||||
eventBus.fire(SuccessfulDistributionNetwork());
|
||||
eventBus.fire(RefreshLockListInfoDataEvent());
|
||||
eventBus.fire(RefreshLockListInfoDataEvent(clearScanDevices: true,isUnShowLoading: true));
|
||||
});
|
||||
|
||||
// 获取锁设置
|
||||
|
||||
@ -27,13 +27,13 @@ class LockListLogic extends BaseGetXController {
|
||||
LockListLogic(this.entity) {}
|
||||
|
||||
LockListState state = LockListState();
|
||||
List<GroupList> _groupDataList = <GroupList>[];
|
||||
final RxList<GroupList> groupDataList = <GroupList>[].obs;
|
||||
LockListInfoGroupEntity? entity;
|
||||
final ShowTipView showTipView = ShowTipView();
|
||||
|
||||
List<GroupList> get groupDataList {
|
||||
List<GroupList> get groupDataListFiltered {
|
||||
final List<GroupList> list =
|
||||
_groupDataList.map((GroupList e) => e.copy()).toList();
|
||||
groupDataList.map((GroupList e) => e.copy()).toList();
|
||||
if (state.searchStr.value != '' && state.showSearch.value) {
|
||||
list.forEach((GroupList element) {
|
||||
element.lockList?.removeWhere((LockListInfoItemEntity element) =>
|
||||
@ -60,11 +60,7 @@ class LockListLogic extends BaseGetXController {
|
||||
//设置数据
|
||||
void setLockListInfoGroupEntity(LockListInfoGroupEntity entity) {
|
||||
this.entity = entity;
|
||||
// if (entity.pageNo == 1) {
|
||||
_groupDataList = <GroupList>[];
|
||||
// }
|
||||
_groupDataList.addAll(entity.groupList!);
|
||||
update();
|
||||
groupDataList.value = entity.groupList!;
|
||||
}
|
||||
|
||||
// 监听蓝牙协议返回结果
|
||||
@ -343,8 +339,11 @@ class LockListLogic extends BaseGetXController {
|
||||
@override
|
||||
void onInit() {
|
||||
super.onInit();
|
||||
// AppLog.log('onInit调用了 setLockListInfoGroupEntity');
|
||||
setLockListInfoGroupEntity(entity!);
|
||||
AppLog.log('[onInit] entity: \\${entity?.toString()}');
|
||||
if (entity != null) {
|
||||
setLockListInfoGroupEntity(entity!);
|
||||
}
|
||||
_initEventHandler();
|
||||
}
|
||||
|
||||
@override
|
||||
|
||||
@ -37,32 +37,31 @@ class _LockListPageState extends State<LockListPage> with RouteAware {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return GetBuilder<LockListLogic>(builder: (LockListLogic logic) {
|
||||
return Scaffold(
|
||||
body: ListView.separated(
|
||||
itemCount: logic.groupDataList.length,
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
final GroupList itemData = logic.groupDataList[index];
|
||||
return _buildLockExpandedList(context, index, itemData);
|
||||
},
|
||||
shrinkWrap: true,
|
||||
physics: const AlwaysScrollableScrollPhysics(),
|
||||
separatorBuilder: (BuildContext context, int index) {
|
||||
return const Divider(
|
||||
height: 1,
|
||||
color: AppColors.greyLineColor,
|
||||
);
|
||||
}),
|
||||
);
|
||||
});
|
||||
return Obx(() => Scaffold(
|
||||
body: ListView.separated(
|
||||
itemCount: logic.groupDataListFiltered.length,
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
final GroupList itemData = logic.groupDataListFiltered[index];
|
||||
return _buildLockExpandedList(context, index, itemData, key: ValueKey(itemData.groupId));
|
||||
},
|
||||
shrinkWrap: true,
|
||||
physics: const AlwaysScrollableScrollPhysics(),
|
||||
separatorBuilder: (BuildContext context, int index) {
|
||||
return const Divider(
|
||||
height: 1,
|
||||
color: AppColors.greyLineColor,
|
||||
);
|
||||
}),
|
||||
));
|
||||
}
|
||||
|
||||
//设备多层级列表
|
||||
Widget _buildLockExpandedList(BuildContext context, int index,
|
||||
GroupList itemData) {
|
||||
GroupList itemData, {Key? key}) {
|
||||
final List<LockListInfoItemEntity> lockItemList =
|
||||
itemData.lockList ?? <LockListInfoItemEntity>[];
|
||||
return LockListGroupView(
|
||||
key: key,
|
||||
onTap: () {
|
||||
//是否选中组
|
||||
if (itemData.isChecked) {} else {}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user