diff --git a/lib/pages/spaces_management/widgets/community_structure_widget.dart b/lib/pages/spaces_management/widgets/community_structure_widget.dart index a1e295e3..eedde30e 100644 --- a/lib/pages/spaces_management/widgets/community_structure_widget.dart +++ b/lib/pages/spaces_management/widgets/community_structure_widget.dart @@ -485,18 +485,14 @@ class _CommunityStructureAreaState extends State { } bool _isHighlightedSpace(SpaceModel space) { - if (widget.selectedSpace == null) return true; - if (space == widget.selectedSpace) return true; - if (widget.selectedSpace?.parent?.internalId == space.internalId) - return true; - if (widget.selectedSpace?.children != null) { - for (var child in widget.selectedSpace!.children) { - if (child.internalId == space.internalId) { - return true; - } - } - } - return false; + final selectedSpace = widget.selectedSpace; + if (selectedSpace == null) return true; + + return space == selectedSpace || + selectedSpace.parent?.internalId == space.internalId || + selectedSpace.children + ?.any((child) => child.internalId == space.internalId) == + true; } void _deselectSpace(BuildContext context) {