orangy
maxValue
on ScrollState
because it’s internal… I’m using verticalScroll
modifier on my component, but can’t figure out how to set its limits…orangy
Adam Powell
04/11/2021, 8:14 PMmatvei
04/12/2021, 10:32 AMModifier.verticalScroll
or Modifier.horizontalScroll
are autonomous in this regard as they will measure your @Composable you are applying them to and get the max height from it. Hence state.maxHeight
is a read only val. So the bounds are the natural 0 and height of a composable, assuming the composable is bigger then its viewport.
If you want something more custom and want to have more control over the scroll and how to interpret it, you could try using Modifier.scrollable
, which provides scroll handling but not layout, allowing you to write more custom thingsorangy
Layout
with verticalScroll
, and pretty trivial placing. I’ll send gist in DM.orangy
layout
was called with layout(constraints.maxWidth, constraints.maxHeight)
, which is essentially “infinite” vertically. I had to rewrite the component’s logic to first calculate item placements, then infer maxHeight from there, and then call layout with proper height.