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

Colton Idle

05/15/2022, 8:36 AM
Is this sort of effect (first time load, slide from bottom) available in compose Column or LazyColumn (column would be preferred for my particular situation, but open to suggestions).
a

Albert Chang

05/15/2022, 8:51 AM
I think
AnimatedVisibility
should work. Just specify a delay according to the index.
2
c

Colton Idle

05/15/2022, 9:03 AM
Didn't know that you could delay an animatedVisibility but I will give it a whirl! also... i thought you needed a visibile boolean... but since i just want this on first launch, maybe I can just always pass in true?
a

Albert Chang

05/15/2022, 9:18 AM
AnimatedVisibility
only animates visibility changes so passing true won’t work. However you can use the overload that takes a `MutableTransitionState`:
Copy code
AnimatedVisibility(
    visibleState = remember {
        MutableTransitionState(initialState = false).apply { targetState = true }
    }
)
👍 1
c

Chris Sinco [G]

05/15/2022, 3:31 PM
I do exactly this in the Shrine sample:

https://youtu.be/pAhQPVdCpVs

K 3
c

Colton Idle

05/15/2022, 6:24 PM
ive definitely seen that video too but my brain is overloaded with all the recent IO videos lol
thank you Chris!
c

Colton Idle

05/16/2022, 8:20 AM
unfortunately, i couldn't get this to look quite right. quitting on it for now, but will have to come back to it!
c

Chris Sinco [G]

05/17/2022, 5:49 PM
Let me know if you need help! Basically what you do is set the exit/enter params to None on the AnimatedVisibility itself, then loop through a Composable within it in a Column/Row with the modifier
animateEnterExit
which allows you to specify the animation per item
c

Colton Idle

05/18/2022, 7:28 AM
Alright. Somehow that sounds easy. I'll try again once I'm back home next week. 🤞
4 Views