This is a scrolling list component that only composes and lays out the currently visible items.
VerticalListSample
@Composable
fun VerticalListSample() {
VerticalList {
item { ListItem { Text("Header") } }
items(count = 10) { index -> ListItem { Text("Item-$index") } }
item { ListItem { Text("Footer") } }
}
}
VerticalListWithTitleChipSample
@Composable
fun VerticalListWithTitleChipSample() {
val ingredientItems =
listOf("Milk", "Flour", "Egg", "Salt", "Apples", "Butter", "Vanilla", "Sugar", "Cinnamon")
VerticalList(title = { TitleChip { Text("Ingredients") } }) {
items(ingredientItems) { text -> ListItem { Text(text) } }
}
}