fixed space clipping

This commit is contained in:
hannathkadher
2024-10-09 12:52:34 +04:00
parent 1255a44935
commit e09dc966e0

View File

@ -162,69 +162,66 @@ class SpaceManagementPageState extends State<SpaceManagementPage> {
panEnabled: true, // Enable panning panEnabled: true, // Enable panning
scaleEnabled: true, // Enable zooming scaleEnabled: true, // Enable zooming
child: Container( child: Container(
width: 2000, // Large canvas color: ColorsManager
height: 2000, // Large canvas .transparentColor, // Transparent background
color: child: spaces.isEmpty
ColorsManager.transparentColor, // Transparent background ? Center(
child: Stack( child: AddSpaceButton(
clipBehavior: Clip.none,
children: [
// Draw lines using a CustomPaint widget
CustomPaint(
size: Size(2000, 2000), // Explicit canvas size
painter: CurvedLinePainter(connections),
),
spaces.isEmpty
? Center(child: AddSpaceButton(
onTap: () { onTap: () {
_showCreateSpaceDialog(screenSize); _showCreateSpaceDialog(screenSize);
}, },
))
: Stack(
children: spaces
.asMap()
.entries
.map((entry) => SpaceCardWidget(
index: entry.key,
screenSize: screenSize,
position: spaces[entry.key].position,
isHovered: spaces[entry.key].isHovered,
onPanUpdate: (int index, Offset delta) {
setState(() {
spaces[index].position += delta;
});
},
onHoverChanged:
(int index, bool isHovered) {
setState(() {
spaces[index].isHovered = isHovered;
});
},
onButtonTap: (int index,
Offset newPosition,
String direction) {
_showCreateSpaceDialog(
screenSize,
position: spaces[index].position +
newPosition,
parentIndex: index,
direction: direction,
);
},
buildSpaceContainer: (int index) {
return SpaceContainerWidget(
index: index,
icon: spaces[index].icon,
name: spaces[index].name,
);
},
))
.toList(),
), ),
], )
), : Stack(
), clipBehavior: Clip.none,
children: [
CustomPaint(
size: Size(4000, 4000),
painter: CurvedLinePainter(connections),
),
...spaces.asMap().entries.map((entry) {
final space = entry.value;
return Positioned(
left: space.position.dx,
top: space.position.dy,
child: SpaceCardWidget(
index: entry.key,
screenSize: screenSize,
position: space.position,
isHovered: space.isHovered,
onPanUpdate: (int index, Offset delta) {
setState(() {
spaces[index].position += delta;
});
},
onHoverChanged:
(int index, bool isHovered) {
setState(() {
spaces[index].isHovered = isHovered;
});
},
onButtonTap: (int index, Offset newPosition,
String direction) {
_showCreateSpaceDialog(
screenSize,
position: spaces[index].position +
newPosition,
parentIndex: index,
direction: direction,
);
},
buildSpaceContainer: (int index) {
return SpaceContainerWidget(
index: index,
icon: spaces[index].icon,
name: spaces[index].name,
);
},
),
);
}),
],
)),
), ),
), ),
], ],