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

scrollState The ScrollState to used as the basis for the scroll-away.
offset Adjustment 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

scrollState The LazyListState to used as the basis for the scroll-away.
itemIndex The item for which the scroll offset will trigger scrolling away.
offset Adjustment 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

scrollState The ScalingLazyListState to used as the basis for the scroll-away.
itemIndex The item for which the scroll offset will trigger scrolling away.
offset Adjustment 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

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