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

Elena Boiko

06/04/2020, 7:44 AM
Hello 🙂 I came across an interesting case. I added two modifiers to a Row: clickable and ripple. If I add them in this order (Modifier.clickable(...).ripple()), ripple works, but onClick is not invoked. If I change the order (Modifier.ripple().clickable(...)), both modifiers work. So my question is: is there some order by which we should add modifiers?
m

matvei

06/04/2020, 11:02 AM
Hey! Thanks for the question.
Modifier.ripple
will be deprecated in the following releases,
Modifier.clickable
now bundles indication inside of it.
clickable
has a parameter
indication
which allows you to customize any indication that will happen when click occurs, so you can do
Modifier.clickable(indication = RippleIndicaiton(color= Color.Red))
or smth like that. If you have
MaterialTheme
in your app, we will automatically insert material-speced and properly colored ripple for you so you can just leave the default param there if you don't want to customize anything and were using ripple() without any param before. The reason for this bundling is exactly the problem you're facing; We're placing it in the right order in implementation so you don't have to 🙂
👍🏻 3
e

Elena Boiko

06/04/2020, 12:13 PM
Thanks a lot for this explanation 🙂 I'll try to use indication.
2 Views