From c7c88987631551721db1dde86065c7bce5cfeb77 Mon Sep 17 00:00:00 2001 From: Faris Armoush Date: Sun, 13 Apr 2025 12:52:38 +0300 Subject: [PATCH] removed redundant code. --- .../all_spaces/widgets/sidebar_widget.dart | 20 ++++++++----------- 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/lib/pages/spaces_management/all_spaces/widgets/sidebar_widget.dart b/lib/pages/spaces_management/all_spaces/widgets/sidebar_widget.dart index a98dead8..b7eacc0b 100644 --- a/lib/pages/spaces_management/all_spaces/widgets/sidebar_widget.dart +++ b/lib/pages/spaces_management/all_spaces/widgets/sidebar_widget.dart @@ -120,8 +120,6 @@ class _SidebarWidgetState extends State { } Widget _buildCommunityTile(BuildContext context, CommunityModel community) { - final hasChildren = community.spaces.isNotEmpty; - return CommunityTile( title: community.name, key: ValueKey(community.uuid), @@ -140,16 +138,14 @@ class _SidebarWidgetState extends State { ); }, onExpansionChanged: (title, expanded) {}, - children: hasChildren - ? community.spaces - .where((space) { - final isDeleted = space.status != SpaceStatus.deleted; - final isParentDeleted = space.status != SpaceStatus.parentDeleted; - return (isDeleted || isParentDeleted); - }) - .map((space) => _buildSpaceTile(space: space, community: community)) - .toList() - : null, + children: community.spaces + .where((space) { + final isDeleted = space.status != SpaceStatus.deleted; + final isParentDeleted = space.status != SpaceStatus.parentDeleted; + return (isDeleted || isParentDeleted); + }) + .map((space) => _buildSpaceTile(space: space, community: community)) + .toList(), ); }