fix mouse cursor
This commit is contained in:
@@ -47,18 +47,31 @@ class DraggableEventPill extends StatelessWidget {
|
||||
contentWidth: contentWidth,
|
||||
);
|
||||
|
||||
final scope = ZTimelineScope.of(context);
|
||||
|
||||
// Wrap pill in a MouseRegion so hovering shows a pointer cursor.
|
||||
// During an active entry drag, defer to the parent cursor (grabbing).
|
||||
final cursorPill = ListenableBuilder(
|
||||
listenable: scope.interaction,
|
||||
builder: (context, child) => MouseRegion(
|
||||
cursor: scope.interaction.isDraggingEntry
|
||||
? MouseCursor.defer
|
||||
: SystemMouseCursors.click,
|
||||
child: child,
|
||||
),
|
||||
child: pill,
|
||||
);
|
||||
|
||||
if (!enableDrag) {
|
||||
return Positioned(
|
||||
top: top,
|
||||
left: left.clamp(0.0, double.infinity),
|
||||
width: width.clamp(0.0, double.infinity),
|
||||
height: laneHeight,
|
||||
child: pill,
|
||||
child: cursorPill,
|
||||
);
|
||||
}
|
||||
|
||||
final scope = ZTimelineScope.of(context);
|
||||
|
||||
return Positioned(
|
||||
top: top,
|
||||
left: left.clamp(0.0, double.infinity),
|
||||
@@ -87,7 +100,7 @@ class DraggableEventPill extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
childWhenDragging: Opacity(opacity: 0.3, child: pill),
|
||||
child: pill,
|
||||
child: cursorPill,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -221,9 +221,11 @@ class _ZTimelineInteractorState extends State<ZTimelineInteractor> {
|
||||
listenable: scope.interaction,
|
||||
builder: (context, child) {
|
||||
return MouseRegion(
|
||||
cursor: scope.interaction.isGrabbing
|
||||
cursor:
|
||||
scope.interaction.isGrabbing ||
|
||||
scope.interaction.isDraggingEntry
|
||||
? SystemMouseCursors.grabbing
|
||||
: SystemMouseCursors.grab,
|
||||
: SystemMouseCursors.basic,
|
||||
child: child,
|
||||
);
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user