Composable Function

rememberExpandableStateMapping

Create and remember a mapping from keys to ExpandableStates ExpandableStates can be requested by key, and we will created with the parameters given here when a mapping didn't exist before.

rememberExpandableStateMapping

Source set: Android
@Composable
@ExperimentalWearFoundationApi
public fun <T> rememberExpandableStateMapping(
    initiallyExpanded: (key: T) -> Boolean = { false },
    expandAnimationSpec: AnimationSpec<Float> = ExpandableItemsDefaults.expandAnimationSpec,
    collapseAnimationSpec: AnimationSpec<Float> = ExpandableItemsDefaults.collapseAnimationSpec,
): ExpandableStateMapping<T>

Create and remember a mapping from keys to ExpandableStates ExpandableStates can be requested by key, and we will created with the parameters given here when a mapping didn't exist before. This is mainly useful when you want to have a variable number of expandables, that can change at runtime (for example, elements on a ScalingLazyColumn)

Parameters

initiallyExpanded A function to compute the initial state given the key.
expandAnimationSpec The AnimationSpec to use when showing the extra information.
collapseAnimationSpec The AnimationSpec to use when hiding the extra information.

Last updated: