zt
10/02/2022, 10:07 PMSurface {
Taxi(
modifier = Modifier.fillMaxSize(),
navigator = navigator,
transitionSpec = { fadeIn() with fadeOut() }
) { destination ->
when (destination) {
is AppDestination.Root -> RootScreen(navigator)
is AppDestination.Search -> SearchScreen(navigator = navigator)
is AppDestination.Player -> PlayerScreen(
navigator = navigator,
videoId = destination.videoId
)
is AppDestination.Channel -> ChannelScreen(
navigator = navigator,
channelId = destination.channelId
)
is AppDestination.Settings -> SettingsScreen(onClickBack = navigator::pop)
}
}
}
Settings, Search, Player, Channel should all be scoped to the one screen.
I'm using koin for injecting my viewmodels like this
fun SearchScreen(
viewModel: SearchViewModel = getViewModel(),
navigator: BackstackNavigator<AppDestination>
) {
Ian Lake
10/02/2022, 10:26 PMrememberSaveable
): https://github.com/X1nto/Taxi/blob/6c5a814bd27bb0e2380052eb882cb0f564f4364b/lib/src/main/java/com/xinto/taxi/Taxi.kt#L41zt
10/02/2022, 10:28 PMIan Lake
10/02/2022, 10:32 PMViewModelStore
associated with that screen (which would be what would clear out every ViewModel you scoped to that ViewModelStore
). But you can't even destroy the ViewModel right there - you need to wait for your screen to actually finishing animating out (as it will continue to recompose as it exits its AnimatedContent
with whatever transitionSpec you've defined)Ian Lake
10/02/2022, 10:36 PMsaveableStateHolder.removeState
when you pop a screen off the back stack, so I'm pretty sure any screen you ever push onto that stack is going to be saved forever, even if you popped it off the stackIan Lake
10/02/2022, 10:38 PMAppDestination
as an object
like their example does), that instead of getting a fresh copy of your screen, you end up getting the previous, popped screen's state back...zt
10/02/2022, 10:38 PMIan Lake
10/02/2022, 10:38 PMIan Lake
10/02/2022, 10:39 PMzt
10/02/2022, 10:39 PMIan Lake
10/02/2022, 10:50 PMdewildte
10/03/2022, 12:46 AMdewildte
10/03/2022, 12:46 AMzt
10/03/2022, 12:47 AMdewildte
10/03/2022, 12:47 AMdewildte
10/03/2022, 12:48 AMzt
10/03/2022, 12:48 AMdewildte
10/03/2022, 12:48 AMdewildte
10/03/2022, 12:49 AMIan Lake
10/03/2022, 12:50 AMdewildte
10/03/2022, 12:54 AMdewildte
10/03/2022, 12:55 AMdewildte
10/03/2022, 12:56 AMzt
10/05/2022, 1:49 AMIan Lake
10/05/2022, 2:28 AMzt
10/05/2022, 2:30 AMIan Lake
10/05/2022, 2:32 AMzt
10/11/2022, 2:05 AMIan Lake
10/11/2022, 2:57 AMzt
10/11/2022, 3:17 AMIan Lake
10/11/2022, 3:19 AM