mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-11-27 21:34:55 +00:00
Fixed space layout
This commit is contained in:
@ -6,18 +6,18 @@ class SpaceCardWidget extends StatelessWidget {
|
||||
final Size screenSize;
|
||||
final Offset position;
|
||||
final bool isHovered;
|
||||
final Function(int index, Offset delta) onPanUpdate;
|
||||
final Function(int index, bool isHovered) onHoverChanged;
|
||||
final Function(int index, Offset newPosition, String direction) onButtonTap;
|
||||
final Widget Function(int index) buildSpaceContainer;
|
||||
final ValueChanged<Offset> onPositionChanged;
|
||||
|
||||
const SpaceCardWidget({
|
||||
super.key,
|
||||
required this.index,
|
||||
required this.onPositionChanged,
|
||||
required this.screenSize,
|
||||
required this.position,
|
||||
required this.isHovered,
|
||||
required this.onPanUpdate,
|
||||
required this.onHoverChanged,
|
||||
required this.onButtonTap,
|
||||
required this.buildSpaceContainer,
|
||||
@ -29,7 +29,8 @@ class SpaceCardWidget extends StatelessWidget {
|
||||
behavior: HitTestBehavior.opaque,
|
||||
onPanUpdate: (details) {
|
||||
// Call the provided callback to update the position
|
||||
onPanUpdate(index, details.delta);
|
||||
final newPosition = position + details.delta;
|
||||
onPositionChanged(newPosition);
|
||||
},
|
||||
child: MouseRegion(
|
||||
onEnter: (_) {
|
||||
@ -41,7 +42,8 @@ class SpaceCardWidget extends StatelessWidget {
|
||||
onHoverChanged(index, false);
|
||||
},
|
||||
child: Stack(
|
||||
clipBehavior: Clip.none, // Allow hovering elements to be displayed outside the boundary
|
||||
clipBehavior: Clip
|
||||
.none, // Allow hovering elements to be displayed outside the boundary
|
||||
children: [
|
||||
buildSpaceContainer(index), // Build the space container
|
||||
if (isHovered) ...[
|
||||
@ -49,21 +51,18 @@ class SpaceCardWidget extends StatelessWidget {
|
||||
index: index,
|
||||
direction: 'left',
|
||||
offset: const Offset(-21, 20),
|
||||
screenSize: screenSize,
|
||||
onButtonTap: onButtonTap,
|
||||
),
|
||||
PlusButtonWidget(
|
||||
index: index,
|
||||
direction: 'right',
|
||||
offset: const Offset(140, 20),
|
||||
screenSize: screenSize,
|
||||
onButtonTap: onButtonTap,
|
||||
),
|
||||
PlusButtonWidget(
|
||||
index: index,
|
||||
direction: 'down',
|
||||
offset: const Offset(63, 50),
|
||||
screenSize: screenSize,
|
||||
onButtonTap: onButtonTap,
|
||||
),
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user