# TransformingLazyColumnItemScope

Artifact: [androidx.wear.compose:compose-foundation](https://developer.android.com/jetpack/androidx/releases/wear-compose) [View Source](https://cs.android.com/search?q=file:androidx/wear/compose/foundation/lazy/TransformingLazyColumnDsl.kt+class:androidx.wear.compose.foundation.lazy.TransformingLazyColumnItemScope) Added in [1.5.0](https://developer.android.com/jetpack/androidx/releases/wear-compose#1.5.0)


```
@TransformingLazyColumnScopeMarker
sealed interface TransformingLazyColumnItemScope
```

<br />

*** ** * ** ***

Receiver scope being used by the item content parameter of `https://developer.android.com/reference/kotlin/androidx/wear/compose/foundation/lazy/TransformingLazyColumn.composable#TransformingLazyColumn(androidx.compose.ui.Modifier,androidx.wear.compose.foundation.lazy.TransformingLazyColumnState,androidx.compose.foundation.layout.PaddingValues,kotlin.Boolean,androidx.compose.foundation.layout.Arrangement.Vertical,androidx.compose.ui.Alignment.Horizontal,androidx.compose.foundation.gestures.FlingBehavior,kotlin.Boolean,androidx.wear.compose.foundation.rotary.RotaryScrollableBehavior,androidx.compose.foundation.OverscrollEffect,androidx.wear.compose.foundation.lazy.TransformingLazyColumnFirstLayoutItemProvider,kotlin.Function1)`.

## Summary

| ### Public functions |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/Modifier` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/Modifier.https://developer.android.com/reference/kotlin/androidx/wear/compose/foundation/lazy/TransformingLazyColumnItemScope#(androidx.compose.ui.Modifier).animateItem(androidx.compose.animation.core.FiniteAnimationSpec,androidx.compose.animation.core.FiniteAnimationSpec,androidx.compose.animation.core.FiniteAnimationSpec)( fadeInSpec: https://developer.android.com/reference/kotlin/androidx/compose/animation/core/FiniteAnimationSpec<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html>?, placementSpec: https://developer.android.com/reference/kotlin/androidx/compose/animation/core/FiniteAnimationSpec<https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/IntOffset>?, fadeOutSpec: https://developer.android.com/reference/kotlin/androidx/compose/animation/core/FiniteAnimationSpec<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html>? )` This modifier animates item appearance (fade in), disappearance (fade out) and placement changes (such as an item reordering). |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/Modifier` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/Modifier.https://developer.android.com/reference/kotlin/androidx/wear/compose/foundation/lazy/TransformingLazyColumnItemScope#(androidx.compose.ui.Modifier).minimumVerticalContentPadding(androidx.compose.ui.unit.Dp)(padding: https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp)` This modifier allows items to choose a preferred content padding for the list, if they are placed at the top or bottom edge. |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/Modifier` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/Modifier.https://developer.android.com/reference/kotlin/androidx/wear/compose/foundation/lazy/TransformingLazyColumnItemScope#(androidx.compose.ui.Modifier).minimumVerticalContentPadding(androidx.compose.ui.unit.Dp,androidx.compose.ui.unit.Dp)(top: https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp, bottom: https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp)` This modifier allows items to choose a preferred content padding for the list, if they are placed at the top or bottom edge. |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/Modifier` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/Modifier.https://developer.android.com/reference/kotlin/androidx/wear/compose/foundation/lazy/TransformingLazyColumnItemScope#(androidx.compose.ui.Modifier).transformedHeight(kotlin.Function2)( heightProvider: (measuredHeight: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, scrollProgress: https://developer.android.com/reference/kotlin/androidx/wear/compose/foundation/lazy/TransformingLazyColumnItemScrollProgress) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html )` Applies the new height of the item depending on its scroll progress and measured height. |

| ### Public properties |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/wear/compose/foundation/lazy/TransformingLazyColumnItemScrollProgress` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/GraphicsLayerScope.https://developer.android.com/reference/kotlin/androidx/wear/compose/foundation/lazy/TransformingLazyColumnItemScope#(androidx.compose.ui.graphics.GraphicsLayerScope).scrollProgress()` Scroll progress of the item before height transformation is applied using `https://developer.android.com/reference/kotlin/androidx/wear/compose/foundation/lazy/TransformingLazyColumnItemScope#(androidx.compose.ui.Modifier).transformedHeight(kotlin.Function2)`. |
| `https://developer.android.com/reference/kotlin/androidx/wear/compose/foundation/lazy/TransformingLazyColumnItemScrollProgress` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/drawscope/DrawScope.https://developer.android.com/reference/kotlin/androidx/wear/compose/foundation/lazy/TransformingLazyColumnItemScope#(androidx.compose.ui.graphics.drawscope.DrawScope).scrollProgress()` Scroll progress of the item before height transformation is applied using `https://developer.android.com/reference/kotlin/androidx/wear/compose/foundation/lazy/TransformingLazyColumnItemScope#(androidx.compose.ui.Modifier).transformedHeight(kotlin.Function2)`. |

| ### Extension functions |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/SurfaceTransformation` | `https://developer.android.com/reference/kotlin/androidx/wear/compose/foundation/lazy/TransformingLazyColumnItemScope.https://developer.android.com/reference/kotlin/androidx/wear/compose/foundation/lazy/TransformingLazyColumnItemScope#(androidx.wear.compose.foundation.lazy.TransformingLazyColumnItemScope).SurfaceTransformation(androidx.wear.compose.material3.lazy.TransformationSpec)( spec: https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/lazy/TransformationSpec )` Exposes `https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/lazy/TransformationSpec` as `https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/package-summary#(androidx.wear.compose.foundation.lazy.TransformingLazyColumnItemScope).SurfaceTransformation(androidx.wear.compose.material3.lazy.TransformationSpec)` to be used with Material components. |

## Public functions

### Modifier.animateItem

Artifact: [androidx.wear.compose:compose-foundation](https://developer.android.com/jetpack/androidx/releases/wear-compose) [View Source](https://cs.android.com/search?q=file:androidx/wear/compose/foundation/lazy/TransformingLazyColumnDsl.kt+function:animateItem) Added in [1.5.0](https://developer.android.com/jetpack/androidx/releases/wear-compose#1.5.0)

```
fun Modifier.animateItem(
    fadeInSpec: FiniteAnimationSpec<Float>? = spring(stiffness = Spring.StiffnessMediumLow),
    placementSpec: FiniteAnimationSpec<IntOffset>? = spring(
                stiffness = Spring.StiffnessMediumLow,
                visibilityThreshold = IntOffset.VisibilityThreshold,
            ),
    fadeOutSpec: FiniteAnimationSpec<Float>? = spring(stiffness = Spring.StiffnessMediumLow)
): Modifier
```

This modifier animates item appearance (fade in), disappearance (fade out) and placement changes (such as an item reordering).

You should also provide a unique key via `https://developer.android.com/reference/kotlin/androidx/wear/compose/foundation/lazy/TransformingLazyColumnScope#item(kotlin.Any,kotlin.Any,kotlin.Function1)`/ `https://developer.android.com/reference/kotlin/androidx/wear/compose/foundation/lazy/TransformingLazyColumnScope#items(kotlin.Int,kotlin.Function1,kotlin.Function1,kotlin.Function2)` for this modifier to enable animations.

```kotlin
import androidx.compose.foundation.background
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.padding
import androidx.compose.runtime.mutableIntStateOf
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.unit.dp
import androidx.wear.compose.foundation.lazy.TransformingLazyColumn
import androidx.wear.compose.foundation.lazy.rememberTransformingLazyColumnState
import androidx.wear.compose.material.Text

val state = rememberTransformingLazyColumnState()

var list by remember { mutableStateOf(listOf("1", "2", "3")) }

var next by remember { mutableIntStateOf(4) }

Box(Modifier.fillMaxSize()) {
    TransformingLazyColumn(
        state = state,
        contentPadding = PaddingValues(5.dp),
        modifier = Modifier.background(Color.Black).fillMaxSize(),
    ) {
        items(list.size, key = { list[it] }) {
            Text(
                "Item ${list[it]}",
                Modifier.animateItem().clickable {
                    list = list.filter { elem -> elem != list[it] }
                },
            )
        }
    }
    Text(
        "+",
        Modifier.align(Alignment.CenterStart).padding(horizontal = 5.dp).clickable {
            if (list.size < 25) list = list + "${next++}"
        },
    )
    Text(
        "S",
        Modifier.align(Alignment.CenterEnd).padding(horizontal = 5.dp).clickable {
            list = list.shuffled()
        },
    )
}
```

| Parameters |
|---|---|
| `fadeInSpec: https://developer.android.com/reference/kotlin/androidx/compose/animation/core/FiniteAnimationSpec<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html>? = spring(stiffness = Spring.StiffnessMediumLow)` | an animation spec to use for animating the item appearance. When null is provided the item will appear without animations. |
| `placementSpec: https://developer.android.com/reference/kotlin/androidx/compose/animation/core/FiniteAnimationSpec<https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/IntOffset>? = spring( stiffness = Spring.StiffnessMediumLow, visibilityThreshold = IntOffset.VisibilityThreshold, )` | an animation spec that will be used to animate the item placement. Aside from item reordering all other position changes caused by events like arrangement or alignment changes will also be animated. When null is provided no animations will happen. |
| `fadeOutSpec: https://developer.android.com/reference/kotlin/androidx/compose/animation/core/FiniteAnimationSpec<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html>? = spring(stiffness = Spring.StiffnessMediumLow)` | an animation spec to use for animating the item disappearance. When null is provided the item will disappear without animations. |

### Modifier.minimumVerticalContentPadding

Artifact: [androidx.wear.compose:compose-foundation](https://developer.android.com/jetpack/androidx/releases/wear-compose) [View Source](https://cs.android.com/search?q=file:androidx/wear/compose/foundation/lazy/TransformingLazyColumnDsl.kt+function:minimumVerticalContentPadding) Added in [1.6.0](https://developer.android.com/jetpack/androidx/releases/wear-compose#1.6.0)

```
fun Modifier.minimumVerticalContentPadding(padding: Dp): Modifier
```

This modifier allows items to choose a preferred content padding for the list, if they are placed at the top or bottom edge. When this item is at the top or bottom of the layout, the `https://developer.android.com/reference/kotlin/androidx/wear/compose/foundation/lazy/TransformingLazyColumn.composable#TransformingLazyColumn(androidx.compose.ui.Modifier,androidx.wear.compose.foundation.lazy.TransformingLazyColumnState,androidx.compose.foundation.layout.PaddingValues,kotlin.Boolean,androidx.compose.foundation.layout.Arrangement.Vertical,androidx.compose.ui.Alignment.Horizontal,androidx.compose.foundation.gestures.FlingBehavior,kotlin.Boolean,androidx.wear.compose.foundation.rotary.RotaryScrollableBehavior,androidx.compose.foundation.OverscrollEffect,androidx.wear.compose.foundation.lazy.TransformingLazyColumnFirstLayoutItemProvider,kotlin.Function1)` takes its contentPadding as the maximum of this vertical padding value and its own contentPadding parameter.

The vertical padding values are expected to be provided by design systems, such as the recommended values in Material3 `ButtonDefaults`, `CardDefaults`, `ListHeaderDefaults` and so on.

This modifier can be used to ensure that, when a list item is at the top or bottom of the list, the distance from the item to the screen edge is sufficient (such as to avoid the item being clipped by edges of a round screen).

```kotlin
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.runtime.remember
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp
import androidx.wear.compose.foundation.lazy.TransformingLazyColumn
import androidx.wear.compose.material.Text
import androidx.wear.compose.material3.Button
import androidx.wear.compose.material3.ButtonDefaults
import androidx.wear.compose.material3.SurfaceTransformation
import androidx.wear.compose.material3.lazy.rememberTransformationSpec
import androidx.wear.compose.material3.lazy.transformedHeight

val transformationSpec = rememberTransformationSpec()

TransformingLazyColumn(contentPadding = PaddingValues(horizontal = 20.dp)) {
    items(count = 20) { index ->
        Button(
            modifier =
                Modifier.fillMaxWidth()
                    .transformedHeight(this, transformationSpec)
                    .minimumVerticalContentPadding(
                        ButtonDefaults.minimumVerticalListContentPadding
                    ),
            transformation = SurfaceTransformation(transformationSpec),
            onClick = {},
        ) {
            Text(text = "Item $index")
        }
    }
}
```

| Parameters |
|---|---|
| `padding: https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp` | The preferred content padding for the list, when this item is placed at either the top or bottom edges. |

### Modifier.minimumVerticalContentPadding

Artifact: [androidx.wear.compose:compose-foundation](https://developer.android.com/jetpack/androidx/releases/wear-compose) [View Source](https://cs.android.com/search?q=file:androidx/wear/compose/foundation/lazy/TransformingLazyColumnDsl.kt+function:minimumVerticalContentPadding) Added in [1.6.0](https://developer.android.com/jetpack/androidx/releases/wear-compose#1.6.0)

```
fun Modifier.minimumVerticalContentPadding(top: Dp, bottom: Dp): Modifier
```

This modifier allows items to choose a preferred content padding for the list, if they are placed at the top or bottom edge. When this item is at the top or bottom of the layout, the `https://developer.android.com/reference/kotlin/androidx/wear/compose/foundation/lazy/TransformingLazyColumn.composable#TransformingLazyColumn(androidx.compose.ui.Modifier,androidx.wear.compose.foundation.lazy.TransformingLazyColumnState,androidx.compose.foundation.layout.PaddingValues,kotlin.Boolean,androidx.compose.foundation.layout.Arrangement.Vertical,androidx.compose.ui.Alignment.Horizontal,androidx.compose.foundation.gestures.FlingBehavior,kotlin.Boolean,androidx.wear.compose.foundation.rotary.RotaryScrollableBehavior,androidx.compose.foundation.OverscrollEffect,androidx.wear.compose.foundation.lazy.TransformingLazyColumnFirstLayoutItemProvider,kotlin.Function1)` takes its contentPadding as the maximum of these vertical padding values and its own contentPadding parameter.

The vertical padding values are expected to be provided by design systems, such as the recommended values in Material3 `ButtonDefaults`, `CardDefaults`, `ListHeaderDefaults` and so on.

This modifier can be used to ensure that, when a list item is at the top or bottom of the list, the distance from the item to the screen edge is sufficient (such as to avoid the item being clipped by edges of a round screen).

```kotlin
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.runtime.remember
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp
import androidx.wear.compose.foundation.lazy.TransformingLazyColumn
import androidx.wear.compose.material.Text
import androidx.wear.compose.material3.Button
import androidx.wear.compose.material3.ButtonDefaults
import androidx.wear.compose.material3.SurfaceTransformation
import androidx.wear.compose.material3.lazy.rememberTransformationSpec
import androidx.wear.compose.material3.lazy.transformedHeight

val transformationSpec = rememberTransformationSpec()

TransformingLazyColumn(contentPadding = PaddingValues(horizontal = 20.dp)) {
    items(count = 20) { index ->
        Button(
            modifier =
                Modifier.fillMaxWidth()
                    .transformedHeight(this, transformationSpec)
                    .minimumVerticalContentPadding(
                        ButtonDefaults.minimumVerticalListContentPadding
                    ),
            transformation = SurfaceTransformation(transformationSpec),
            onClick = {},
        ) {
            Text(text = "Item $index")
        }
    }
}
```

| Parameters |
|---|---|
| `top: https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp` | The preferred top content padding for the list, when this item is placed at the top edge. Used when either this is the first item for a layout that is not reversed, or this is the last item for a reversed layout. |
| `bottom: https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp` | The preferred bottom content padding for the list, when this item is placed at the bottom edge. Used when either this is the last item for a layout that is not reversed, or this is the first item for a reversed layout. |

### Modifier.transformedHeight

Artifact: [androidx.wear.compose:compose-foundation](https://developer.android.com/jetpack/androidx/releases/wear-compose) [View Source](https://cs.android.com/search?q=file:androidx/wear/compose/foundation/lazy/TransformingLazyColumnDsl.kt+function:transformedHeight) Added in [1.5.0](https://developer.android.com/jetpack/androidx/releases/wear-compose#1.5.0)

```
fun Modifier.transformedHeight(
    heightProvider: (measuredHeight: Int, scrollProgress: TransformingLazyColumnItemScrollProgress) -> Int
): Modifier
```

Applies the new height of the item depending on its scroll progress and measured height.

| Parameters |
|---|---|
| `heightProvider: (measuredHeight: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, scrollProgress: https://developer.android.com/reference/kotlin/androidx/wear/compose/foundation/lazy/TransformingLazyColumnItemScrollProgress) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The transformation to be applied. The first parameter is the height of the item returned during measurement. The second parameter is the scroll progress of the item. This lambda should not read from any state values. |

## Public properties

### GraphicsLayerScope.scrollProgress

Artifact: [androidx.wear.compose:compose-foundation](https://developer.android.com/jetpack/androidx/releases/wear-compose) [View Source](https://cs.android.com/search?q=file:androidx/wear/compose/foundation/lazy/TransformingLazyColumnDsl.kt+symbol:scrollProgress)

```
val GraphicsLayerScope.scrollProgress: TransformingLazyColumnItemScrollProgress
```

Scroll progress of the item before height transformation is applied using `https://developer.android.com/reference/kotlin/androidx/wear/compose/foundation/lazy/TransformingLazyColumnItemScope#(androidx.compose.ui.Modifier).transformedHeight(kotlin.Function2)`. Is `https://developer.android.com/reference/kotlin/androidx/wear/compose/foundation/lazy/TransformingLazyColumnItemScrollProgress#Unspecified()` for the item that is off screen.

### DrawScope.scrollProgress

Artifact: [androidx.wear.compose:compose-foundation](https://developer.android.com/jetpack/androidx/releases/wear-compose) [View Source](https://cs.android.com/search?q=file:androidx/wear/compose/foundation/lazy/TransformingLazyColumnDsl.kt+symbol:scrollProgress)

```
val DrawScope.scrollProgress: TransformingLazyColumnItemScrollProgress
```

Scroll progress of the item before height transformation is applied using `https://developer.android.com/reference/kotlin/androidx/wear/compose/foundation/lazy/TransformingLazyColumnItemScope#(androidx.compose.ui.Modifier).transformedHeight(kotlin.Function2)`. Is `https://developer.android.com/reference/kotlin/androidx/wear/compose/foundation/lazy/TransformingLazyColumnItemScrollProgress#Unspecified()` for the item that is off screen.

## Extension functions

### TransformingLazyColumnItemScope.SurfaceTransformation

Artifact: [androidx.wear.compose:compose-material3](https://developer.android.com/jetpack/androidx/releases/wear-compose) [View Source](https://cs.android.com/search?q=file:androidx/wear/compose/material3/SurfaceTransformation.kt+function:SurfaceTransformation)

```
fun TransformingLazyColumnItemScope.SurfaceTransformation(
    spec: TransformationSpec
): SurfaceTransformation
```

Exposes `https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/lazy/TransformationSpec` as `https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/package-summary#(androidx.wear.compose.foundation.lazy.TransformingLazyColumnItemScope).SurfaceTransformation(androidx.wear.compose.material3.lazy.TransformationSpec)` to be used with Material components.

| Parameters |
|---|---|
| `spec: https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/lazy/TransformationSpec` | `https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/lazy/TransformationSpec` to be used. |