TestGesture class

A class for performing gestures in tests.

The simplest way to create a TestGesture is to call WidgetTester.startGesture.

Constructors

TestGesture({required EventDispatcher dispatcher, int pointer = 1, PointerDeviceKind kind = PointerDeviceKind.touch, int? device, int buttons = kPrimaryButton})
Create a TestGesture without dispatching any events from it. The TestGesture can then be manipulated to perform future actions.

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

addPointer({Duration timeStamp = Duration.zero, Offset? location}) Future<void>
In a test, send a pointer add event for this pointer.
cancel({Duration timeStamp = Duration.zero}) Future<void>
End the gesture by canceling the pointer (as would happen if the system showed a modal dialog on top of the Flutter application, for instance).
down(Offset downLocation, {Duration timeStamp = Duration.zero}) Future<void>
Dispatch a pointer down event at the given downLocation, caching the hit test result.
downWithCustomEvent(Offset downLocation, PointerDownEvent event) Future<void>
Dispatch a pointer down event at the given downLocation, caching the hit test result with a custom down event.
moveBy(Offset offset, {Duration timeStamp = Duration.zero}) Future<void>
Send a move event moving the pointer by the given offset.
moveTo(Offset location, {Duration timeStamp = Duration.zero}) Future<void>
Send a move event moving the pointer to the given location.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
panZoomEnd({Duration timeStamp = Duration.zero}) Future<void>
Dispatch a pointer pan zoom end event, caching the hit test result.
panZoomStart(Offset location, {Duration timeStamp = Duration.zero}) Future<void>
Dispatch a pointer pan zoom start event at the given location, caching the hit test result.
panZoomUpdate(Offset location, {Offset pan = Offset.zero, double scale = 1, double rotation = 0, Duration timeStamp = Duration.zero}) Future<void>
Dispatch a pointer pan zoom update event at the given location, caching the hit test result.
removePointer({Duration timeStamp = Duration.zero, Offset? location}) Future<void>
In a test, send a pointer remove event for this pointer.
toString() String
A string representation of this object.
inherited
up({Duration timeStamp = Duration.zero}) Future<void>
End the gesture by releasing the pointer. For trackpad pointers this will send a panZoomEnd event instead of an up event.
updateWithCustomEvent(PointerEvent event, {Duration timeStamp = Duration.zero}) Future<void>
In a test, send a move event that moves the pointer by the given offset.

Operators

operator ==(Object other) bool
The equality operator.
inherited