Route Registry¶
Source: ui/route_registry.py
Declarative route definitions that connect paths with factories, wrappers, layout strategies, chrome, and fallback behavior. See the Routing concept for narrative and examples.
Declarative registry of route factories, layouts, wrappers, and chrome.
Public surface for authors and maintainers:
- Enums
RouteKind,BodyWrapperKind, andLayoutKindclassify routes. RouteDefdescribes one registered route.ROUTE_REGISTRYis the authoritative ordered tuple of route definitions.get_routelooks up aRouteDefby path.build_drawer_controlsbuilds drawer destinations from shell routes.DRAWER_ROUTES,DEEP_ROUTES, andKNOWN_ROUTESexpose path lists.
RouteKind ¶
Bases: Enum
Describe how a route participates in the page view stack.
Attributes:
| Name | Type | Description |
|---|---|---|
SHELL |
Root destination that replaces the current view stack. |
|
DEEP |
Destination that may be pushed above a shell view. |
Source code in src/learning_app/ui/route_registry.py
BodyWrapperKind ¶
Bases: Enum
Select the host wrapper applied to route body controls.
Attributes:
| Name | Type | Description |
|---|---|---|
SHELL |
Width-constrained shell column without an added safe area. |
|
BOTTOM_INSET_SHELL |
Shell column protected from side and bottom intrusions while allowing the app bar to own the top inset. |
|
DEEP |
Width-constrained form container for a deep route. |
Source code in src/learning_app/ui/route_registry.py
LayoutKind ¶
Bases: Enum
Select the resize-layout strategy for a route.
Attributes:
| Name | Type | Description |
|---|---|---|
HOME |
Refresh the home tile collection's flex layout. |
|
IMPORT_EXPORT |
Apply routable shell sizing to import/export content. |
|
SHELL |
Apply shell sizing to the route's declared layout control. |
|
DEEP_FORM |
Apply form sizing to a routable deep-screen control. |
Source code in src/learning_app/ui/route_registry.py
RouteDef
dataclass
¶
Describe all routing and presentation behavior for one route.
Attributes:
| Name | Type | Description |
|---|---|---|
path |
str
|
Canonical route path without query parameters. |
kind |
RouteKind
|
Whether the route replaces the shell or is pushed as a deep view. |
body_wrapper |
BodyWrapperKind
|
Wrapper used to host controls returned by the factory. |
layout_kind |
LayoutKind
|
Layout strategy applied initially and after resize events. |
chrome |
ShellChromeConfig | None
|
Shared shell chrome configuration, or |
build_factory |
RouteBuildFactory
|
Callable that builds body controls from a page and
decoded route parameters. Returning |
body_content_alignment |
MainAxisAlignment
|
Main-axis alignment inside deep body columns. |
vertical_alignment |
MainAxisAlignment
|
Main-axis alignment assigned to the Flet view. |
shell_layout_control |
type | None
|
Optional control type used to identify the routable shell body during layout updates. |
drawer_label |
str | None
|
Navigation drawer label, or |
drawer_icon |
str | None
|
Name of the corresponding |
drawer_divider_before |
bool
|
Whether to add a divider before this drawer item. |
fallback_path |
str | None
|
Route used when the body factory returns |
Source code in src/learning_app/ui/route_registry.py
build_drawer_controls ¶
Build drawer destinations from registered drawer routes.
Returns:
| Type | Description |
|---|---|
list[Control]
|
A spacer followed by registered destinations and configured dividers. |
Source code in src/learning_app/ui/route_registry.py
get_route ¶
get_route(path: str) -> RouteDef | None
Look up a route definition by canonical path.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str
|
Route path without query parameters. |
required |
Returns:
| Type | Description |
|---|---|
RouteDef | None
|
The matching route definition, or |