Tim McCormack
04/08/2023, 6:25 PMTim McCormack
04/08/2023, 6:26 PMweight(1f)
, but the alignment sometimes "wanders" a bit across rows and columns.Tim McCormack
04/08/2023, 6:27 PMFrancesc
04/08/2023, 6:32 PMaspectRatio
Francesc
04/08/2023, 6:38 PM@Preview(widthDp = 420)
@Composable
fun Grid() {
Column(
modifier = Modifier.fillMaxWidth()
) {
repeat(8) { row ->
Row(
modifier = Modifier.fillMaxWidth()
) {
repeat(8) { index ->
Box(
modifier = Modifier
.weight(1f)
.aspectRatio(1f)
.background(
if (index % 2 == 0) Color.Red else Color.Blue
),
contentAlignment = Alignment.Center
) {
Text(
text = (row * index).toString()
)
}
}
}
}
}
}
Tim McCormack
04/08/2023, 6:45 PMTim McCormack
04/08/2023, 6:45 PMTim McCormack
04/08/2023, 9:07 PMPHondogo
04/08/2023, 9:43 PMTim McCormack
04/08/2023, 11:18 PMTim McCormack
04/08/2023, 11:25 PMModifier.size(50.dp)
for the cells, and multiples of that for the grid.Tim McCormack
04/08/2023, 11:26 PM