androidx.compose.foundation.lazy.grid
LazyGridPrefetchStrategyExperimental
Interface · from org.jetbrains.compose.foundation:foundation:1.12.2
No hand-written docs yet.
Implementations of this interface control which indices of a LazyGrid should be prefetched (precomposed and premeasured during idle time) as the user interacts with it.
interface LazyGridPrefetchStrategy
How to get one
Create it
LazyGridPrefetchStrategy(nestedPrefetchItemCount: Int)
Used by
Parameters that take a LazyGridPrefetchStrategy.
Functions
onScroll
fun LazyGridPrefetchScope.onScroll(delta: Float, layoutInfo: LazyGridLayoutInfo)
onScroll is invoked when the LazyGrid scrolls, whether or not the visible items have changed. If the visible items have also changed, then this will be invoked in the same frame after onVisibleItemsUpdated.
onVisibleItemsUpdated
fun LazyGridPrefetchScope.onVisibleItemsUpdated(layoutInfo: LazyGridLayoutInfo)
onVisibleItemsUpdated is invoked when the LazyGrid scrolls if the visible items have changed.
onNestedPrefetch
fun NestedPrefetchScope.onNestedPrefetch(firstVisibleItemIndex: Int)
onNestedPrefetch is invoked when a parent LazyLayout has prefetched content which contains this LazyGrid. It gives this LazyGrid a chance to request prefetch for some of its own children before coming onto screen.
Library docs
Implementations of this interface control which indices of a LazyGrid should be prefetched (precomposed and premeasured during idle time) as the user interacts with it.
Implementations should invoke LazyGridPrefetchScope.scheduleLinePrefetch to schedule prefetches
from the onScroll and onVisibleItemsUpdated callbacks. If any of the returned PrefetchHandles
no longer need to be prefetched, use LazyLayoutPrefetchState.PrefetchHandle.cancel to cancel
the request.