@Composable
fun DashboardScreen(
uiState: DashboardUiState,
handleEvent: (DashboardUiEvent) -> Unit,
modifier: Modifier = Modifier
) {
LaunchedActionEffect(uiState) { action: DashboardUiAction ->
when (action) {
DashboardUiAction.NavigateToNext -> {}
}
}
when (uiState.state) {
is DashboardUiState.ContentState.Loading -> DashboardLoadingContent()
is DashboardUiState.ContentState.Error -> DashboardErrorContent()
is DashboardUiState.ContentState.Content -> DashboardContent(uiState.state)
}
}
@Composable
fun DashboardLoadingContent(
modifier: Modifier = Modifier
) {
// Do something with loading
}
@Composable
fun DashboardErrorContent(
modifier: Modifier = Modifier
) {
// Do something with error
}
@Composable
fun DashboardContent(
content: DashboardUiState.ContentState.Content,
modifier: Modifier = Modifier
) {
// Do something with content
}
LaunchedActionEffect(uiState) { action: DashboardUiAction ->
when (action) {
DashboardUiAction.NavigateToNext -> {}
}
}