TransformingLazyColumn

The vertically scrolling list that only composes and lays out the currently visible items. This

TransformingLazyColumn

Composable Function

Android
@Composable
public fun TransformingLazyColumn(
    modifier: Modifier = Modifier,
    state: TransformingLazyColumnState = rememberTransformingLazyColumnState(),
    contentPadding: PaddingValues = PaddingValues(),
    reverseLayout: Boolean = false,
    verticalArrangement: Arrangement.Vertical =
        Arrangement.spacedBy(
            space = 4.dp,
            alignment = if (!reverseLayout) Alignment.Top else Alignment.Bottom,
        ),
    horizontalAlignment: Alignment.Horizontal = Alignment.CenterHorizontally,
    flingBehavior: FlingBehavior = ScrollableDefaults.flingBehavior(),
    userScrollEnabled: Boolean = true,
    rotaryScrollableBehavior: RotaryScrollableBehavior? = RotaryScrollableDefaults.behavior(state),
    overscrollEffect: OverscrollEffect? = rememberOverscrollEffect(),
    content: TransformingLazyColumnScope.() -> Unit,
)

The vertically scrolling list that only composes and lays out the currently visible items. This is a wear specific version of LazyColumn that adds support for scaling and morphing animations.

Parameters

modifierThe modifier to be applied to the layout.
stateThe state object to be used to control the list and the applied layout.
contentPaddinga padding around the whole content. This will add padding for the content after it has been clipped, which is not possible via modifier param. You can use it to add a padding before the first item or after the last one. If you want to add a spacing between each item use verticalArrangement.
reverseLayoutreverse the direction of scrolling and layout, when true items will be composed from the bottom to the top
verticalArrangementThe vertical arrangement of the items, to be used when there is enough space to show all the items. Note that only Arrangement.Top, Arrangement.Center and Arrangement.Bottom arrangements (including their spacedBy variants, i.e., using spacedBy with Alignment.Top, Alignment.CenterVertically and Alignment.Bottom) are supported, The default is Arrangement.Top when reverseLayout is false and Arrangement.Bottom when reverseLayout is true.
horizontalAlignmentThe horizontal alignment of the items.
flingBehaviorThe fling behavior to be used for the list. This parameter and the rotaryScrollableBehavior (which controls rotary scroll) should produce similar scroll effect visually.
userScrollEnabledWhether the user should be able to scroll the list. This also affects scrolling with rotary.
rotaryScrollableBehaviorParameter for changing rotary scrollable behavior. This parameter and the flingBehavior (which controls touch scroll) should produce similar scroll effect. Can be null if rotary support is not required or when it should be handled externally with a separate Modifier.rotaryScrollable modifier.
overscrollEffectthe OverscrollEffect that will be used to render overscroll for this layout. Note that the OverscrollEffect.node will be applied internally as well - you do not need to use Modifier.overscroll separately.
contentThe content of the list.
Android

Deprecated This overload is deprecated. Please use the new overload with the reverseLayout parameter.

@Composable
public fun TransformingLazyColumn(
    modifier: Modifier = Modifier,
    state: TransformingLazyColumnState = rememberTransformingLazyColumnState(),
    contentPadding: PaddingValues = PaddingValues(),
    verticalArrangement: Arrangement.Vertical =
        Arrangement.spacedBy(space = 4.dp, alignment = Alignment.Top),
    horizontalAlignment: Alignment.Horizontal = Alignment.CenterHorizontally,
    flingBehavior: FlingBehavior = ScrollableDefaults.flingBehavior(),
    userScrollEnabled: Boolean = true,
    rotaryScrollableBehavior: RotaryScrollableBehavior? = RotaryScrollableDefaults.behavior(state),
    overscrollEffect: OverscrollEffect? = rememberOverscrollEffect(),
    content: TransformingLazyColumnScope.() -> Unit,
)

The vertically scrolling list that only composes and lays out the currently visible items. This is a wear specific version of LazyColumn that adds support for scaling and morphing animations.

Parameters

modifierThe modifier to be applied to the layout.
stateThe state object to be used to control the list and the applied layout.
contentPaddinga padding around the whole content. This will add padding for the content after it has been clipped, which is not possible via modifier param. You can use it to add a padding before the first item or after the last one. If you want to add a spacing between each item use verticalArrangement.
verticalArrangementThe vertical arrangement of the items.
horizontalAlignmentThe horizontal alignment of the items.
flingBehaviorThe fling behavior to be used for the list. This parameter and the rotaryScrollableBehavior (which controls rotary scroll) should produce similar scroll effect visually.
userScrollEnabledWhether the user should be able to scroll the list. This also affects scrolling with rotary.
rotaryScrollableBehaviorParameter for changing rotary scrollable behavior. This parameter and the flingBehavior (which controls touch scroll) should produce similar scroll effect. Can be null if rotary support is not required or when it should be handled externally with a separate Modifier.rotaryScrollable modifier.
overscrollEffectthe OverscrollEffect that will be used to render overscroll for this layout. Note that the OverscrollEffect.node will be applied internally as well - you do not need to use Modifier.overscroll separately.
contentThe content of the list.

Code Examples

SimpleTransformingLazyColumnSample

@Preview
@Composable
fun SimpleTransformingLazyColumnSample() {
    val transformationSpec = rememberTransformationSpec()
    TransformingLazyColumn(contentPadding = PaddingValues(20.dp)) {
        items(count = 10) { index ->
            Button(
                modifier = Modifier.fillMaxWidth().transformedHeight(this, transformationSpec),
                transformation = SurfaceTransformation(transformationSpec),
                onClick = {},
            ) {
                Text(text = "Item $index")
            }
        }
    }
}