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

chris-horner

01/28/2021, 4:16 AM
Is there a neat way to animate the
weight
of an item in a
Column
down to 0? Seems a little tricky as weights must have a value greater than 0. Am I missing something?
d

Doris Liu

01/28/2021, 4:26 AM
Are you trying to remove the item by changing its
weight
to 0?
c

chris-horner

01/28/2021, 4:43 AM
Yep
d

Doris Liu

01/28/2021, 4:47 AM
Can you replace the
weight(..)
modifier with:
animateContentSize().then(if(..) weight(...) else height(0.dp))
(Haven't tested this, but I suspect it might work). 😁
🙏🏼 1
c

chris-horner

01/28/2021, 4:50 AM
Nailed it! Works perfectly for my use case, thanks @Doris Liu 🙏
👍 2
d

Doris Liu

01/28/2021, 4:52 AM
🤣 Nice!
28 Views