fix mouse cursor
This commit is contained in:
@@ -47,18 +47,31 @@ class DraggableEventPill extends StatelessWidget {
|
|||||||
contentWidth: contentWidth,
|
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) {
|
if (!enableDrag) {
|
||||||
return Positioned(
|
return Positioned(
|
||||||
top: top,
|
top: top,
|
||||||
left: left.clamp(0.0, double.infinity),
|
left: left.clamp(0.0, double.infinity),
|
||||||
width: width.clamp(0.0, double.infinity),
|
width: width.clamp(0.0, double.infinity),
|
||||||
height: laneHeight,
|
height: laneHeight,
|
||||||
child: pill,
|
child: cursorPill,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
final scope = ZTimelineScope.of(context);
|
|
||||||
|
|
||||||
return Positioned(
|
return Positioned(
|
||||||
top: top,
|
top: top,
|
||||||
left: left.clamp(0.0, double.infinity),
|
left: left.clamp(0.0, double.infinity),
|
||||||
@@ -87,7 +100,7 @@ class DraggableEventPill extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
childWhenDragging: Opacity(opacity: 0.3, child: pill),
|
childWhenDragging: Opacity(opacity: 0.3, child: pill),
|
||||||
child: pill,
|
child: cursorPill,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -221,9 +221,11 @@ class _ZTimelineInteractorState extends State<ZTimelineInteractor> {
|
|||||||
listenable: scope.interaction,
|
listenable: scope.interaction,
|
||||||
builder: (context, child) {
|
builder: (context, child) {
|
||||||
return MouseRegion(
|
return MouseRegion(
|
||||||
cursor: scope.interaction.isGrabbing
|
cursor:
|
||||||
|
scope.interaction.isGrabbing ||
|
||||||
|
scope.interaction.isDraggingEntry
|
||||||
? SystemMouseCursors.grabbing
|
? SystemMouseCursors.grabbing
|
||||||
: SystemMouseCursors.grab,
|
: SystemMouseCursors.basic,
|
||||||
child: child,
|
child: child,
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user