https://kotlinlang.org logo
#compose
Title
# compose
r

Radoslaw Juszczyk

03/09/2021, 7:35 PM
hello everyone, I am just starting composing… is there a way to put a ripple effect on a
Surface
? I have tried:
Surface(modifier=Modifier.clickable(indication=….))
but
indication
is not resolved what is the correct way to do that?
l

Luke

03/09/2021, 8:11 PM
If you give
indication
to
.clickable
, you also got to give
interactionSource
👍 1
But doesn't
.clickable
adds ripple by default?
r

Radoslaw Juszczyk

03/09/2021, 8:28 PM
this is the exact code which worked:
Copy code
.clickable(
    onClick = {},
    indication = rememberRipple(),
    interactionSource = remember { MutableInteractionSource() },
)
nah, by default it was just solid highlight
this is just a piece of code which i wouldnt believe it worked, this compose is really taking me out of my comfort zone ;d
l

Luke

03/09/2021, 8:31 PM
I hear you. It's definitely far from what we are used to, but I still prefer Compose UI over XML. The learning curve is steep but worth climbing.
🙂 2
l

Louis Pullen-Freilich [G]

03/09/2021, 9:59 PM
nah, by default it was just solid highlight
If you have a
MaterialTheme
in your application it will configure this for you, so it is a ripple by default
r

Radoslaw Juszczyk

03/10/2021, 6:11 AM
@Louis Pullen-Freilich [G] that’s correct, now I have it with the theme, thanks!