Skip to content

Instantly share code, notes, and snippets.

@linreal
Created January 6, 2026 13:21
Show Gist options
  • Select an option

  • Save linreal/05182d1ff018e41d1f00b37cdd6a7302 to your computer and use it in GitHub Desktop.

Select an option

Save linreal/05182d1ff018e41d1f00b37cdd6a7302 to your computer and use it in GitHub Desktop.
@OptIn(ExperimentalFoundationApi::class)
@Composable
fun ShowCarousels(sections: List<Section>) {
LazyColumn(
modifier = Modifier.fillMaxSize()
) {
items(sections, key = { it.id }) { section ->
val rowState = rememberLazyListState(
prefetchStrategy = LazyListPrefetchStrategy(
nestedPrefetchItemCount = 6)
)
Text(
text = section.title,
style = MaterialTheme.typography.titleMedium,
modifier = Modifier.padding(start = 16.dp, top = 8.dp)
)
LazyRow(
state = rowState,
contentPadding = PaddingValues(horizontal = 16.dp),
horizontalArrangement = Arrangement.spacedBy(12.dp)
) {
items(
items = section.cards,
key = { it.id },
contentType = { "card" }
) { card ->
CardItem(card)
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment