fixed space clipping

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

View File

@ -162,34 +162,33 @@ 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( : Stack(
children: spaces clipBehavior: Clip.none,
.asMap() children: [
.entries CustomPaint(
.map((entry) => SpaceCardWidget( 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, index: entry.key,
screenSize: screenSize, screenSize: screenSize,
position: spaces[entry.key].position, position: space.position,
isHovered: spaces[entry.key].isHovered, isHovered: space.isHovered,
onPanUpdate: (int index, Offset delta) { onPanUpdate: (int index, Offset delta) {
setState(() { setState(() {
spaces[index].position += delta; spaces[index].position += delta;
@ -201,8 +200,7 @@ class SpaceManagementPageState extends State<SpaceManagementPage> {
spaces[index].isHovered = isHovered; spaces[index].isHovered = isHovered;
}); });
}, },
onButtonTap: (int index, onButtonTap: (int index, Offset newPosition,
Offset newPosition,
String direction) { String direction) {
_showCreateSpaceDialog( _showCreateSpaceDialog(
screenSize, screenSize,
@ -219,12 +217,11 @@ class SpaceManagementPageState extends State<SpaceManagementPage> {
name: spaces[index].name, name: spaces[index].name,
); );
}, },
))
.toList(),
), ),
);
}),
], ],
), )),
),
), ),
), ),
], ],