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