pointerScroll method Null safety

  1. @override
void pointerScroll(
  1. double delta
)
override

Changes the scrolling position based on a pointer signal from current value to delta without animation and without checking if new value is in range, taking min/max scroll extent into account.

Any active animation is canceled. If the user is currently scrolling, that action is canceled.

This method dispatches the start/update/end sequence of scrolling notifications.

This method is very similar to jumpTo, but pointerScroll will update the ScrollDirection.

Implementation

@override
void pointerScroll(double delta) {
  // If an update is made to pointer scrolling here, consider if the same
  // (or similar) change should be made in
  // _NestedScrollCoordinator.pointerScroll.
  assert(delta != 0.0);

  final double targetPixels =
      math.min(math.max(pixels + delta, minScrollExtent), maxScrollExtent);
  if (targetPixels != pixels) {
    goIdle();
    updateUserScrollDirection(
        -delta > 0.0 ? ScrollDirection.forward : ScrollDirection.reverse,
    );
    final double oldPixels = pixels;
    forcePixels(targetPixels);
    isScrollingNotifier.value = true;
    didStartScroll();
    didUpdateScrollPositionBy(pixels - oldPixels);
    didEndScroll();
    goBallistic(0.0);
  }
}