-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Fix background parallax #1230
Fix background parallax #1230
Conversation
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.
Nice! Thanks for doing this
@@ -45,20 +47,37 @@ fun Modifier.offsetGradientBackground( | |||
colors: List<Color>, | |||
width: Float, | |||
offset: Float = 0f | |||
) = background( | |||
) = this then background( |
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 think the this then
here is double adding the modifier because you have implicitly captured this
already by not doing Modifier.background
but just background
which is actually this.background
We probably need another lint check for this as well!
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'm actually not sure when you're supposed to use which. Happy to write the lint check!
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.
You basically just have to use this
somewhere in your implementation. By just writing background
you've done it
This used to be a feature, but then when replacing with LazyRow, it was dropped.
Let's fix it + use the deferred modifier to properly read scroll state.