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

dewildte

03/09/2021, 1:04 AM
Does anyone know how to get a BottomAppBar to hide upon scroll of a LazyColumn?
l

Lucien Guimaraes

03/09/2021, 1:16 AM
Just use LazyListState for your LazyColumn and with isScrollInProgress you know if the list is being scrolled
b

Bradleycorn

03/09/2021, 1:17 AM
But which direction is it being scrolled?
Do I have to calculate that myself?
l

Lucien Guimaraes

03/09/2021, 1:20 AM
isScrollInProgress
is just a boolean to know if you are scrolling the list. I you need to know the direction, it might be done with InteractionSource (never used this API but it could be worth checking)
you can also check for firstVisibleItemScrollOffset
t

Timo Drick

03/09/2021, 1:36 AM
You could also use nestedScroll modifier. Than you could calculate the direction. But of course a little bit more complicated. I think this sample code does exactly what you want: https://developer.android.com/reference/kotlin/androidx/compose/ui/input/nestedscroll/package-summary#(androidx.compose.ui.[…]estedScrollDispatcher)
d

dewildte

03/09/2021, 2:03 AM
Oooh
This looks promising!
Thanks folks!
a

allan.conda

04/22/2021, 4:13 PM
@dewildte 👋 were you able to get it to work?
d

dewildte

04/22/2021, 4:16 PM
@allan.conda I have not had time to focus on implementing that feature yet, sorry.
a

allan.conda

04/22/2021, 4:17 PM
I see, no worries! 🙏
3 Views