https://kotlinlang.org logo
#compose
Title
# compose
l

loloof64

02/02/2021, 10:39 AM
Hi ! I'm trying to build a simple grid with a border as a custom component. But the result is still weird : https://ibb.co/nMh6Y3x
Oups: could solve it simply by removing a padding declaration
Copy code
@Composable
fun ItemsGrid(size: Dp, modifier: Modifier = Modifier) {
    return Box(modifier = modifier.background(color = Color(LegacyColor.RED))) {
        Column(modifier = Modifier.padding(size * 0.055f)
            .size(size * 0.88f)) {
            (0 until 8).forEach { row ->
                Row(modifier = Modifier.size(width = size * 0.88f, height = size * 0.11f)) {
                    (0 until 8).forEach { col ->
                        GridCell(
                            white = (row + col) % 2 == 0,
                            modifier = Modifier
                                .size(size * 0.11f)
                        )
                    }
                }
            }
        }
    }
}
Following on the same experimentation : I've a problem in which I'm trying to add "coins" to the grid, but they are not added.