updated highlighted space

This commit is contained in:
hannathkadher
2024-11-28 20:02:41 +04:00
parent 817671dbeb
commit 084f4fbda8

View File

@ -485,18 +485,14 @@ class _CommunityStructureAreaState extends State<CommunityStructureArea> {
} }
bool _isHighlightedSpace(SpaceModel space) { bool _isHighlightedSpace(SpaceModel space) {
if (widget.selectedSpace == null) return true; final selectedSpace = widget.selectedSpace;
if (space == widget.selectedSpace) return true; if (selectedSpace == null) return true;
if (widget.selectedSpace?.parent?.internalId == space.internalId)
return true; return space == selectedSpace ||
if (widget.selectedSpace?.children != null) { selectedSpace.parent?.internalId == space.internalId ||
for (var child in widget.selectedSpace!.children) { selectedSpace.children
if (child.internalId == space.internalId) { ?.any((child) => child.internalId == space.internalId) ==
return true; true;
}
}
}
return false;
} }
void _deselectSpace(BuildContext context) { void _deselectSpace(BuildContext context) {