As solved here, I disable the tap flashing by setting the indication
to null
.
However, this is not working for Button or Icons?!
In the Button
you can't use the indication=null
in the clickable
modifier since it is defined internally by the component which uses indication = rememberRipple()
. This creates and remembers a Ripple
using values provided by RippleTheme
.
You can provide a custom LocalRippleTheme
to override the default behaviour.
Something like:
CompositionLocalProvider(LocalRippleTheme provides NoRippleTheme) {
Button(
onClick = { /*...*/ },
) {
//...
}
}
with:
private object NoRippleTheme : RippleTheme {
@Composable
override fun defaultColor() = Color.Unspecified
@Composable
override fun rippleAlpha(): RippleAlpha = RippleAlpha(0.0f,0.0f,0.0f,0.0f)
}