scrollCacheExtent property

ScrollCacheExtent scrollCacheExtent
final

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.

In PageView, the default scrollCacheExtent uses ScrollCacheExtent.viewport, where the value represents the number of viewport lengths to cache beyond the visible area.

When PageController.viewportFraction is 1.0 (the default), this is equivalent to the number of pages. For example, ScrollCacheExtent.viewport(2.0) caches 2 pages before and after the visible page.

When PageController.viewportFraction is less than 1.0, multiple pages may be visible in a single viewport, so ScrollCacheExtent.viewport(1.0) may cache more than one additional page in each direction.

ScrollCacheExtent.pixels can also be used to specify the cache extent in logical pixels instead of viewport sizes.

If scrollCacheExtent is specified, its value must be consistent with allowImplicitScrolling: the value must be greater than 0.0 when allowImplicitScrolling is true, and must be 0.0 when allowImplicitScrolling is false.

Defaults to ScrollCacheExtent.viewport(1.0) if allowImplicitScrolling is true, and ScrollCacheExtent.viewport(0.0) if allowImplicitScrolling is false.

Implementation

final ScrollCacheExtent scrollCacheExtent;