https://kotlinlang.org logo
#compose
Title
# compose
t

Tgo1014

07/30/2021, 10:34 AM
How can I know if a
ScrollableState
is scrollable aka all the content is already being shown?
m

matvei

07/30/2021, 11:40 AM
ScrollableState
itself has nothing to do with layout, so this information is not really there and is not accessible. Other states and use ScrollableState, eg.
LazyListState
and
ScrollState
contain this information in different shapes, e.g
ScrollState::maxValue
or
LazyListState:layoutInfo
t

Tgo1014

07/30/2021, 11:54 AM
Sorry, I was actually talking about
ScrollState
, my bad. I’m using
maxValue
to auto scroll but I want to hide the button if all content is already fitting the screen, I couldn’t figure how can I do this using
ScrollState
m

matvei

08/02/2021, 11:57 AM
If content fits the screen,
maxValue
would be 0, as there's no place for scrolling
t

Tgo1014

08/02/2021, 12:38 PM
That works! Thanks Matvei!
👍 1
5 Views