Graph
A declarable navigation graph, the structural counterpart to Screen and Modal.
Implement this on an object when a graph is a surface in its own right rather than just a grouping: something presented as a sheet, arriving and leaving as one piece with its own transitions and its own dismissal. Structural graphs need none of this and can keep using the graph("id") { } form, which declares no presentation and behaves exactly as before.
object WizardGraph : Graph {
override val route = "wizard"
override val enterTransition = NavTransition.SlideUpBottom
override val popExitTransition = NavTransition.SlideOutBottom
}
graph(WizardGraph) {
start(WizardDetailsScreen)
screens(WizardDetailsScreen, WizardPaymentScreen)
layout { content -> WizardLayout(content) }
}Transitions are nullable on purpose. Null means the graph has no opinion and the entering screen's own transition is used, which is why every existing graph keeps its current behaviour. NavTransition.None is a different statement, meaning the graph arrives with no animation.
A navigation uses the transition of the outermost boundary it crosses, so entering this graph animates the graph while moving between screens already inside it animates the screen. That is what lets the steps of a wizard slide sideways inside a sheet that arrived from the bottom.
See also
Properties
Transition when a navigation enters this graph from outside it.
Transition when a navigation leaves this graph.
Invoked instead of popping when the graph is dismissed, letting the surface decide what leaving means. Takes precedence over the current screen's own handler.
True when this node describes a surface of its own rather than deferring to what it contains.
Whether to offer the grab affordance for the drag.
Whether destinations inside this graph want a navigation header.
Whether the whole graph can be dragged away as one surface.