setUpOverflowScroller method

void setUpOverflowScroller(
  1. Size scrollableSize,
  2. Size viewportSize
)

Implementation

void setUpOverflowScroller(Size scrollableSize, Size viewportSize) {
  assert(scrollableSize.isFinite);

  _scrollableSize = scrollableSize;
  _viewportSize = viewportSize;
  if (_scrollOffsetX != null) {
    _setUpScrollX();
    final double maxX = math.max(0.0, _scrollableSize!.width - _viewportSize!.width);
    // Do not auto-jump scroll position for RTL containers.
    // Per CSS/UA expectations, initial scroll position is the start edge
    // of the scroll range, and user agent should not forcibly move it to
    // the visual right edge for RTL. Keeping 0 preserves expected behavior
    // for cases where overflow content lies entirely to the right.
  }

  if (_scrollOffsetY != null) {
    _setUpScrollY();
    final double maxY = math.max(0.0, _scrollableSize!.height - _viewportSize!.height);
  }

  // After computing viewport/content dimensions, update sticky descendants so their
  // initial paint offsets honor top/bottom/left/right clamps before any scroll occurs.
  try {
    final Element el = renderStyle.target;
    el.updateStickyOffsets();
  } catch (_) {}
}