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

AmrJyniat

08/24/2022, 10:07 AM
I have two composables need to apply transition(slide In/Out) between them, I show/hide them as following:
Copy code
when (loginUiState) {
     is LoginEmailUiState ->
        LoginEmailPassContainer(loginUiState)
     is ResetPasswordUiState ->
        ResetPasswordContainer(loginUiState)
}
How I can achieve that?
o

Oleksandr Balan

08/24/2022, 10:12 AM
AnimatedContent
This is the way mandalorian https://developer.android.com/jetpack/compose/animation#animatedcontent You could start with default:
Copy code
AnimatedContent(targetState = loginUiState) { state ->
   when (state) {
     is LoginEmailUiState ->
        LoginEmailPassContainer(state)
     is ResetPasswordUiState ->
        ResetPasswordContainer(state)
   }
}
And then tweak
transitionSpec
as needed, see docs above ☝️
y

Yashwant Gowla

08/24/2022, 10:13 AM
3 Views