Add support for scrollwheels (#22762)
Adds support for discrete scroll events, such as those sent by a scroll wheel. Includes the plumbing to convert, dispatch, and handle these events, as well as Scrollable support for consuming them.
This commit is contained in:
@@ -169,6 +169,26 @@ class TestPointer {
|
||||
delta: delta,
|
||||
);
|
||||
}
|
||||
|
||||
/// Create a [PointerScrollEvent] (e.g., scroll wheel scroll; not finger-drag
|
||||
/// scroll) with the given delta.
|
||||
///
|
||||
/// By default, the time stamp on the event is [Duration.zero]. You can give a
|
||||
/// specific time stamp by passing the `timeStamp` argument.
|
||||
PointerScrollEvent scroll(
|
||||
Offset scrollDelta, {
|
||||
Duration timeStamp = Duration.zero,
|
||||
}) {
|
||||
assert(scrollDelta != null);
|
||||
assert(timeStamp != null);
|
||||
assert(kind != PointerDeviceKind.touch, "Touch pointers can't generate pointer signal events");
|
||||
return PointerScrollEvent(
|
||||
timeStamp: timeStamp,
|
||||
kind: kind,
|
||||
position: location,
|
||||
scrollDelta: scrollDelta,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// Signature for a callback that can dispatch events and returns a future that
|
||||
|
||||
Reference in New Issue
Block a user