Hello, I'm trying to figure out what am I doing wr...
# compose-desktop
i
Hello, I'm trying to figure out what am I doing wrong with calendar
LazyVerticalGrid
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
Copy code
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?
🧵 2