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

Tash

04/26/2022, 9:30 PM
Trying to update to
1.2.0-alpha08
and one of the
Card
composables that was being used earlier with
onClick
and
indication
as params is deprecated with this error:
This API is deprecated with the introduction a newer Card function overload that accepts an onClick()
But, the newer
Card
function that accepts
onClick
doesn’t offer a way to customize
indication
🤔 is there any other way to customize this?
l

Louis Pullen-Freilich [G]

04/26/2022, 9:35 PM
No, not without building your own
Card
- Material components are opinionated and show ripples, it’s not something that should be able to be customized on a component like this. For example, there is no way to change the indication for a
Button
-
Card
is the same here now. If you want something custom, similar to if you wanted a custom
Button
with different indication, you can fork it and make the necessary changes
t

Tash

04/26/2022, 9:51 PM
I see, thank you! As a stopgap, would it also work to attach a
Modifier.clickable
to the
Card
overload that does not have
onClick
as parameter? (Reason being, we want to move forward with the upgrade but we are blocked from creating a custom component at the moment)
l

Louis Pullen-Freilich [G]

04/26/2022, 10:06 PM
Not really, I mean it will kinda work, but the ripple and the input events won’t be clipped to the card, so if the card is not perfectly rectangular then it will go outside the boundaries of the card
👍🏼 1
🙏 1
t

Tash

04/27/2022, 12:53 AM
Makes sense, thank you!
c

Colton Idle

04/27/2022, 12:57 AM
FWIW creating a "card" in compose is dead simple at least. Just a box with a few modifiers. my team was doing this first before we realized there was a card component. lol
👍 1
👍🏼 1
t

Tash

04/29/2022, 5:14 PM
I ended up creating a custom card, and yeah exactly it was so simple 🙈
1
2 Views