Created
June 25, 2022 20:17
-
-
Save alibahaaa/77d93fe51638ccb04a00c605c2b22818 to your computer and use it in GitHub Desktop.
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
@Composable | |
fun HomeScreen( | |
navController: NavController, | |
viewModel: MainViewModel = viewModel() | |
) { | |
val uiState = viewModel | |
.uiState | |
.collectAsState() | |
.value | |
when (uiState) { | |
State.Error -> ErrorBody() | |
State.Idle -> viewModel.sendIntent(Intent.FetchOrigamiData) | |
State.Loading -> LoadingBody() | |
is State.Origami -> HomeScreenBody( | |
navController = navController, | |
data = uiState.origami | |
) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment