mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-08-24 14:32:27 +00:00
Adjust layout in CommunityStructureCanvas by adding horizontal padding to positions and refining target position calculations for improved spacing and alignment. Enhance Stack widget behavior by allowing overflow clipping.
This commit is contained in:
@ -257,6 +257,13 @@ class _CommunityStructureCanvasState extends State<CommunityStructureCanvas>
|
||||
final levelXOffset = <int, double>{};
|
||||
_calculateLayout(community.spaces, 0, levelXOffset);
|
||||
|
||||
const horizontalCanvasPadding = 100.0;
|
||||
final originalPositions = Map.of(_positions);
|
||||
_positions.clear();
|
||||
for (final entry in originalPositions.entries) {
|
||||
_positions[entry.key] = entry.value.translate(horizontalCanvasPadding, 0);
|
||||
}
|
||||
|
||||
final selectedSpace = widget.selectedSpace;
|
||||
final highlightedUuids = <String>{};
|
||||
if (selectedSpace != null) {
|
||||
@ -274,7 +281,7 @@ class _CommunityStructureCanvasState extends State<CommunityStructureCanvas>
|
||||
community: widget.community,
|
||||
);
|
||||
|
||||
final createButtonX = levelXOffset[0] ?? 0.0;
|
||||
final createButtonX = (levelXOffset[0] ?? 0.0) + horizontalCanvasPadding;
|
||||
const createButtonY = 0.0;
|
||||
|
||||
widgets.add(
|
||||
@ -306,10 +313,12 @@ class _CommunityStructureCanvasState extends State<CommunityStructureCanvas>
|
||||
CommunityModel? community,
|
||||
SpaceModel? parent,
|
||||
}) {
|
||||
const targetWidth = 40.0;
|
||||
final padding = (_horizontalSpacing - targetWidth) / 2;
|
||||
if (spaces.isNotEmpty) {
|
||||
final firstChildPos = _positions[spaces.first.uuid]!;
|
||||
final targetPos = Offset(
|
||||
firstChildPos.dx - (_horizontalSpacing / 4),
|
||||
firstChildPos.dx - padding - targetWidth,
|
||||
firstChildPos.dy,
|
||||
);
|
||||
widgets.add(_buildDropTarget(parent, community, 0, targetPos));
|
||||
@ -391,7 +400,7 @@ class _CommunityStructureCanvasState extends State<CommunityStructureCanvas>
|
||||
);
|
||||
|
||||
final targetPos = Offset(
|
||||
position.dx + cardWidth + (_horizontalSpacing / 4) - 20,
|
||||
position.dx + cardWidth + padding,
|
||||
position.dy,
|
||||
);
|
||||
widgets.add(_buildDropTarget(parent, community, i + 1, targetPos));
|
||||
@ -505,7 +514,7 @@ class _CommunityStructureCanvasState extends State<CommunityStructureCanvas>
|
||||
child: SizedBox(
|
||||
width: context.screenWidth * 5,
|
||||
height: context.screenHeight * 5,
|
||||
child: Stack(children: treeWidgets),
|
||||
child: Stack(clipBehavior: Clip.none, children: treeWidgets),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
Reference in New Issue
Block a user