scroll method

Future<void> scroll(
  1. dynamic target,
  2. Offset by, {
  3. Shot? shot,
  4. Settle? settle,
})

Turns the mouse wheel over target by by — scrolls the pane under the mouse.

Not a nicer drag, and not scrollTo. A wheel turn is a pointer signal: the framework hit-tests it to whatever is under the mouse and hands it to that, so on a page with three scrollables this one moves the pane target is in, where scrollTo picks a scrollable and walks it. And a wheel moves a list on a desktop, where a mouse drag does not: Flutter's default scroll behavior leaves the mouse out of the devices that drag one.

by is a wheel, not a finger, and its sign is the other way round from drag's: the delta is added to the scroll offset, so a positive dy moves down the list. Both conventions are the platform's.

The mouse moves there first, because that is how a wheel reaches anything, so a scroll leaves target hovered — unhover ends that.

Implementation

Future<void> scroll(
  dynamic target,
  Offset by, {
  Shot? shot,
  Settle? settle,
}) => _step(
  shot,
  settle,
  () async {
    var finder = await _resolve(target, 'scroll');
    var at = _aimFor(target, finder);
    await _approach('scroll');
    await _mouse.scroll(at, by, over: describeTarget(target));
  },
  verb: 'scroll',
  target: describeTarget(target),
);