Use nested scroll modifier

This commit is contained in:
Isira Seneviratne 2024-08-10 06:14:36 +05:30
parent f9dae9078e
commit e082bca5e0
1 changed files with 6 additions and 3 deletions

View File

@ -17,6 +17,8 @@ import androidx.compose.runtime.getValue
import androidx.compose.runtime.remember
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.input.nestedscroll.nestedScroll
import androidx.compose.ui.platform.rememberNestedScrollInteropConnection
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.tooling.preview.PreviewParameter
@ -45,10 +47,11 @@ fun CommentSection(
Surface(color = MaterialTheme.colorScheme.background) {
val comments = commentsFlow.collectAsLazyPagingItems()
val itemCount by remember { derivedStateOf { comments.itemCount } }
val listState = rememberLazyListState()
val nestedScrollInterop = rememberNestedScrollInteropConnection()
val state = rememberLazyListState()
LazyColumnScrollbar(state = listState) {
LazyColumn(state = listState) {
LazyColumnScrollbar(state = state) {
LazyColumn(modifier = Modifier.nestedScroll(nestedScrollInterop), state = state) {
if (parentComment != null) {
item {
CommentRepliesHeader(comment = parentComment)