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

Klaas Kabini

02/18/2020, 5:54 AM
I am trying to implement a deck of cards whereby I want to rotate the topmost card in the deck at 20 degrees. I have added a Draw composable to the current Stack composable code to do the rotation but the issue is that the Draw composable rotate all the children not only the topmost. How do you tell the Draw composable which child to rotate in layout?
s

shikasd

02/18/2020, 1:58 PM
You can wrap only your topmost child in Draw 🙂
i

Ian Warwick

02/18/2020, 3:33 PM
also you could try use a draw modifier to rotate the topmost
l

Leland Richardson [G]

02/18/2020, 3:56 PM
yeah i think making a rotate draw modifier and just passing it in to the topmost child would be the “right” way to do this
Draw
with children might go away in the future, and we are likely to add a
rotate
draw modifier ourselves, so it is also less likely to break by API changes at this point
👍 2
3 Views