youssef
09/18/2024, 6:01 PM@Composable
fun Grid(
rows: Int,
columns: Int,
items: List<AacItem>,
addAndPlay: (AacItem) -> Unit,
) {
Column {
repeat(columns) { rowIndex ->
Row {
repeat(rows) { columnIndex ->
val index = rowIndex * columns + columnIndex
if (index < items.size) {
Box(
contentAlignment = Alignment.Center,
modifier = Modifier
.weight(1f)
.aspectRatio(1f)
) {
AacItem(items[index]) {
addAndPlay(it)
}
}
}
else {
Spacer(modifier = Modifier.weight(1f))
}
}
}
}
}
}
youssef hachicha
09/18/2024, 6:12 PMyoussef
09/18/2024, 6:15 PM