Class

ExpandableState

State of the Expandable composables.

Source set: Android
public class ExpandableState
internal constructor(
    initiallyExpanded: Boolean,
    private val coroutineScope: CoroutineScope,
    private val expandAnimationSpec: AnimationSpec<Float>,
    private val collapseAnimationSpec: AnimationSpec<Float>,
)

State of the Expandable composables.

It's used to control the showing/hiding of extra information either directly or connecting it with something like a button.

Properties

expandProgress

Source set: Android
public val expandProgress: Float

While in the middle of the animation, this represents the progress from 0f (collapsed) to 1f (expanded), or the other way around. If no animation is running, it's either 0f if the extra content is not showing, or 1f if the extra content is showing.

expanded

Source set: Android
public var expanded: Boolean

Represents the current state of the component, true means it's showing the extra information. If its in the middle of an animation, the value of this field takes into account only the target of that animation.

Modifying this value triggers a change to show/hide the extra information.

Companion Object

Methods

Source set: Android
@Composable
public fun saver(
    expandAnimationSpec: AnimationSpec<Float>,
    collapseAnimationSpec: AnimationSpec<Float>,
): Saver<ExpandableState, Boolean>

The default Saver implementation for ExpandableState.

Last updated: