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

Garret Yoder

03/05/2024, 7:40 PM
Has anyone come across a good implementation/method to do a collapsing large toolbar that doesn't fully expand until you reach the top of the list? I have both the stock LargeTopAppBar working fine, along with a custom one I made using the nested scroll offsets, but the stock widget fully expands the moment you scroll up - and I don't think nested scroll conveys your offset from the top of the content for me to do it that way. I'm looking to have the app bar expand to a normal size on scroll up, and only grow to full size when you reach the top of the list. Sorta like the old material collapsing toolbars - and I'm trying to keep it content agnostic and avoid relying on there being a lazycolumn state to watch. Is there a way to get the absolute scroll position or offset from top from the nested connection? I think the root of the issue is that the stock M3 implementation is missing enterAlwaysCollapsed like the older toolbars had
If anyone comes across this via a search with the same problem, I found a great article here that goes over it pretty well. https://medium.com/kotlin-and-kotlin-for-android/collapsing-toolbar-in-jetpack-compose-problem-solutions-and-alternatives-34c9c5986ea0