Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSS

grid height same as width compose

@Composable
fun Board() {
    Column {
        for (i in 0 until 8) {
            Row {
                for (j in 0 until 8) {
                    val isLightSquare = i % 2 == j % 2
                    val squareColor = if (isLightSquare) lightSquare else darkSquare
                    Box(
                        modifier = Modifier
                            .weight(1f)
                            .aspectRatio(1f)
                            .background(squareColor)
                    ) {
                        Text(text = "${i + j}")
                    }
                }
            }
        }
    }
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #grid #height #width #compose
ADD COMMENT
Topic
Name
4+4 =