james
02/06/2022, 1:24 AMnavController.navigate()
?
my use case is that I have a dynamic screen which can be accessed by either tapping through the UI, and it can be nested many levels deep, and my animation for sliding in and out works great there, but this dynamic screen can also be accessed via the hamburger menu, and when it's accessed from there, I want to clear the backstack (which is the easy part) but I also want the transition to be different, because sliding in feels and looks totally wrong there
is this possible? or will I need to create entirely different routes and composable(transition = )
declarations and just use different routes to display the same screen but with alternate transition animations?Ian Lake
02/06/2022, 1:51 AManimateFromDrawer
boolean you set only when navigating from your drawer) if the information of where you are going to and whether it is a pop isn't enough informationAnimatedContentScope
and whether it is a pop or not isn't enough information though? I guess if you are on the screen deep in your hierarchy right before this also accessible via the drawer screen and instead of clicking on the button to go to that screen, the user clicks on the drawer icon?NavBackStackEntry
as the initialState
/ targetState
, you could just check for the existence of that argument in your transition lambdas to know which to runjames
02/06/2022, 2:30 AManimalDetails/{animal}
you could be 3 levels deep in the UX flow and click something which would take you to animalDetails/cat
.. and that animation should slide in and out and your backstack remains intact
however, you could also decide to open the nav drawer and click the "Cat" menu item there which would navigate you to the same animalDetails/cat
route, but this time we want to clear the back stack and maybe do a quick crossfade transition, not a sliding oneinitialState
and targetState
from inside the transition lambda, so I can simply check a parameter added to the route