rememberExpandableStateMapping

Composable Function

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

initiallyExpandedA function to compute the initial state given the key.
expandAnimationSpecThe AnimationSpec to use when showing the extra information.
collapseAnimationSpecThe AnimationSpec to use when hiding the extra information.