removed space create button out of interactive viewer

This commit is contained in:
hannathkadher
2024-11-15 00:46:24 +04:00
parent de57e0f21d
commit 1d9a93646b

View File

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