LazyLoadEffect

inline fun <T : Any> LazyLoadEffect(state: LazyListState, noinline loadMore: suspend (T) -> Unit, loadMoreParam: T?, totalItemsCount: Int, threshold: LazyLoadThreshold = LazyLoadThreshold.Lazily, direction: LazyLoadDirection = LazyLoadDirection.Forward, crossinline computeVisibleItemIndex: (state: LazyListState) -> Int = { it.firstVisibleItemIndex + it.layoutInfo.visibleItemsInfo.size / 2 })

Provides a LaunchedEffect to perform additional loading for soil.query.compose.InfiniteQueryObject.

The percentage is calculated from the values of computeVisibleItemIndex and totalItemsCount. It only triggers when the threshold is reached.

Parameters

loadMore

Specifies the function to call for loading more items, typically soil.query.compose.InfiniteQueryObject.loadMore.

loadMoreParam

The parameter passed to soil.query.compose.InfiniteQueryObject.loadMore. If null, the effect is not triggered.

totalItemsCount

The total number of items related to state.

threshold

The threshold scroll position at which to trigger additional loading.

direction

The direction for loading more items.

computeVisibleItemIndex

A function that calculates the index of the visible item used as the reference for additional loading.


inline fun <T : Any> LazyLoadEffect(state: LazyGridState, noinline loadMore: suspend (T) -> Unit, loadMoreParam: T?, totalItemsCount: Int, threshold: LazyLoadThreshold = LazyLoadThreshold.Lazily, direction: LazyLoadDirection = LazyLoadDirection.Forward, crossinline computeVisibleItemIndex: (state: LazyGridState) -> Int = { it.firstVisibleItemIndex + it.layoutInfo.visibleItemsInfo.size / 2 })

Provides a LaunchedEffect to perform additional loading for soil.query.compose.InfiniteQueryObject.

The percentage is calculated from the values of computeVisibleItemIndex and totalItemsCount. It only triggers when the threshold is reached.

Parameters

loadMore

Specifies the function to call for loading more items, typically soil.query.compose.InfiniteQueryObject.loadMore.

loadMoreParam

The parameter passed to soil.query.compose.InfiniteQueryObject.loadMore. If null, the effect is not triggered.

totalItemsCount

The total number of items related to state.

threshold

The threshold scroll position at which to trigger additional loading.

direction

The direction for loading more items.

computeVisibleItemIndex

A function that calculates the index of the visible item used as the reference for additional loading.