Skip to content

Instantly share code, notes, and snippets.

@AndroidPoet
Last active October 22, 2022 03:22
Show Gist options
  • Save AndroidPoet/840a2774cdcdfb4bb23197fe5a911f3f to your computer and use it in GitHub Desktop.
Save AndroidPoet/840a2774cdcdfb4bb23197fe5a911f3f to your computer and use it in GitHub Desktop.
@Composable
fun SecondRootComposable() {
Box(Modifier.fillMaxSize()) { // Recomposition Scope Start
val scroll = rememberScrollState(0)
Title(snack = snack,scroll=scroll.value)
}
}
@Composable
private fun Title(snack: Snack, ,scroll: Int) {
val offset = with(LocalDensity.current) { scroll.toDp() }
Column(
modifier = Modifier
.offset(y = offset)
) {
// ...
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment