# ScalingLazyListState

Artifact: [androidx.wear.compose:compose-material](https://developer.android.com/jetpack/androidx/releases/wear-compose) [View Source](https://cs.android.com/search?q=file:androidx/wear/compose/material/ScalingLazyListState.kt+class:androidx.wear.compose.material.ScalingLazyListState) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-compose#1.0.0) Deprecated in [1.2.0](https://developer.android.com/jetpack/androidx/releases/wear-compose#1.2.0)

<br />

```
class ScalingLazyListState : ScrollableState
```

<br />

*** ** * ** ***

> [!CAUTION]
> **This class is deprecated.**   
> Was moved to androidx.wear.compose.foundation.lazy package. Please use it instead

A state object that can be hoisted to control and observe scrolling.

In most cases, this will be created via `https://developer.android.com/reference/kotlin/androidx/wear/compose/material/rememberScalingLazyListState.composable#rememberScalingLazyListState(kotlin.Int,kotlin.Int)`.

## Summary

| ### Public companion properties |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/runtime/saveable/Saver<https://developer.android.com/reference/kotlin/androidx/wear/compose/material/ScalingLazyListState, https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html>` | `https://developer.android.com/reference/kotlin/androidx/wear/compose/material/ScalingLazyListState#Saver()` **This property is deprecated.** Was moved to androidx.wear.compose.foundation.lazy package. |

| ### Public constructors |
|---|
| `[ScalingLazyListState](https://developer.android.com/reference/kotlin/androidx/wear/compose/material/ScalingLazyListState#ScalingLazyListState(kotlin.Int,kotlin.Int))( initialCenterItemIndex: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, initialCenterItemScrollOffset: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html )` **This function is deprecated.** Was moved to androidx.wear.compose.foundation.lazy package. |

| ### Public functions |
|---|---|
| `suspend https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `[animateScrollToItem](https://developer.android.com/reference/kotlin/androidx/wear/compose/material/ScalingLazyListState#animateScrollToItem(kotlin.Int,kotlin.Int))(index: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, scrollOffset: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` **This function is deprecated.** Was moved to androidx.wear.compose.foundation.lazy package. |
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | `[dispatchRawDelta](https://developer.android.com/reference/kotlin/androidx/wear/compose/material/ScalingLazyListState#dispatchRawDelta(kotlin.Float))(delta: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html)` **This function is deprecated.** Was moved to androidx.wear.compose.foundation.lazy package. |
| `open suspend https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `[scroll](https://developer.android.com/reference/kotlin/androidx/wear/compose/material/ScalingLazyListState#scroll(androidx.compose.foundation.MutatePriority,kotlin.coroutines.SuspendFunction1))(scrollPriority: https://developer.android.com/reference/kotlin/androidx/compose/foundation/MutatePriority, block: suspend https://developer.android.com/reference/kotlin/androidx/compose/foundation/gestures/ScrollScope.() -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)` **This function is deprecated.** Was moved to androidx.wear.compose.foundation.lazy package. |
| `suspend https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `[scrollToItem](https://developer.android.com/reference/kotlin/androidx/wear/compose/material/ScalingLazyListState#scrollToItem(kotlin.Int,kotlin.Int))(index: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, scrollOffset: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` **This function is deprecated.** Was moved to androidx.wear.compose.foundation.lazy package. |

| ### Public properties |
|---|---|
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/wear/compose/material/ScalingLazyListState#canScrollBackward()` **This property is deprecated.** Was moved to androidx.wear.compose.foundation.lazy package. |
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/wear/compose/material/ScalingLazyListState#canScrollForward()` **This property is deprecated.** Was moved to androidx.wear.compose.foundation.lazy package. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/wear/compose/material/ScalingLazyListState#centerItemIndex()` **This property is deprecated.** Was moved to androidx.wear.compose.foundation.lazy package. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/wear/compose/material/ScalingLazyListState#centerItemScrollOffset()` **This property is deprecated.** Was moved to androidx.wear.compose.foundation.lazy package. |
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/wear/compose/material/ScalingLazyListState#isScrollInProgress()` **This property is deprecated.** Was moved to androidx.wear.compose.foundation.lazy package. |
| `https://developer.android.com/reference/kotlin/androidx/wear/compose/material/ScalingLazyListLayoutInfo` | `https://developer.android.com/reference/kotlin/androidx/wear/compose/material/ScalingLazyListState#layoutInfo()` **This property is deprecated.** Was moved to androidx.wear.compose.foundation.lazy package. |

### Inherited properties

From [androidx.compose.foundation.gestures.ScrollableState](https://developer.android.com/reference/kotlin/androidx/compose/foundation/gestures/ScrollableState) `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` `https://developer.android.com/reference/kotlin/androidx/compose/foundation/gestures/ScrollableState#lastScrolledBackward()`

**This property is deprecated.** Was moved to androidx.wear.compose.foundation.lazy package.
`open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` `https://developer.android.com/reference/kotlin/androidx/compose/foundation/gestures/ScrollableState#lastScrolledForward()`

**This property is deprecated.** Was moved to androidx.wear.compose.foundation.lazy package.
`open https://developer.android.com/reference/kotlin/androidx/compose/foundation/ScrollIndicatorState?` `https://developer.android.com/reference/kotlin/androidx/compose/foundation/gestures/ScrollableState#scrollIndicatorState()`

**This property is deprecated.** Was moved to androidx.wear.compose.foundation.lazy package.

## Public companion properties

### Saver

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-compose#1.0.0) Deprecated in [1.2.0](https://developer.android.com/jetpack/androidx/releases/wear-compose#1.2.0)

```
val Saver: Saver<ScalingLazyListState, Any>
```

> [!CAUTION]
> **This property is deprecated.**   
> Was moved to androidx.wear.compose.foundation.lazy package. Please use it instead

The default `https://developer.android.com/reference/kotlin/androidx/wear/compose/material/ScalingLazyListState#Saver()` implementation for `https://developer.android.com/reference/kotlin/androidx/wear/compose/material/ScalingLazyListState`.

## Public constructors

### ScalingLazyListState

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-compose#1.0.0) Deprecated in [1.2.0](https://developer.android.com/jetpack/androidx/releases/wear-compose#1.2.0)

```
[ScalingLazyListState](https://developer.android.com/reference/kotlin/androidx/wear/compose/material/ScalingLazyListState#ScalingLazyListState(kotlin.Int,kotlin.Int))(
    initialCenterItemIndex: Int = 1,
    initialCenterItemScrollOffset: Int = 0
)
```

> [!CAUTION]
> **This function is deprecated.**   
> Was moved to androidx.wear.compose.foundation.lazy package. Please use it instead

| Parameters |
|---|---|
| `initialCenterItemIndex: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html = 1` | the initial value for `https://developer.android.com/reference/kotlin/androidx/wear/compose/material/ScalingLazyListState#centerItemIndex()`, defaults to 1. This will place the 2nd list item (index == 1) in the center of the viewport and the first item (index == 0) before it. If the developer wants custom control over position and spacing they can switch off autoCentering and provide contentPadding. |
| `initialCenterItemScrollOffset: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html = 0` | the initial value for `https://developer.android.com/reference/kotlin/androidx/wear/compose/material/ScalingLazyListState#centerItemScrollOffset()` Note that it is not always possible for the values provided by `https://developer.android.com/reference/kotlin/androidx/wear/compose/material/ScalingLazyListState#initialCenterItemIndex()` and `https://developer.android.com/reference/kotlin/androidx/wear/compose/material/ScalingLazyListState#initialCenterItemScrollOffset()` to be honored, e.g. If `https://developer.android.com/reference/kotlin/androidx/wear/compose/material/ScalingLazyListState#initialCenterItemIndex()` is set to a value larger than the number of items initially in the list, or to an index that can not be placed in the middle of the screen due to the contentPadding or autoCentering properties provided to the `https://developer.android.com/reference/kotlin/androidx/wear/compose/material/ScalingLazyColumn.composable#ScalingLazyColumn(androidx.compose.ui.Modifier,androidx.wear.compose.material.ScalingLazyListState,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.material.ScalingParams,androidx.wear.compose.material.ScalingLazyListAnchorType,androidx.wear.compose.material.AutoCenteringParams,kotlin.Function1)`. After the `https://developer.android.com/reference/kotlin/androidx/wear/compose/material/ScalingLazyColumn.composable#ScalingLazyColumn(androidx.compose.ui.Modifier,androidx.wear.compose.material.ScalingLazyListState,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.material.ScalingParams,androidx.wear.compose.material.ScalingLazyListAnchorType,androidx.wear.compose.material.AutoCenteringParams,kotlin.Function1)` is initially drawn the actual values for the `https://developer.android.com/reference/kotlin/androidx/wear/compose/material/ScalingLazyListState#centerItemIndex()` and `https://developer.android.com/reference/kotlin/androidx/wear/compose/material/ScalingLazyListState#centerItemScrollOffset()` can be read from the state. |

## Public functions

### animateScrollToItem

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-compose#1.0.0) Deprecated in [1.2.0](https://developer.android.com/jetpack/androidx/releases/wear-compose#1.2.0)

```
suspend fun [animateScrollToItem](https://developer.android.com/reference/kotlin/androidx/wear/compose/material/ScalingLazyListState#animateScrollToItem(kotlin.Int,kotlin.Int))(index: Int, scrollOffset: Int = 0): Unit
```

> [!CAUTION]
> **This function is deprecated.**   
> Was moved to androidx.wear.compose.foundation.lazy package. Please use it instead

Animate (smooth scroll) the given item at `https://developer.android.com/reference/kotlin/androidx/wear/compose/material/ScalingLazyListState#animateScrollToItem(kotlin.Int,kotlin.Int)` to the center of the viewport and position it based on the `https://developer.android.com/reference/kotlin/androidx/wear/compose/material/ScalingLazyListState#anchorType()` and applies the `https://developer.android.com/reference/kotlin/androidx/wear/compose/material/ScalingLazyListState#animateScrollToItem(kotlin.Int,kotlin.Int)` pixels.

| Parameters |
|---|---|
| `index: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | the index to which to scroll. Must be non-negative. |
| `scrollOffset: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html = 0` | the offset that the item should end up after the scroll (same as `https://developer.android.com/reference/kotlin/androidx/wear/compose/material/ScalingLazyListState#scrollToItem(kotlin.Int,kotlin.Int)`) - note that positive offset refers to forward scroll, so in a top-to-bottom list, positive offset will scroll the item further upward (taking it partly offscreen) |

### dispatchRawDelta

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-compose#1.0.0) Deprecated in [1.2.0](https://developer.android.com/jetpack/androidx/releases/wear-compose#1.2.0)

```
open fun [dispatchRawDelta](https://developer.android.com/reference/kotlin/androidx/wear/compose/material/ScalingLazyListState#dispatchRawDelta(kotlin.Float))(delta: Float): Float
```

> [!CAUTION]
> **This function is deprecated.**   
> Was moved to androidx.wear.compose.foundation.lazy package. Please use it instead

### scroll

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-compose#1.0.0) Deprecated in [1.2.0](https://developer.android.com/jetpack/androidx/releases/wear-compose#1.2.0)

```
open suspend fun [scroll](https://developer.android.com/reference/kotlin/androidx/wear/compose/material/ScalingLazyListState#scroll(androidx.compose.foundation.MutatePriority,kotlin.coroutines.SuspendFunction1))(scrollPriority: MutatePriority, block: suspend ScrollScope.() -> Unit): Unit
```

> [!CAUTION]
> **This function is deprecated.**   
> Was moved to androidx.wear.compose.foundation.lazy package. Please use it instead

### scrollToItem

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-compose#1.0.0) Deprecated in [1.2.0](https://developer.android.com/jetpack/androidx/releases/wear-compose#1.2.0)

```
suspend fun [scrollToItem](https://developer.android.com/reference/kotlin/androidx/wear/compose/material/ScalingLazyListState#scrollToItem(kotlin.Int,kotlin.Int))(index: Int, scrollOffset: Int = 0): Unit
```

> [!CAUTION]
> **This function is deprecated.**   
> Was moved to androidx.wear.compose.foundation.lazy package. Please use it instead

Instantly brings the item at `https://developer.android.com/reference/kotlin/androidx/wear/compose/material/ScalingLazyListState#scrollToItem(kotlin.Int,kotlin.Int)` to the center of the viewport and positions it based on the `https://developer.android.com/reference/kotlin/androidx/wear/compose/material/ScalingLazyListState#anchorType()` and applies the `https://developer.android.com/reference/kotlin/androidx/wear/compose/material/ScalingLazyListState#scrollToItem(kotlin.Int,kotlin.Int)` pixels.

| Parameters |
|---|---|
| `index: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | the index to which to scroll. Must be non-negative. |
| `scrollOffset: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html = 0` | the offset that the item should end up after the scroll. Note that positive offset refers to forward scroll, so in a top-to-bottom list, positive offset will scroll the item further upward (taking it partly offscreen). |

## Public properties

### canScrollBackward

```
open val canScrollBackward: Boolean
```

> [!CAUTION]
> **This property is deprecated.**   
> Was moved to androidx.wear.compose.foundation.lazy package. Please use it instead

### canScrollForward

```
open val canScrollForward: Boolean
```

> [!CAUTION]
> **This property is deprecated.**   
> Was moved to androidx.wear.compose.foundation.lazy package. Please use it instead

### centerItemIndex

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-compose#1.0.0) Deprecated in [1.2.0](https://developer.android.com/jetpack/androidx/releases/wear-compose#1.2.0)

```
val centerItemIndex: Int
```

> [!CAUTION]
> **This property is deprecated.**   
> Was moved to androidx.wear.compose.foundation.lazy package. Please use it instead

The index of the item positioned closest to the viewport center

### centerItemScrollOffset

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-compose#1.0.0) Deprecated in [1.2.0](https://developer.android.com/jetpack/androidx/releases/wear-compose#1.2.0)

```
val centerItemScrollOffset: Int
```

> [!CAUTION]
> **This property is deprecated.**   
> Was moved to androidx.wear.compose.foundation.lazy package. Please use it instead

The offset of the item closest to the viewport center. Depending on the `https://developer.android.com/reference/kotlin/androidx/wear/compose/material/ScalingLazyListAnchorType` of the `https://developer.android.com/reference/kotlin/androidx/wear/compose/material/ScalingLazyColumn.composable#ScalingLazyColumn(androidx.compose.ui.Modifier,androidx.wear.compose.material.ScalingLazyListState,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.material.ScalingParams,androidx.wear.compose.material.ScalingLazyListAnchorType,androidx.wear.compose.material.AutoCenteringParams,kotlin.Function1)` the offset will be relative to either the items Edge or Center.

A positive value indicates that the center item's anchor point is above the viewport center-line, a negative value indicates that the center item anchor point is below the viewport center-line.

### isScrollInProgress

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-compose#1.0.0) Deprecated in [1.2.0](https://developer.android.com/jetpack/androidx/releases/wear-compose#1.2.0)

```
open val isScrollInProgress: Boolean
```

> [!CAUTION]
> **This property is deprecated.**   
> Was moved to androidx.wear.compose.foundation.lazy package. Please use it instead

### layoutInfo

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-compose#1.0.0) Deprecated in [1.2.0](https://developer.android.com/jetpack/androidx/releases/wear-compose#1.2.0)

```
val layoutInfo: ScalingLazyListLayoutInfo
```

> [!CAUTION]
> **This property is deprecated.**   
> Was moved to androidx.wear.compose.foundation.lazy package. Please use it instead

The object of `https://developer.android.com/reference/kotlin/androidx/wear/compose/material/ScalingLazyListLayoutInfo` calculated during the last layout pass. For example, you can use it to calculate what items are currently visible.