Add buttons to gestures (#30339)
* Callbacks of tap, long press, drag, and double tap GR respond to only primary events. * Add "secondary" callbacks to tap. * Recognizers only compete on events if there are any related callbacks. * Add "kSecondaryButton" constant.
This commit is contained in:
@@ -22,9 +22,14 @@ class TestPointer {
|
||||
///
|
||||
/// Multiple [TestPointer]s created with the same pointer identifier will
|
||||
/// interfere with each other if they are used in parallel.
|
||||
TestPointer([this.pointer = 1, this.kind = PointerDeviceKind.touch])
|
||||
TestPointer([
|
||||
this.pointer = 1,
|
||||
this.kind = PointerDeviceKind.touch,
|
||||
this.buttons = kPrimaryButton,
|
||||
])
|
||||
: assert(kind != null),
|
||||
assert(pointer != null);
|
||||
assert(pointer != null),
|
||||
assert(buttons != null);
|
||||
|
||||
/// The pointer identifier used for events generated by this object.
|
||||
///
|
||||
@@ -35,6 +40,10 @@ class TestPointer {
|
||||
/// [PointerDeviceKind.touch].
|
||||
final PointerDeviceKind kind;
|
||||
|
||||
/// The kind of buttons to simulate on Down and Move events. Defaults to
|
||||
/// [kPrimaryButton].
|
||||
int buttons;
|
||||
|
||||
/// Whether the pointer simulated by this object is currently down.
|
||||
///
|
||||
/// A pointer is released (goes up) by calling [up] or [cancel].
|
||||
@@ -81,6 +90,7 @@ class TestPointer {
|
||||
kind: kind,
|
||||
pointer: pointer,
|
||||
position: location,
|
||||
buttons: buttons,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -105,6 +115,7 @@ class TestPointer {
|
||||
pointer: pointer,
|
||||
position: newLocation,
|
||||
delta: delta,
|
||||
buttons: buttons,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user