-
Notifications
You must be signed in to change notification settings - Fork 675
Add elevation to Link app bar #11042
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Diffuse output:
APK
|
8f97f76
to
d2623b2
Compare
d2623b2
to
686c388
Compare
686c388
to
98b6674
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looking great! a couple nits.
Column( | ||
modifier = Modifier.padding(bottom = 20.dp), | ||
) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is so that the elevation shadow is a bit more separated from the Link logo / toolbar content right?
|
||
import androidx.compose.runtime.compositionLocalOf | ||
|
||
internal val LocalLinkContentScrollHandler = compositionLocalOf<((Boolean) -> Unit)?> { null } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The typing (nullable boolean lambda) confused me a little bit at the beginning - can we add a comment / create a type alias for the lambda?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure why these changed colors 🤔
fun onContentScrolled(canScrollUp: Boolean) { | ||
_linkAppBarState.update { | ||
it.copy(isElevated = canScrollUp) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was concerned this would be called on every scroll event and allocate a ton of objects, but I see that it's actually only invoked at the call site when canScrollUp
is changed. Can we rename this to onContentCanScrollBackwardChanged()
("backward" instead of "up" to align with the library terminology)?
Summary
This pull request adds an elevation of the Link app bar based on the scroll state of the content.
Motivation
Testing
Screen recording
Screen_recording_20250630_211528.mp4
Changelog