-
Notifications
You must be signed in to change notification settings - Fork 4.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[JetSurvey] Use AnimatedContent to slide in and out changes between questions #842
Conversation
…e end result screen.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is great! Thank you! I had just one super minor comment
Jetsurvey/app/src/main/java/com/example/compose/jetsurvey/survey/SurveyFragment.kt
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
@@ -56,20 +64,34 @@ class SurveyFragment : Fragment() { | |||
) | |||
setContent { | |||
JetsurveyTheme { | |||
viewModel.uiState.observeAsState().value?.let { surveyState -> | |||
when (surveyState) { | |||
val state = viewModel.uiState.observeAsState().value ?: return@JetsurveyTheme |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why the ?: return@JetsurveyTheme
change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I needed a non-nullable state, and I generally prefer early returns instead of wrapping content in lets 😄 https://betterprogramming.pub/are-early-returns-any-good-eed4b4d03866
Added two usages of AnimatedContent into JetSurvey.
Animate the changes between different question screens, as well as the end result screen.