Skip to content

Instantly share code, notes, and snippets.

@arriolac
Last active July 11, 2022 17:02
Show Gist options
  • Save arriolac/cf4966d6f02f5890f8ea0058831fcadf to your computer and use it in GitHub Desktop.
Save arriolac/cf4966d6f02f5890f8ea0058831fcadf to your computer and use it in GitHub Desktop.
A Composable within an RV
// Copyright 2022 Google LLC.
// SPDX-License-Identifier: Apache-2.0
@Composable
fun ItemRow(index: Int, state: LazyListState) {
DisposableEffect(Unit) {
println("ItemRow $index composed")
onDispose { println("ItemRow $index DISPOSED") }
}
Column(Modifier.fillMaxWidth()) {
Text("Row #${index + 1}", Modifier.padding(horizontal = 8.dp))
LazyRow(state = state) {
items(25) { colIdx ->
Column(
Modifier
.padding(8.dp)
.size(96.dp, 144.dp)
) {
Box(
Modifier
.fillMaxWidth()
.weight(0.75f)
.background(Color(0xFF999999))
)
Text("Item #$colIdx")
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment