The state of a search bar.

Summary

Public companion functions

Saver<SearchBarState, *>
Saver(
    animationSpecForExpand: AnimationSpec<Float>,
    animationSpecForCollapse: AnimationSpec<Float>
)

The default Saver implementation for SearchBarState.

Cmn

Public constructors

SearchBarState(
    initialValue: SearchBarValue,
    animationSpecForExpand: AnimationSpec<Float>,
    animationSpecForCollapse: AnimationSpec<Float>
)

Construct a SearchBarState.

Cmn

Public functions

suspend Unit

Animate the search bar to its collapsed state.

Cmn
suspend Unit

Animate the search bar to its expanded state.

Cmn
suspend Unit
snapTo(fraction: Float)

Snap the search bar progress to the given fraction, where 0 represents SearchBarValue.Collapsed and 1 represents SearchBarValue.Expanded.

Cmn

Public properties

LayoutCoordinates?

The layout coordinates, if available, of the search bar when it is collapsed.

Cmn
SearchBarValue

Whether the search bar is currently expanded or collapsed.

Cmn
Boolean

Whether the state is currently animating

Cmn
Float

The animation progress of the search bar, where 0 represents SearchBarValue.Collapsed and 1 represents SearchBarValue.Expanded.

Cmn
SearchBarValue

Whether the search bar is going to be expanded or collapsed.

Cmn

Public companion functions

Saver

fun Saver(
    animationSpecForExpand: AnimationSpec<Float>,
    animationSpecForCollapse: AnimationSpec<Float>
): Saver<SearchBarState, *>

The default Saver implementation for SearchBarState.

Public constructors

SearchBarState

SearchBarState(
    initialValue: SearchBarValue,
    animationSpecForExpand: AnimationSpec<Float>,
    animationSpecForCollapse: AnimationSpec<Float>
)

Construct a SearchBarState.

Parameters
initialValue: SearchBarValue

the initial value of whether the search bar is collapsed or expanded.

animationSpecForExpand: AnimationSpec<Float>

the animation spec used when the search bar expands.

animationSpecForCollapse: AnimationSpec<Float>

the animation spec used when the search bar collapses.

Public functions

animateToCollapsed

suspend fun animateToCollapsed(): Unit

Animate the search bar to its collapsed state.

animateToExpanded

suspend fun animateToExpanded(): Unit

Animate the search bar to its expanded state.

snapTo

suspend fun snapTo(fraction: Float): Unit

Snap the search bar progress to the given fraction, where 0 represents SearchBarValue.Collapsed and 1 represents SearchBarValue.Expanded.

Public properties

collapsedCoords

var collapsedCoordsLayoutCoordinates?

The layout coordinates, if available, of the search bar when it is collapsed. Used to coordinate the expansion animation.

currentValue

val currentValueSearchBarValue

Whether the search bar is currently expanded or collapsed. If the search bar is currently animating to/from the expanded state, currentValue is SearchBarValue.Expanded until the animation completes.

isAnimating

val isAnimatingBoolean

Whether the state is currently animating

progress

val progressFloat

The animation progress of the search bar, where 0 represents SearchBarValue.Collapsed and 1 represents SearchBarValue.Expanded.

targetValue

val targetValueSearchBarValue

Whether the search bar is going to be expanded or collapsed.