scrollCacheExtent property
The viewport has an area before and after the visible area to cache items that are about to become visible when the user scrolls.
Items that fall in this cache area are laid out even though they are not (yet) visible on screen. The scrollCacheExtent describes how much the cache area extends before the leading edge and after the trailing edge of the viewport.
The total extent, which the viewport will try to cover with children, is scrollCacheExtent before the leading edge + extent of the main axis + scrollCacheExtent after the trailing edge.
The cache area is also used to implement implicit accessibility scrolling on iOS: When the accessibility focus moves from an item in the visible viewport to an invisible item in the cache area, the framework will bring that item into view with an (implicit) scroll action.
The getter can never return null, but the field is nullable because the setter can be set to null to reset the value to RenderAbstractViewport.defaultCacheExtent pixels (in which case ScrollCacheExtent.style must be CacheExtentStyle.pixel).
See also:
- ScrollCacheExtent.style, which controls the units of the scrollCacheExtent.
Implementation
ScrollCacheExtent get scrollCacheExtent => _scrollCacheExtent;
Implementation
set scrollCacheExtent(ScrollCacheExtent? value) {
final ScrollCacheExtent effectiveValue =
value ?? const ScrollCacheExtent.pixels(RenderAbstractViewport.defaultCacheExtent);
if (effectiveValue == _scrollCacheExtent) {
return;
}
_scrollCacheExtent = effectiveValue;
markNeedsLayout();
}