Last active
May 15, 2024 18:54
-
-
Save MkhytarMkhoian/d91cb2dc3c66a00116b972d0ffbc2911 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 FareListScreen( | |
uiState: FareListState, | |
scaffoldState: ScaffoldState = rememberScaffoldState(), | |
onFareClick: (FareModel) -> Unit, | |
) { | |
Scaffold( | |
modifier = Modifier.statusBarsPadding(), | |
scaffoldState = scaffoldState, | |
topBar = { | |
TopAppBar( | |
title = { | |
Text(text = stringResource(id = R.string.select_fare_title)) | |
}, | |
backgroundColor = AppTheme.colors.material.surface, | |
) | |
}, | |
content = { | |
ScreenContent( | |
status = uiState.status, | |
forceLoading = uiState.status.isLoading, | |
) { | |
FareList( | |
fares = uiState.fares, | |
onClick = onFareClick | |
) | |
} | |
} | |
) | |
} | |
@Preview(name = "Fares Content", showBackground = true) | |
@Composable | |
fun PreviewFareListScreenSuccess() { | |
AppTheme { | |
FareListScreen( | |
uiState = FareListState( | |
status = ScreenContentStatus.Success, | |
fares = fakeFareModels, | |
), | |
onFareClick = {} | |
) | |
} | |
} | |
@Preview(name = "Fares Content", showBackground = true) | |
@Composable | |
fun PreviewFareListScreenLoading() { | |
AppTheme { | |
FareListScreen( | |
uiState = FareListState( | |
status = ScreenContentStatus.Loading, | |
fares = fakeFareModels, | |
), | |
onFareClick = {} | |
) | |
} | |
} | |
@Preview(name = "Fares Content", showBackground = true) | |
@Composable | |
fun PreviewFareListScreenFailure() { | |
AppTheme { | |
FareListScreen( | |
uiState = FareListState( | |
status = ScreenContentStatus.Failure, | |
fares = fakeFareModels, | |
), | |
onFareClick = {} | |
) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment