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
SSCCE (taken from https://github.com/JetBrains/compose-jb/tree/master/tutorials/Desktop_Components#lazy-scrollable-components-with-scrollbar ; changed minimally to introduce variance in LazyColumn element's height):
import androidx.compose.foundation.VerticalScrollbar import androidx.compose.foundation.background import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Spacer 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.layout.padding 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.Alignment import androidx.compose.ui.Modifier 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, title = "Scrollbars", state = rememberWindowState(width = 250.dp, height = 400.dp) ) { LazyScrollable() } } @Composable fun LazyScrollable() { Box( modifier = Modifier.fillMaxSize() .background(color = Color(180, 180, 180)) .padding(10.dp) ) { val state = rememberLazyListState() LazyColumn(Modifier.fillMaxSize().padding(end = 12.dp), state) { items(50) { x -> TextBox("Item #$x", x) Spacer(modifier = Modifier.height(5.dp)) } } VerticalScrollbar( modifier = Modifier.align(Alignment.CenterEnd).fillMaxHeight(), adapter = rememberScrollbarAdapter( scrollState = state ) ) } } @Composable fun TextBox(text: String = "Item", height: Int) { Box( modifier = Modifier.height((30 + height.mod(2) * 50).dp) .fillMaxWidth() .background(color = Color(0, 0, 0, 20)) .padding(start = 10.dp), contentAlignment = Alignment.CenterStart ) { Text(text = text) } }
When I run this and try to scroll slowly down following happens:
Pay close attention to "shaky" content.
The text was updated successfully, but these errors were encountered:
Please check the following ticket on YouTrack for follow-ups to this issue. GitHub issues will be closed in the coming weeks.
Sorry, something went wrong.
m-sasha
Successfully merging a pull request may close this issue.
SSCCE (taken from https://github.com/JetBrains/compose-jb/tree/master/tutorials/Desktop_Components#lazy-scrollable-components-with-scrollbar ; changed minimally to introduce variance in LazyColumn element's height):
When I run this and try to scroll slowly down following happens:
Screencast.2022-09-21.23.53.54.webm
Pay close attention to "shaky" content.
The text was updated successfully, but these errors were encountered: