-
-
Save riggaroo/a20bf326c323ce8888c2be0e0bcee612 to your computer and use it in GitHub Desktop.
[AnimatedContent] JetSurvey initial wrap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Copyright 2022 Google LLC. | |
SPDX-License-Identifier: Apache-2.0 */ | |
val state = viewModel.uiState.observeAsState().value ?: return@JetsurveyTheme | |
AnimatedContent(targetState = state) { targetState -> | |
// It's important to use targetState and not state, as its critical to ensure | |
// a successful lookup of all the incoming and outgoing content during | |
// content transform. | |
when (targetState) { | |
is SurveyState.Questions -> SurveyQuestionsScreen( | |
questions = targetState, /* other parameters */) | |
is SurveyState.Result -> SurveyResultScreen( | |
result = targetState, /* other parameters */) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment