I'm trying to override the `AmbientIndication` but...
# compose
e
I'm trying to override the
AmbientIndication
but it's not obvious to me what I need to do or r as there call. Do to set it up using
Providers(...)
? I'm trying to change from ripple to something else.
k
What is it that you're trying to achieve? Before talking about the specific solution, what is the problem?
e
I want to remove the ripple effect
That or replace it with something
k
For playing around, for one screen, for the entire app, for a completely custom design system?
a
you can see
MaterialTheme.kt
as a reference https://cs.android.com/androidx/platform/frameworks/support/+/androidx-main:compose/[…]tlin&ss=androidx%2Fplatform%2Fframeworks%2Fsupport:compose%2F (but also sounds weird that you would be removing the ripple effect too tbh)
l
Note that in the next release this will only be used as the default for custom components using clickable / similar gesture modifiers - this won't override the ripple used in Material components such as Button.
e
@Kirill Grouchnikov ideally for the app i.e. custom design system. It's very similar to material design but designers don't like the ripples haha
@Alexjlockwood I've looked in there but it's not obvious how I would change it since the induction is set inline in a val. I want to override it because I want to implement a custom design system that almost is material design.
@Louis Pullen-Freilich [G] does that mean it won't be configurable at all?
l
It is configurable, but it won't change the behavior of default components - if you want to build your own components with their own alternative to a ripple, you would need to create them yourself - this isn't a currently supported area of customization.
If your design system just wants to change colors / opacity, you can use
RippleTheme
to customize the ripples used by components, but this doesn't support replacing / changing what a ripple is.
e
@Louis Pullen-Freilich [G] that answers my question what is the easiest way to override the ripple theme? Do i set another provider in my MaterialTheme scope? I tried calling rememberRipple to no avail.
l
Yep you can do something like:
Copy code
MaterialTheme(...) {
    Providers(AmbientRippleTheme provides MyCustomRippleTheme) {
        // rest of app
    }
}
Then anything inside this will use this ripple theme
e
Awesome, let me try that :)