Skip to content

Instantly share code, notes, and snippets.

@surajsau
Created December 7, 2020 15:28
Show Gist options
  • Save surajsau/5c6e74ec91aaf71b559b377c9d68604e to your computer and use it in GitHub Desktop.
Save surajsau/5c6e74ec91aaf71b559b377c9d68604e to your computer and use it in GitHub Desktop.
val items = listOf<Item>(..)
@Composable
fun Parallax(modifier: Modifier = Modifier) {
// [1]
val scrollState = rememberScrollState()
// [2]
ScrollableRow(
modifier = modifier,
scrollState = scrollState
) {
items.forEach {
ItemCard(item = it, scrollX = scrollState.value)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment