Nested Scroll Jetpack Compose

Viewed 3776

I have multiple LazyColumn. I need a page including common scroll over all lists. I tried add .nestedScroll(object: NestedScrollConnection) to Column, but it doesn't work.

Column(
        modifier = Modifier
            .fillMaxSize()
            .nestedScroll(nestedScrollConnection)
    ) {
        Toolbar(toolbarOffsetHeightPx)
        LazyColumn(modifier = Modifier.nestedScroll(nestedScrollConnection)) {
            items(parameters) { CarParameter(it) }
        }
        LazyColumn(modifier = Modifier.nestedScroll(nestedScrollConnection)) {
            items(carInfoList) { CarInfo(it) }
        }
    }
1 Answers

Just use items() multiple times in one LazyColumn

LazyColumn {
  item { Toolbar() }
  items(...) { ... }
  items(...) { ... }
}
Related