Код: Выделить всё
@OptIn(ExperimentalLayoutApi::class)
@Composable
fun Gallery() {
val viewModel = koinViewModel()
val state by viewModel.state.collectAsStateWithLifecycle()
FlowRow(
modifier = Modifier
.padding(5.dp)
.fillMaxSize()
.verticalScroll(rememberScrollState()),
maxItemsInEachRow = 2,
horizontalArrangement = Arrangement.SpaceAround
) {
state.images.forEach { imageItem ->
Card(modifier = Modifier.padding(3.dp).fillMaxSize()) {
AsyncImage(
modifier = Modifier.fillMaxWidth(),
model = imageItem.pUrl,
contentDescription = imageItem.title,
alignment = Alignment.Center
)
}
}
}
}
Подробнее здесь: https://stackoverflow.com/questions/796 ... nd-also-ha