Created
September 26, 2022 12:03
-
-
Save droid-it/36a5978cdce999ac55b5d005670ce011 to your computer and use it in GitHub Desktop.
This file contains 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
@Composable | |
fun AdaptiveLazyGrid() { | |
val colors = remember { | |
listOf(Color.Yellow, Color.LightGray, Color.Cyan) | |
} | |
LazyVerticalGrid( | |
columns = GridCells.Adaptive(120.dp), | |
content = { | |
for (i in 0..20) { | |
item { | |
Box( | |
modifier = Modifier | |
.width(100.dp) | |
.height(60.dp) | |
.background(colors[i % 3]) | |
) { | |
Text("Item $i", modifier = Modifier.padding(4.dp)) | |
} | |
} | |
} | |
}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment