scrollTo method

Future<PatrolFinder> scrollTo({
  1. Finder? view,
  2. double step = defaultScrollDelta,
  3. AxisDirection? scrollDirection,
  4. int maxScrolls = defaultScrollMaxIteration,
  5. Duration? settleBetweenScrollsTimeout,
  6. Duration? dragDuration,
  7. SettlePolicy? settlePolicy,
  8. Alignment alignment = Alignment.center,
})

Shorthand for PatrolTester.scrollUntilVisible.

Scrolls view in scrollDirection until this finders finds at least one visible widget.

It also ensures that view is visible, by calling PatrolFinder.waitUntilVisible.

See also:

  • PatrolTester.scrollUntilVisible, which this method wraps

Implementation

Future<PatrolFinder> scrollTo({
  Finder? view,
  double step = defaultScrollDelta,
  AxisDirection? scrollDirection,
  int maxScrolls = defaultScrollMaxIteration,
  Duration? settleBetweenScrollsTimeout,
  Duration? dragDuration,
  SettlePolicy? settlePolicy,
  Alignment alignment = Alignment.center,
}) {
  return wrapWithPatrolLog(
    action: 'scrollTo',
    color: AnsiCodes.green,
    function: () {
      return tester.scrollUntilVisible(
        finder: this,
        view: view,
        delta: step,
        scrollDirection: scrollDirection,
        maxScrolls: maxScrolls,
        settleBetweenScrollsTimeout: settleBetweenScrollsTimeout,
        settlePolicy: settlePolicy,
        dragDuration: dragDuration,
        alignment: alignment,
        enablePatrolLog: false,
      );
    },
  );
}