Class

SearchBarState

The state of a search bar.

Source set: Common
public class SearchBarState private constructor(
    internal val animatable: Animatable<Float, AnimationVector1D>,
    private val contentAnimatable: Animatable<Float, AnimationVector1D>,
    internal val animationSpecForExpand: AnimationSpec<Float>,
    internal val animationSpecForCollapse: AnimationSpec<Float>,
    private val animationSpecForContentFadeIn: AnimationSpec<Float>,
    private val animationSpecForContentFadeOut: AnimationSpec<Float>,
)

The state of a search bar.

Properties

progress

Source set: Common
public val progress: Float

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

isAnimating

Source set: Common
public val isAnimating: Boolean

Whether the state is currently animating

targetValue

Source set: Common
public val targetValue: SearchBarValue

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

threshold

Source set: Common
val threshold = 0.02f

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.

Jetpack Compose beyond MaterialFree components, screens and templates for apps that don’t look like Google’s. Copy them into your app, or let your coding agent add them.Browse for free

Content updated: