Martin Gaens
02/11/2024, 8:47 PMScaffold
for the entire app? I am trying to implement that just because of the awesome animations I am able to do with the FAB as well as the top and bottom bar, however, separation of concerns is a huge issue when having a single Scaffold
.zt
02/12/2024, 4:51 AMvar currentScreen by remember { mutableStateOf(Screen.Home) }
Scaffold(
topBar = {
TopBar(
title = { Text(currentScreen.title) }
)
}
) {
when (currentScreen) {
...
}
}
Martin Gaens
02/12/2024, 7:44 AMnavController.navigateUp()
. However, what if you have a button which saves the data from the current screen (for example NewPlayerScreen) to the database? Suddenly, you need to have access to the NewPlayerScreenViewModel because that ViewModel has got the state of that screen and only that ViewModel can save the data from that screen to the database, because it's got the PlayerRepository injected into itself.Martin Gaens
02/12/2024, 7:44 AM