What would be the proper way to animate a bottomna...
# compose
t
What would be the proper way to animate a bottomnavigationbar in a scaffold when expanding a bottomsheet? Applying an offset is not enough as it leaves the padding to the content and also changing the height via a modifier triggers too many recomposition and seems to break the swiping 😞
f
You want to animate the bottom sheet above the bottom bar?
t
I have a bottomsheet above the bottom bar and when I expand the bottomsheet I want to bottom bar to move out of the screen. This works well with offseting it. But if I also change height then there's recomposition and the swipe breaks and restart.
c
You don't happen to have a video do you? I think I had a similar problem to this, but basically, I just don't hide my bottom bar anymore if the bottom sheet is showing, So the bottom sheet just covers it entirely as it moves up. I initially had an animation, but it just felt wrong to animate the bottom bar for something as emphemeral as a bottom sheet.
t
This is not an ephemeral one but.a player one that is visible collapsed above the nav bar. When expanding it keeping the nav bar loose precious screen space.
👍 1
f
The
Scaffold
gives you
paddingValues
. Only apply them to the content, not to the bottom sheet. But make the bottom sheet high enough so that its handle (?) is visible above the bottom bar. The
BottomAppBar
can be animated using
AnimatedVisibility
.
t
The bottomsheet is a bottomsheetscaffold too as I need the content to move when the handle is visible but not when not visible (nothing playing). But I suppose I can handle that padding change manually. Do you know if I can do modifier.padding(innerpadding).padding(bottom=x.dp) and it will properly apply both?
f
Should work
👍 1
t
Back to home and tested, works perfectly with manual padding handling. Thanks a lot. Force me to wrap the content when the scaffold already wrap it in column but I can copy the scaffold code and make my own version.
c
Can you show the end result? Really curious what you're doing. Lol
t
Emulator recording bugs but should give you an idea 🙂 I'm just playing with things right now.
c
Ah. I completely misunderstood your question. Sorry! Looks great though!