Lilly
05/12/2022, 12:43 PMScaffold
.The Scaffold has a BottomNavigation
and a TopAppBar
. Navigating between the child screens means switching the content of the Scaffold. How can I have different TopBar actions on each screen? Do I have to drop the TopAppBar of the main screen and let the child screens have its own Scaffold with TopAppBar ? Another possibility I'm aware of would be to pass down the related TopBar composable and switch it on screen change like I do it with the screen content?mattinger
05/12/2022, 1:27 PM@Composable
fun SomeTab(
uiState: UIState,
onUpdateUIState: (UIState) -> Unit
) {
LaunchedEffect(key1=true) {
onUpdateUIState( uiState.copy(....) )
}
// content goes here
}
Or something of this natureDisposableEffect(key1=true) {
onUpdateUIState(
uiState.copy( /* Add actions, set title, etc.... */ )
)
onDispose {
onUpdateUIState(
uiState.copy( /* Remove actions */ )
)
}
Lilly
05/12/2022, 1:32 PM