Skip to content

Commit

Permalink
Documentation update to advertize timedDrag (#106489)
Browse files Browse the repository at this point in the history
  • Loading branch information
bleroux authored Jun 30, 2022
1 parent a74c481 commit 776a15c
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
6 changes: 6 additions & 0 deletions packages/flutter_test/lib/src/controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -781,6 +781,12 @@ abstract class WidgetController {
///
/// You can use [createGesture] if your gesture doesn't begin with an initial
/// down gesture.
///
/// See also:
/// * [WidgetController.drag], a method to simulate a drag.
/// * [WidgetController.timedDrag], a method to simulate the drag of a given widget in a given duration.
/// It sends move events at a given frequency and it is useful when there are listeners involved.
/// * [WidgetController.fling], a method to simulate a fling.
Future<TestGesture> startGesture(
Offset downLocation, {
int? pointer,
Expand Down
12 changes: 12 additions & 0 deletions packages/flutter_test/lib/src/test_pointer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -463,6 +463,12 @@ class TestGesture {
///
/// If the pointer is down, then a move event is dispatched. If the pointer is
/// up, then a hover event is dispatched.
///
/// See also:
/// * [WidgetController.drag], a method to simulate a drag.
/// * [WidgetController.timedDrag], a method to simulate the drag of a given widget in a given duration.
/// It sends move events at a given frequency and it is useful when there are listeners involved.
/// * [WidgetController.fling], a method to simulate a fling.
Future<void> moveBy(Offset offset, { Duration timeStamp = Duration.zero }) {
assert(_pointer.location != null);
return moveTo(_pointer.location! + offset, timeStamp: timeStamp);
Expand All @@ -472,6 +478,12 @@ class TestGesture {
///
/// If the pointer is down, then a move event is dispatched. If the pointer is
/// up, then a hover event is dispatched.
///
/// See also:
/// * [WidgetController.drag], a method to simulate a drag.
/// * [WidgetController.timedDrag], a method to simulate the drag of a given widget in a given duration.
/// It sends move events at a given frequency and it is useful when there are listeners involved.
/// * [WidgetController.fling], a method to simulate a fling.
Future<void> moveTo(Offset location, { Duration timeStamp = Duration.zero }) {
return TestAsyncUtils.guard<void>(() {
if (_pointer._isDown) {
Expand Down

0 comments on commit 776a15c

Please sign in to comment.