diff --git a/lib/pages/spaces_management/widgets/community_structure_widget.dart b/lib/pages/spaces_management/widgets/community_structure_widget.dart index 3e628810..df72adad 100644 --- a/lib/pages/spaces_management/widgets/community_structure_widget.dart +++ b/lib/pages/spaces_management/widgets/community_structure_widget.dart @@ -39,65 +39,68 @@ class _CommunityStructureAreaState extends State { children: [ _buildHeader(), Flexible( - child: InteractiveViewer( - boundaryMargin: EdgeInsets.all(500), - minScale: 0.5, - maxScale: 3.0, - constrained: false, - child: Container( - width: canvasWidth, - height: canvasHeight, - child: spaces.isEmpty - ? Center( - child: AddSpaceButton( - onTap: () { - _showCreateSpaceDialog(screenSize); - }, - ), - ) - : Stack( - children: [ - for (var connection in connections) - CustomPaint( - painter: CurvedLinePainter([connection])), - for (var entry in spaces.asMap().entries) - Positioned( - left: entry.value.position.dx, - top: entry.value.position.dy, - child: SpaceCardWidget( - index: entry.key, - onButtonTap: (int index, Offset newPosition, - String direction) { - _showCreateSpaceDialog( - screenSize, - position: - spaces[index].position + newPosition, - parentIndex: index, - direction: direction, - ); - }, - position: entry.value.position, - isHovered: entry.value.isHovered, - screenSize: screenSize, - onHoverChanged: _handleHoverChanged, - onPositionChanged: (newPosition) { - _updateNodePosition( - entry.value, newPosition); - }, - buildSpaceContainer: (int index) { - return SpaceContainerWidget( - index: index, - icon: spaces[index].icon, - name: spaces[index].name, - ); - }, - ), + child: Stack( + children: [ + if (spaces.isNotEmpty) + InteractiveViewer( + boundaryMargin: EdgeInsets.all(500), + minScale: 0.5, + maxScale: 3.0, + constrained: false, + child: Container( + width: canvasWidth, + height: canvasHeight, + child: Stack( + children: [ + for (var connection in connections) + CustomPaint( + painter: CurvedLinePainter([connection])), + for (var entry in spaces.asMap().entries) + Positioned( + left: entry.value.position.dx, + top: entry.value.position.dy, + child: SpaceCardWidget( + index: entry.key, + onButtonTap: (int index, Offset newPosition, + String direction) { + _showCreateSpaceDialog( + screenSize, + position: + spaces[index].position + newPosition, + parentIndex: index, + direction: direction, + ); + }, + position: entry.value.position, + isHovered: entry.value.isHovered, + screenSize: screenSize, + onHoverChanged: _handleHoverChanged, + onPositionChanged: (newPosition) { + _updateNodePosition(entry.value, newPosition); + }, + buildSpaceContainer: (int index) { + return SpaceContainerWidget( + index: index, + icon: spaces[index].icon, + name: spaces[index].name, + ); + }, ), - ], - ), - ), - ), - ), + ), + ], + ), + ), + ), + if (spaces.isEmpty) + Center( + child: AddSpaceButton( + onTap: () { + _showCreateSpaceDialog(screenSize); + }, + ), + ), + ], + )), ], ), ), @@ -182,7 +185,7 @@ class _CommunityStructureAreaState extends State { Offset( screenSize.width / 2 - 75, // Center horizontally screenSize.height / 2 - - 100, // Slightly above the center vertically + 50, // Slightly above the center vertically ); SpaceData newSpace =