pub fn Navigation(_: NavigationProps) -> ElementExpand description
A set of destinations with one of them selected, plus the screen they lead to.
The children that are NavigationItem are the destinations; every other child is the
content of the selected screen. Splitting by kind rather than by index means a
destination that only exists under some condition does not force the Host to keep two
lists in step by hand.
Nothing here says bar, rail or drawer. The Renderer has already measured the window, so it chooses: a bar across the bottom of a phone-shaped window, a rail down the side of a tablet-shaped one, a drawer standing open on a desktop. Asking the Host to choose would mean the width travelling up, a whole VirtualDom pass, and a tree of destinations being destroyed and rebuilt every time the window crossed a boundary, to arrive at the same three layouts the Renderer can reach by moving the nodes it already has.
selected_index counts destinations, not children. It seeds the Renderer’s selection
and moves it when the change came from somewhere other than a tap; a tap moves the
selection in the Renderer and reports it by firing that destination’s own on_click.
§Props
For details, see the props struct definition.
weight:Option<f32>width:Option<f32>height:Option<f32>padding:Option<f32>padding_role:Option<SpaceRole>background:Option<Paint>shape_role:Option<ShapeRole>corner_radius:Option<f32>border_width:Option<f32>border_color:Option<Paint>elevation:Option<f32>fill_max_width:boolfill_max_height:boolselected_index:usizehead:Option<Element>What sits above the destinations in a strip: a mark, a name, a control.
Drawn only where the destinations are a strip down the side. A bar along the bottom is five destinations standing side by side and has nowhere to put this.
foot:Option<Element>What sits below them. An account row, usually.
children:Element