scrollAway

Compose Modifier

Android
public fun Modifier.scrollAway(scrollState: ScrollState, offset: Dp = 0.dp): Modifier

Scroll an item vertically in/out of view based on a ScrollState. Typically used to scroll a TimeText item out of view as the user starts to scroll a vertically scrollable Column of items upwards and bring additional items into view.

Parameters

scrollStateThe ScrollState to used as the basis for the scroll-away.
offsetAdjustment to the starting point for scrolling away. Positive values result in the scroll away starting later.
Android
public fun Modifier.scrollAway(
    scrollState: LazyListState,
    itemIndex: Int = 0,
    offset: Dp = 0.dp,
): Modifier

Scroll an item vertically in/out of view based on a LazyListState. Typically used to scroll a TimeText item out of view as the user starts to scroll a LazyColumn of items upwards and bring additional items into view.

Parameters

scrollStateThe LazyListState to used as the basis for the scroll-away.
itemIndexThe item for which the scroll offset will trigger scrolling away.
offsetAdjustment to the starting point for scrolling away. Positive values result in the scroll away starting later.
Android
public fun Modifier.scrollAway(
    scrollState: ScalingLazyListState,
    itemIndex: Int = 1,
    offset: Dp = 0.dp,
): Modifier

Scroll an item vertically in/out of view based on a ScalingLazyListState. Typically used to scroll a TimeText item out of view as the user starts to scroll a ScalingLazyColumn of items upwards and bring additional items into view.

Parameters

scrollStateThe ScalingLazyListState to used as the basis for the scroll-away.
itemIndexThe item for which the scroll offset will trigger scrolling away.
offsetAdjustment to the starting point for scrolling away. Positive values result in the scroll away starting later, negative values start scrolling away earlier.
Android

Deprecated This overload is provided for backwards compatibility with Compose for Wear OS 1.1.A newer overload is available which uses ScalingLazyListState from wear.compose.foundation.lazy package

public fun Modifier.scrollAway(
    @Suppress("DEPRECATION") scrollState: androidx.wear.compose.material.ScalingLazyListState,
    itemIndex: Int = 1,
    offset: Dp = 0.dp,
): Modifier

Scroll an item vertically in/out of view based on a ScalingLazyListState. Typically used to scroll a TimeText item out of view as the user starts to scroll a ScalingLazyColumn of items upwards and bring additional items into view.

Parameters

scrollStateThe ScalingLazyListState to used as the basis for the scroll-away.
itemIndexThe item for which the scroll offset will trigger scrolling away.
offsetAdjustment to the starting point for scrolling away. Positive values result in the scroll away starting later, negative values start scrolling away earlier.