getScrollToTrack method

double getScrollToTrack(
  1. ScrollMetrics metrics
)

Implementation

double getScrollToTrack(ScrollMetrics metrics) {
  final double scrollableExtent =
      metrics.maxScrollExtent - metrics.minScrollExtent;

  final double fractionPast = (scrollableExtent > 0)
      ? clampDouble(
          (metrics.pixels - metrics.minScrollExtent) / scrollableExtent,
          0.0,
          1.0)
      : 0;

  return (_isReversed ? 1 - fractionPast : fractionPast) *
      (_traversableTrackExtent - _thumbExtent);
}