We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The ScrollBarAdapter for LazyListState doesn't take into account the LazyLists contentPadding.
ScrollBarAdapter
LazyListState
LazyList
contentPadding
Reproducer:
import androidx.compose.foundation.VerticalScrollbar import androidx.compose.foundation.background import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.PaddingValues import androidx.compose.foundation.layout.fillMaxHeight import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.height import androidx.compose.foundation.lazy.LazyColumn import androidx.compose.foundation.lazy.rememberLazyListState import androidx.compose.foundation.rememberScrollbarAdapter import androidx.compose.material.Text import androidx.compose.runtime.Composable import androidx.compose.ui.graphics.Color import androidx.compose.ui.unit.dp import androidx.compose.ui.window.Window import androidx.compose.ui.window.application import androidx.compose.ui.window.rememberWindowState fun main() = application { Window( onCloseRequest = ::exitApplication, state = rememberWindowState(width = 300.dp, height = 400.dp) ) { LazyScrollable() } } @Composable fun LazyScrollable() { Box( modifier = Modifier .fillMaxSize() .background(color = Color.White) ) { val state = rememberLazyListState() LazyColumn( modifier = Modifier.fillMaxSize(), state = state, contentPadding = PaddingValues(vertical = 100.dp) ) { items(5) { x -> TextBox("Item #$x", x) } } VerticalScrollbar( modifier = Modifier.align(Alignment.CenterEnd).fillMaxHeight(), adapter = rememberScrollbarAdapter( scrollState = state, ) ) } } @Composable fun TextBox(text: String = "Item", index: Int) { Box( modifier = Modifier .height(130.dp) .fillMaxWidth() .background( color = Color( red = (index * 50).mod(255), green = (index * 100).mod(255), blue = (index * 150).mod(255), alpha = 128 ) ), contentAlignment = Alignment.CenterStart ) { Text(text = text) } }
As you can see, dragging the scrollbar to the bottom doesn't cause the content to scroll to the bottom.
The text was updated successfully, but these errors were encountered:
This is part of the problems described by #1211
Sorry, something went wrong.
Please check the following ticket on YouTrack for follow-ups to this issue. GitHub issues will be closed in the coming weeks.
m-sasha
Successfully merging a pull request may close this issue.
The
ScrollBarAdapter
forLazyListState
doesn't take into account theLazyList
scontentPadding
.Reproducer:
Screen.Recording.2023-01-07.at.12.05.56.mp4
As you can see, dragging the scrollbar to the bottom doesn't cause the content to scroll to the bottom.
The text was updated successfully, but these errors were encountered: