- override
Returns the scroll offset to use when the user attempts to scroll from the given offset by the given delta.
Source
@override double applyCurve(double scrollOffset, double scrollDelta) { double newScrollOffset = scrollOffset + scrollDelta; // If we're overscrolling, we want move the scroll offset 2x // slower than we would otherwise. Therefore, we "rewind" the // newScrollOffset by half the amount that we moved it above. // Notice that we clamp the "old" value to 0.0 so that we only // reduce the portion of scrollDelta that's applied beyond 0.0. We // do similar things for overscroll in the other direction. if (newScrollOffset < minScrollOffset) { newScrollOffset -= (newScrollOffset - math.min(minScrollOffset, scrollOffset)) / 2.0; } else if (newScrollOffset > maxScrollOffset) { newScrollOffset -= (newScrollOffset - math.max(maxScrollOffset, scrollOffset)) / 2.0; } return newScrollOffset; }