SearchBarState
-
Cmn
@ExperimentalMaterial3Api
class SearchBarState
The state of a search bar.
Summary
Public companion functions |
||
|---|---|---|
Saver<SearchBarState, *> |
Saver(The default |
Cmn
|
Public constructors |
|
|---|---|
SearchBarState(Construct a |
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 |
Snap the search bar progress to the given |
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 |
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 collapsedCoords: LayoutCoordinates?
The layout coordinates, if available, of the search bar when it is collapsed. Used to coordinate the expansion animation.
currentValue
val currentValue: SearchBarValue
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.
progress
val progress: Float
The animation progress of the search bar, where 0 represents SearchBarValue.Collapsed and 1 represents SearchBarValue.Expanded.
targetValue
val targetValue: SearchBarValue
Whether the search bar is going to be expanded or collapsed.