mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-07-15 01:35:25 +00:00
fixed space select
This commit is contained in:
@ -37,16 +37,29 @@ class _LoadedStateViewState extends State<LoadedSpaceView> {
|
||||
Row(
|
||||
children: [
|
||||
SidebarWidget(
|
||||
communities: widget.communities,
|
||||
onCommunitySelected: widget.onCommunitySelected,
|
||||
onSpaceSelected: widget.onSpaceSelected,
|
||||
),
|
||||
communities: widget.communities,
|
||||
onCommunitySelected: widget.onCommunitySelected,
|
||||
onSpaceSelected: widget.onSpaceSelected,
|
||||
selectedSpaceUuid: widget.selectedSpace?.uuid,
|
||||
onSelectedSpaceChanged: (String? spaceUuid) {
|
||||
setState(() {
|
||||
final selectedSpace = findSpaceByUuid(spaceUuid, widget.communities);
|
||||
if (selectedSpace != null) {
|
||||
widget.onSpaceSelected!(selectedSpace);
|
||||
}
|
||||
});
|
||||
}),
|
||||
CommunityStructureArea(
|
||||
selectedCommunity: widget.selectedCommunity,
|
||||
selectedSpace: widget.selectedSpace,
|
||||
spaces: widget.selectedCommunity?.spaces ?? [],
|
||||
connections: [],
|
||||
connections: const [],
|
||||
products: widget.products,
|
||||
onSpaceSelected: (SpaceModel? space) {
|
||||
setState(() {
|
||||
widget.onSpaceSelected!(space);
|
||||
});
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
@ -54,4 +67,13 @@ class _LoadedStateViewState extends State<LoadedSpaceView> {
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
SpaceModel? findSpaceByUuid(String? uuid, List<CommunityModel> communities) {
|
||||
for (var community in communities) {
|
||||
for (var space in community.spaces) {
|
||||
if (space.uuid == uuid) return space;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user