rememberScrollIndicatorState
Create a ScrollIndicatorState for ScrollState.
Parameters
The orientation of the scroll indicator. Orientation.Vertical for Column and Orientation.Horizontal for Row.
The ScrollState that applied to Modifier.verticalScroll or Modifier.horizontalScroll of Column or Row.
Create a ScrollIndicatorState for LazyListState.
Parameters
The LazyListState that applied to LazyColumn or LazyRow.
Create a ScrollIndicatorState for LazyGridState.
Estimation strategy:
Compute per-line max main-axis item size and average it as the "average line height/width".
Total lines ≈
ceil(totalItemsCount / maxSpan).scrolledPx≈ average line main-axis size × current line index +firstVisibleItemScrollOffset.totalScrollableDistancePx≈ average line main-axis size × total lines − viewport length.
Create a ScrollIndicatorState for LazyStaggeredGridState.
Estimation strategy:
Infer maximum lane count
spanMaxfrom visible items'lane.scrolledPx≈ average item main-axis size × current line index +firstVisibleItemScrollOffset. Current line index is approximated byfirstVisibleItemIndex / spanMax.totalScrollableDistancePx≈ average item main-axis size × total items /spanMax− viewport length.