I have a LazyColumn with a template defined for ea...
# compose
j
I have a LazyColumn with a template defined for each item. Is there a way to have a container composable around those items that scrolls with the items?
This is what I got:
Copy code
LazyColumn(modifier = Modifier
    .fillMaxWidth()
    .wrapContentHeight()
    .clip(RoundedCornerShape(OneAppTheme.cornerRadius.listItemRadius.dp))
    .background(OneAppTheme.colors.listItemColor.toColor())
) {
    items(countries) {
        Text(it.name)
    }
}
But that is not a container around the items that will scroll with the items, it is styling on the LazyColumn itself.
m
Copy code
LazyColumn {
    items(countries) { country ->
        Box(modifier = Modifier.whatever()) {
            Text(country.name)
        }
    }
}
Is this what you had in the mind?
j
No. That will create a box around each item. I want a container around all items that scrolls with the items.
c
The only way to do what you're asking is to add a single item with a
Surface { Column { ... } }
. You can't add arbitrary background containers to a group of items.
j
To bad. Hope they will add that. Thanks!