Revert "Redo: Add buttons to gestures (#31819)" (#31912)

This reverts commit fea2c7d671.
This commit is contained in:
Jonah Williams
2019-05-01 10:06:45 -07:00
committed by GitHub
parent df4dc7cd38
commit 60a1b2b9ea
16 changed files with 217 additions and 1931 deletions

View File

@@ -22,15 +22,9 @@ 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,
int buttons = kPrimaryButton,
])
TestPointer([this.pointer = 1, this.kind = PointerDeviceKind.touch])
: assert(kind != null),
assert(pointer != null),
assert(buttons != null),
_buttons = buttons;
assert(pointer != null);
/// The pointer identifier used for events generated by this object.
///
@@ -41,11 +35,6 @@ class TestPointer {
/// [PointerDeviceKind.touch].
final PointerDeviceKind kind;
/// The kind of buttons to simulate on Down and Move events. Defaults to
/// [kPrimaryButton].
int get buttons => _buttons;
int _buttons;
/// Whether the pointer simulated by this object is currently down.
///
/// A pointer is released (goes up) by calling [up] or [cancel].
@@ -62,14 +51,8 @@ class TestPointer {
/// If a custom event is created outside of this class, this function is used
/// to set the [isDown].
bool setDownInfo(
PointerEvent event,
Offset newLocation, {
int buttons,
}) {
bool setDownInfo(PointerEvent event, Offset newLocation) {
_location = newLocation;
if (buttons != null)
_buttons = buttons;
switch (event.runtimeType) {
case PointerDownEvent:
assert(!isDown);
@@ -89,25 +72,15 @@ class TestPointer {
///
/// By default, the time stamp on the event is [Duration.zero]. You can give a
/// specific time stamp by passing the `timeStamp` argument.
///
/// By default, the set of buttons in the last down or move event is used.
/// You can give a specific set of buttons by passing the `buttons` argument.
PointerDownEvent down(
Offset newLocation, {
Duration timeStamp = Duration.zero,
int buttons,
}) {
PointerDownEvent down(Offset newLocation, {Duration timeStamp = Duration.zero}) {
assert(!isDown);
_isDown = true;
_location = newLocation;
if (buttons != null)
_buttons = buttons;
return PointerDownEvent(
timeStamp: timeStamp,
kind: kind,
pointer: pointer,
position: location,
buttons: _buttons,
);
}
@@ -118,14 +91,7 @@ class TestPointer {
///
/// [isDown] must be true when this is called, since move events can only
/// be generated when the pointer is down.
///
/// By default, the set of buttons in the last down or move event is used.
/// You can give a specific set of buttons by passing the `buttons` argument.
PointerMoveEvent move(
Offset newLocation, {
Duration timeStamp = Duration.zero,
int buttons,
}) {
PointerMoveEvent move(Offset newLocation, {Duration timeStamp = Duration.zero}) {
assert(
isDown,
'Move events can only be generated when the pointer is down. To '
@@ -133,15 +99,12 @@ class TestPointer {
'up, use hover() instead.');
final Offset delta = newLocation - location;
_location = newLocation;
if (buttons != null)
_buttons = buttons;
return PointerMoveEvent(
timeStamp: timeStamp,
kind: kind,
pointer: pointer,
position: newLocation,
delta: delta,
buttons: _buttons,
);
}