Skip to content
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

Gradient fallback tints #398

Closed
Skaldebane opened this issue Nov 10, 2024 · 3 comments · Fixed by #400
Closed

Gradient fallback tints #398

Skaldebane opened this issue Nov 10, 2024 · 3 comments · Fixed by #400

Comments

@Skaldebane
Copy link

Skaldebane commented Nov 10, 2024

This is a follow-up to #397, and will hopefully be solved by it, but here it is as a separate issue anyways.

My use case is this: I use a progressive blur at the top of a scrollable container, and I'd like to use a gradient where the blur isn't supported (older/lower-end Android devices).

For now, fallbackTint takes HazeTint, which doesn't support taking a gradient, so I'm forced to set it to Color.Transparent for now.

This could theoretically be done by adding my own background modifier above or below hazeChild, but that's not ideal:

  1. If it's above below hazeChild, then it's gonna be always drawn on top of the blur. Not great.
  2. If it's below above hazeChild, it's gonna interfere with the color of the blur, particularly when using a mask instead of progressive. (didn't try though, I could be wrong!) I tried this and yes, with mask it has an effect.

That itself could be fixed by checking if Haze is supported, but Haze doesn't expose any way to know whether or not blur is supported on the current device. I filed an issue for that at #399.

I might be missing something very obvious, so take this with a grain of salt 😅
And thanks for the awesome library!

@chrisbanes
Copy link
Owner

I think this is more of a bug in the backwards compatibility for progressive. Haze does draw a gradient for mask, but we don't currently for progressive.

@chrisbanes
Copy link
Owner

You might also be interested in #384

@Skaldebane
Copy link
Author

Skaldebane commented Nov 10, 2024

Ah yes, I just realized that! The mask applies to the fallback tint as well, which is great.

As for progressive, applying a background after it works fine, because Haze takes over rendering completely when blur is available (thus the background has no effect), and a transparent fallback tint makes it show up on unsupported devices.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants