Is there an easy way to expand the scrollable area...
# compose
w
Is there an easy way to expand the scrollable area of a column without expanding its content? Imagine a wide viewport with a width constrained centered list of items. I want the user to be able to scroll up and down even if they touch the side margins and not the center content.
I've gone with
Copy code
val horizontal = (screenWidthDp - targetItemWidth) / 2
LazyColumn(contentPadding = PaddingValues(horizontal = horizontal)) {
    //...
}
But this feels wrong, and it also seems slow to respond to resizing a desktop window. It does snap to the right width eventually, but it looks odd.
j
I think if you add
Modifier.padding(...)
with the horizontal margin you want before the scroll
Modifier.verticalScroll(...)
will achieve what you want.