AnimatedSpacingColumn

fun AnimatedSpacingColumn(spacing: Dp, modifier: Modifier = Modifier, horizontalAlignment: Alignment.Horizontal = Alignment.Start, animation: AnimatedSpacingColumnAnimation = AnimatedSpacingColumnAnimation(), content: @Composable AnimatedSpacingColumnScope.() -> Unit)

Places children vertically and animates both a child's occupied height and its surrounding spacing when the child is emitted by AnimatedSpacingColumnScope.AnimatedVisibility.

Unlike androidx.compose.foundation.layout.Column, spacing is derived from the visibility progress of adjacent children. This keeps the gap on both sides of an entering or leaving child visually symmetric. The animation is driven by the same progress that collapses the child. Child-specific horizontal alignment, alignment lines, and ColumnScope.weight retain their usual scope semantics. When a weighted animated child disappears, its released allocation is progressively redistributed among the other visible weighted children.

This layout is eager and is not a replacement for a lazy list. It supports one fixed, non-negative spacing value rather than the complete set of stock Arrangement.Vertical strategies. Only children wrapped in AnimatedSpacingColumnScope.AnimatedVisibility participate in animated spacing, and the visibility wrapper overlays multiple direct content children at the same origin. Intrinsic measurement is not specialized. Prefer the stock androidx.compose.foundation.layout.Column when its spacing does not need to participate in visibility transitions.

Parameters

spacing

fixed distance between fully visible adjacent children. It must not be negative.

modifier

modifier applied to the layout.

horizontalAlignment

default horizontal alignment for children that do not provide a scope-specific alignment.

animation

default visibility-animation configuration inherited by animated children.

content

children placed by the column. Use AnimatedSpacingColumnScope.AnimatedVisibility for children whose occupied height and adjacent spacing should animate.