Can you please help me to fix this.
# compose
m
Can you please help me to fix this.
🧵 1
I found a workaround:
@Composable
private fun Board(rows: Int, columns: Int) {
BoxWithConstraints{
val size = min(maxWidth/columns,maxHeight/rows)
Column(Modifier.border(5.dp, Color.Red)) {
for (i in 1..rows) {
Row {
for (j in 1..columns) {
Button(
onClick = {},
content = {},
shape = RectangleShape,
modifier = Modifier.size(size,size)
.border(1.dp, Color.Green)
)
}
}
}
}
}
}
But maybe there is a better solution
o
You can just use the aspectRatio modifier. It takes a float(ratio of the dimensions) so set it to 1f to get equal dimensions on both sides