-
public interface NavTransitionSpec<T extends Object>The specification of all animated transition between destinations. Used in AnimatedNavHost.
-
-
Method Summary
Modifier and Type Method Description abstract ContentTransformgetContentTransform(NavTransitionScope $self, NavAction action, T from, T to)Returns a ContentTransform that describes the desired transition between destinations to and from. ContentTransformtoEmptyBackstack(NavTransitionScope $self, NavAction action, T from)Returns a ContentTransform that describes the desired transition between a previous destination and an empty backstack state. ContentTransformfromEmptyBackstack(NavTransitionScope $self, NavAction action, T to)Returns a ContentTransform that describes the desired transition between an empty backstack state and a new destinationNote: you may need set some non-zero width/height composable as emptyBackstackPlaceholderin AnimatedNavHost in order for a transition to run correctly.-
-
Method Detail
-
getContentTransform
abstract ContentTransform getContentTransform(NavTransitionScope $self, NavAction action, T from, T to)
Returns a ContentTransform that describes the desired transition between destinations to and from.
This method is called in NavTransitionScope and provides convenient methods NavTransitionScope.slideOutOfContainer, NavTransitionScope.slideIntoContainer and NavTransitionScope.using. This is the same methods that you would be using in AnimatedContentTransitionScope from AnimatedContent composable. In fact, AnimatedNavHost uses
AnimatedContentunder the hood, so you may explore documentation ofAnimatedContentfor better understanding of the API.If you want to provide a specific transition to and from an empty backstack state, override methods toEmptyBackstack and fromEmptyBackstack of NavTransitionSpec.
- Parameters:
action- a hint about the last change done through a NavController.from- a target visible destinationto- a previous visible destination
-
toEmptyBackstack
ContentTransform toEmptyBackstack(NavTransitionScope $self, NavAction action, T from)
Returns a ContentTransform that describes the desired transition between a previous destination and an empty backstack state.
Note: you may need set some non-zero width/height composable as
emptyBackstackPlaceholderin AnimatedNavHost in order for a transition to run correctly.
-
fromEmptyBackstack
ContentTransform fromEmptyBackstack(NavTransitionScope $self, NavAction action, T to)
Returns a ContentTransform that describes the desired transition between an empty backstack state and a new destination
Note: you may need set some non-zero width/height composable as
emptyBackstackPlaceholderin AnimatedNavHost in order for a transition to run correctly.
-
-
-
-