NavigatorState
Namespace: Hex1b.Widgets
Assembly: Hex1b.dll
State object for Navigator that manages the navigation stack. Use this to push new screens, pop back, or reset to root.
[Experimental("HEX1B001")]
public class NavigatorStateInheritance
Object → NavigatorState
Constructors
NavigatorState(NavigatorRoute)
Creates a new NavigatorState with the specified root route.
Parameters:
rootRoute(NavigatorRoute): The initial/home route that can be returned to via PopToRoot.
public NavigatorState(NavigatorRoute rootRoute)Properties
CanGoBack
Returns true if there are routes to pop (more than just the root).
Returns: Boolean
public bool CanGoBack { get; }CurrentRoute
Gets the current route at the top of the navigation stack.
Returns: NavigatorRoute
public NavigatorRoute CurrentRoute { get; }Depth
Gets the number of routes in the navigation stack.
Returns: Int32
public int Depth { get; }Methods
Pop()
Pops the current route and returns to the previous screen. Does nothing if already at the root.
Returns: Boolean
True if a route was popped, false if already at root.
public bool Pop()PopToRoot()
Pops all routes and returns to the root route. Useful for completing a wizard flow.
public void PopToRoot()Push(NavigatorRoute)
Pushes a new route onto the navigation stack (drill down).
Parameters:
route(NavigatorRoute): The route to navigate to.
public void Push(NavigatorRoute route)Push(string, Func<NavigatorState, Hex1bWidget>)
Pushes a new route using a simple builder function.
Parameters:
id(String): Unique identifier for this route.builder(Func<NavigatorState, Hex1bWidget>): Function that builds the widget for this route.
public void Push(string id, Func<NavigatorState, Hex1bWidget> builder)Replace(NavigatorRoute)
Replaces the current route with a new one (useful for redirects).
Parameters:
route(NavigatorRoute): The route to replace the current route with.
public void Replace(NavigatorRoute route)Replace(string, Func<NavigatorState, Hex1bWidget>)
Replaces the current route using a simple builder function.
Parameters:
id(String): Unique identifier for this route.builder(Func<NavigatorState, Hex1bWidget>): Function that builds the widget for this route.
public void Replace(string id, Func<NavigatorState, Hex1bWidget> builder)Reset(NavigatorRoute)
Resets the navigator to a new root route, clearing all history.
Parameters:
newRoot(NavigatorRoute): The new root route.
public void Reset(NavigatorRoute newRoot)Events
OnNavigated
Event raised when navigation occurs.
Returns: Action
public event Action? OnNavigated