From 084f4fbda839636b6088ee6ebd81d86074a2566b Mon Sep 17 00:00:00 2001 From: hannathkadher Date: Thu, 28 Nov 2024 20:02:41 +0400 Subject: [PATCH] updated highlighted space --- .../widgets/community_structure_widget.dart | 20 ++++++++----------- 1 file changed, 8 insertions(+), 12 deletions(-) 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) {