Ivan Pavlov
06/23/2021, 12:42 AMLazyVerticalGrid
building. Sometimes it adds an empty row after the grid itself (1 and 4 screenshots) and sometimes it doesn't (2 and 3). The full code is here
fun main() = application {
Window {
val numDays: Int = 31
val firstDayOfWeek = 4
val lastDayOfWeek = 7
MaterialTheme {
Column {
Row() {
LazyVerticalGrid(cells = GridCells.Fixed(7)) {
repeat(firstDayOfWeek) {
item {
Box(Modifier.size(40.dp)) {
Text("-")
}
}
}
repeat(numDays) { day ->
item {
Box(Modifier.size(40.dp)) {
Text("${day + 1}")
}
}
}
repeat(7 - lastDayOfWeek) {
item {
Box(Modifier.size(40.dp)) {
Text("-")
}
}
}
}
}
Row(horizontalArrangement = Arrangement.End, modifier = Modifier.fillMaxWidth()) {
Button(onClick = {}) {
Text("OK")
}
Spacer(Modifier.width(10.dp))
Button(
onClick = {},
colors = ButtonDefaults.buttonColors(backgroundColor = MaterialTheme.colors.error),
) {
Text("Cancel")
}
}
}
}
}
}
Does anybody know if I do something wrong or it's a bug or something like that?