New Compose Multiplatform components arrived on Composables UICheck it out →

Modifier in Wear Material Compose

scrollAway

Android

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.

Last updated:

Installation

dependencies {
   implementation("androidx.wear.compose:compose-material:1.4.0-beta03")
}

Overloads


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

Parameters

namedescription
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.

fun Modifier.scrollAway(
    scrollState: LazyListState,
    itemIndex: Int = 0,
    offset: Dp = 0.dp,
)

Parameters

namedescription
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.

fun Modifier.scrollAway(
    scrollState: ScalingLazyListState,
    itemIndex: Int = 1,
    offset: Dp = 0.dp,
)

Parameters

namedescription
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.
@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", level = DeprecationLevel.WARNING

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

Parameters

namedescription
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.