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: [
_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<CommunityStructureArea> {
Offset(
screenSize.width / 2 - 75, // Center horizontally
screenSize.height / 2 -
100, // Slightly above the center vertically
50, // Slightly above the center vertically
);
SpaceData newSpace =