David Albers
06/17/2021, 6:10 PMLazyColumn
s within a scrolling `Column`/other container? 🧵David Albers
06/17/2021, 6:10 PM@Composable
fun NestedExample() {
Column(
Modifier
.fillMaxSize()
.verticalScroll(rememberScrollState())
) {
SearchResults(query = "A")
SearchResults(query = "B")
}
}
@Composable
fun SearchResults(query: String) {
val results = MutableList(100) { "$query $it" } // could come from an API in the future
LazyColumn {
items(results) {
Text(it)
}
}
}
David Albers
06/17/2021, 6:10 PMColumn
which scrolls and `Composable`s within it which may or may not have LazyColumn
David Albers
06/17/2021, 9:51 PMNestedScroll
, I’d have to measure each “sublist” and calculate their offset manually right?pepos
06/21/2021, 9:05 PMpepos
06/21/2021, 9:06 PMDavid Albers
06/22/2021, 5:15 PMresults =
logic up to the root Composable so they could be combined.
However, I’d like to keep that logic contained within SearchResults
so I could easily use it across other screens. I’m pretty sure if I go that route, a LazyColumn inside Column isn’t a great idea anyway though!