ScrollAware

class ScrollAware(val scrollState: ScrollState, val threshold: Dp = 48.dp) : VisibilityState

The element's visibility is determined by the scroll position of a ScrollState.

The element is visible when the scroll offset is less than threshold (i.e., near the top of the scrollable content), and hidden when the scroll offset exceeds the threshold. This is commonly used to hide headers or footers when the user scrolls down and show them when the user scrolls back up.

Parameters

scrollState

The ScrollState to observe for scroll position changes.

threshold

The scroll offset (in dp) below which the element is visible. Defaults to 48.dp. When the scroll position exceeds this value, the element is hidden.

Constructors

Link copied to clipboard
constructor(scrollState: ScrollState, threshold: Dp = 48.dp)

Properties

Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard

Returns the current visibility state as a boolean, observing any reactive sources (such as VisibilityState.ScrollAware.scrollState) as needed.