diff --git a/lib/pages/spaces_management/widgets/community_structure_widget.dart b/lib/pages/spaces_management/widgets/community_structure_widget.dart index cdeccf32..6de9e06c 100644 --- a/lib/pages/spaces_management/widgets/community_structure_widget.dart +++ b/lib/pages/spaces_management/widgets/community_structure_widget.dart @@ -91,7 +91,6 @@ class _CommunityStructureAreaState extends State { @override Widget build(BuildContext context) { - final visibleSpaces = flattenSpaces(spaces); Size screenSize = MediaQuery.of(context).size; return Expanded( child: GestureDetector( @@ -111,7 +110,6 @@ class _CommunityStructureAreaState extends State { Flexible( child: Stack( children: [ - if (visibleSpaces.isNotEmpty) InteractiveViewer( transformationController: _transformationController, boundaryMargin: EdgeInsets.all(500), @@ -130,7 +128,8 @@ class _CommunityStructureAreaState extends State { : 0.3, // Adjust opacity child: CustomPaint(painter: CurvedLinePainter([connection])), ), - for (var entry in visibleSpaces.asMap().entries) + for (var entry in spaces.asMap().entries) + if(entry.value.status != SpaceStatus.deleted) Positioned( left: entry.value.position.dx, top: entry.value.position.dy, @@ -139,7 +138,7 @@ class _CommunityStructureAreaState extends State { onButtonTap: (int index, Offset newPosition, String direction) { _showCreateSpaceDialog( screenSize, - position: visibleSpaces[index].position + newPosition, + position: spaces[index].position + newPosition, parentIndex: index, direction: direction, ); @@ -153,20 +152,20 @@ class _CommunityStructureAreaState extends State { }, buildSpaceContainer: (int index) { final bool isHighlighted = - _isHighlightedSpace(visibleSpaces[index]); + _isHighlightedSpace(spaces[index]); return Opacity( opacity: isHighlighted ? 1.0 : 0.3, child: SpaceContainerWidget( index: index, onDoubleTap: () { - _showEditSpaceDialog(visibleSpaces[index]); + _showEditSpaceDialog(spaces[index]); }, onTap: () { - _selectSpace(visibleSpaces[index]); + _selectSpace(spaces[index]); }, - icon: visibleSpaces[index].icon ?? '', - name: visibleSpaces[index].name, + icon: spaces[index].icon ?? '', + name: spaces[index].name, )); }, ), @@ -175,7 +174,7 @@ class _CommunityStructureAreaState extends State { ), ), ), - if (visibleSpaces.isEmpty) + if (spaces.isEmpty) Center( child: AddSpaceButton( onTap: () {