Last active
July 11, 2022 17:02
-
-
Save arriolac/cf4966d6f02f5890f8ea0058831fcadf to your computer and use it in GitHub Desktop.
A Composable within an RV
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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