SearchBarScrollState


A state object that can be hoisted to control and observe the search bar's scroll state. The state is read and updated by a SearchBarScrollBehavior implementation.

In most cases, this state will be created via rememberSearchBarScrollState.

Summary

Public companion properties

Saver<SearchBarScrollState, *>

The default Saver implementation for SearchBarScrollState.

Cmn

Public constructors

SearchBarScrollState(
    initialScrollOffsetLimit: Float,
    initialScrollOffset: Float,
    initialContentOffset: Float
)
Cmn

Public properties

Float

The total offset of the content scrolled under the search bar.

Cmn
Float

The search bar's current offset due to scrolling, in pixels.

Cmn
Float

The limit that a search bar can be offset due to scrolling, in pixels.

Cmn

Public companion properties

Saver

val SaverSaver<SearchBarScrollState, *>

The default Saver implementation for SearchBarScrollState.

Public constructors

SearchBarScrollState

SearchBarScrollState(
    initialScrollOffsetLimit: Float,
    initialScrollOffset: Float,
    initialContentOffset: Float
)
Parameters
initialScrollOffsetLimit: Float

the initial value for SearchBarScrollState.scrollOffsetLimit

initialScrollOffset: Float

the initial value for SearchBarScrollState.scrollOffset

initialContentOffset: Float

the initial value for SearchBarScrollState.contentOffset

Public properties

contentOffset

var contentOffsetFloat

The total offset of the content scrolled under the search bar.

The content offset is used to compute the overlappedFraction, which can later be read by an implementation.

This value is updated by a SearchBarScrollBehavior whenever a nested scroll connection consumes scroll events. A common implementation would update the value to be the sum of all NestedScrollConnection.onPostScroll consumed.y values.

scrollOffset

var scrollOffsetFloat

The search bar's current offset due to scrolling, in pixels. This offset is applied to the fixed size of the search bar to control the displayed size when content is being scrolled.

This value is typically negative.

Updates to the scrollOffset value are coerced between scrollOffsetLimit and 0.

scrollOffsetLimit

var scrollOffsetLimitFloat

The limit that a search bar can be offset due to scrolling, in pixels.

This value is typically negative.

Use this limit to coerce the scrollOffset value when it's updated.