Skip to main content

NavigationView

Struct NavigationView 

Source
pub struct NavigationView {
Show 37 fields pub key: Option<KeyRef>, pub menu_items: Vec<NavigationViewItem>, pub footer_menu_items: Vec<NavigationViewItem>, pub selected_item: Option<String>, pub selection_changed: NavigationViewSelectionChanged, pub item_invoked: Option<NavigationViewItemEvent>, pub content: WidgetRef, pub pane_display_mode: NavigationViewPaneDisplayMode, pub compact_mode_threshold_width: f64, pub expanded_mode_threshold_width: f64, pub compact_pane_length: f64, pub open_pane_length: f64, pub is_pane_open: Option<bool>, pub pane_open_changed: Option<NavigationViewPaneOpenChanged>, pub is_pane_visible: bool, pub is_title_bar_auto_padding_enabled: bool, pub is_pane_toggle_button_visible: bool, pub is_settings_visible: bool, pub is_back_button_visible: NavigationViewBackButtonVisible, pub is_back_enabled: bool, pub back_requested: Option<Listener>, pub selection_follows_focus: NavigationViewSelectionFollowsFocus, pub header: Option<WidgetRef>, pub always_show_header: bool, pub pane_title: String, pub pane_header: Option<WidgetRef>, pub pane_custom_content: Option<WidgetRef>, pub auto_suggest_box: Option<WidgetRef>, pub pane_footer: Option<WidgetRef>, pub content_overlay: Option<WidgetRef>, pub display_mode_changed: Option<NavigationViewDisplayModeChanged>, pub expanding: Option<NavigationViewItemEvent>, pub collapsed: Option<NavigationViewItemEvent>, pub pane_opening: Option<Listener>, pub pane_opened: Option<Listener>, pub pane_closing: Option<SplitViewPaneClosingHandler>, pub pane_closed: Option<Listener>,
}
Expand description

A navigation shell; the owner supplies content and handles navigation events.

Fields§

§key: Option<KeyRef>

Identity retained across owner rebuilds.

§menu_items: Vec<NavigationViewItem>

Main menu items and their nested children.

§footer_menu_items: Vec<NavigationViewItem>

Footer menu items, before the built-in settings item.

§selected_item: Option<String>

Stable identity selected by the owner.

§selection_changed: NavigationViewSelectionChanged

Requests selection after ItemInvoked has been raised.

§item_invoked: Option<NavigationViewItemEvent>

Receives every invocation, including the already selected item.

§content: WidgetRef

The page content; NavigationView does not instantiate pages itself.

§pane_display_mode: NavigationViewPaneDisplayMode

Chooses the adaptive or explicit layout.

§compact_mode_threshold_width: f64

Below this positive width Auto uses Minimal.

§expanded_mode_threshold_width: f64

At and above this width Auto uses Expanded.

§compact_pane_length: f64

The width of the closed icon rail.

§open_pane_length: f64

The requested open pane width, clamped to the available control width.

§is_pane_open: Option<bool>

Optional owner override; None lets the adaptive pane maintain its openness.

§pane_open_changed: Option<NavigationViewPaneOpenChanged>

Requests an owner update when a controlled pane opens or closes.

§is_pane_visible: bool

Whether either pane is visible.

§is_title_bar_auto_padding_enabled: bool

IsTitleBarAutoPaddingEnabled: whether the toggle, the pane’s items and the content’s controls keep clear of what the system covers of the view (the MediaQuery’s padding, which a FluentPage that extends_content_into_system_bars leaves), while the pane and the content reach the view’s edges.

§is_pane_toggle_button_visible: bool

Whether the menu toggle is visible in left layouts.

§is_settings_visible: bool

Whether the settings entry is appended to the footer.

§is_back_button_visible: NavigationViewBackButtonVisible

Whether the back button is visible.

§is_back_enabled: bool

Whether the visible back button accepts input.

§back_requested: Option<Listener>

Receives back-button activation without changing the selected page.

§selection_follows_focus: NavigationViewSelectionFollowsFocus

Whether keyboard focus selects menu items.

§header: Option<WidgetRef>

Optional page header above content.

§always_show_header: bool

Keeps the page header visible outside Minimal mode.

§pane_title: String

Text next to the pane toggle, or preceding top items.

§pane_header: Option<WidgetRef>

Custom header in the pane.

§pane_custom_content: Option<WidgetRef>

Custom content between pane header and menu items.

§auto_suggest_box: Option<WidgetRef>

Native search content hosted in the source AutoSuggestBox presenter slot.

§pane_footer: Option<WidgetRef>

Custom content above footer menu items.

§content_overlay: Option<WidgetRef>

Content placed below the top pane, before page content.

§display_mode_changed: Option<NavigationViewDisplayModeChanged>

Receives adaptive display-mode changes.

§expanding: Option<NavigationViewItemEvent>

Fires before expanded children become visible.

§collapsed: Option<NavigationViewItemEvent>

Fires after collapsed children are hidden.

§pane_opening: Option<Listener>

Fires when the pane starts opening.

§pane_opened: Option<Listener>

Fires when the pane finishes opening.

§pane_closing: Option<SplitViewPaneClosingHandler>

Can cancel a pane closing request.

§pane_closed: Option<Listener>

Fires when the pane finishes closing.

Implementations§

Source§

impl NavigationView

Source

pub const SETTINGS_ITEM_ID: &'static str = "__navigation_settings"

Stable identity of the built-in settings item; owner item ids must not use it.

Source

pub fn new<C>( menu_items: Vec<NavigationViewItem>, selected_item: Option<String>, selection_changed: impl Fn(&mut App, NavigationViewSelectionChangedEventArgs) + 'static, content: impl IntoWidget<C>, ) -> Self

Creates an adaptive navigation shell with owner-managed selection and page content.

Source§

impl NavigationView

Source

pub fn pane_display_mode(self, value: NavigationViewPaneDisplayMode) -> Self

Sets pane_display_mode.

Source

pub fn is_pane_visible(self, value: bool) -> Self

Sets is_pane_visible.

Source

pub fn is_title_bar_auto_padding_enabled(self, value: bool) -> Self

Sets IsTitleBarAutoPaddingEnabled.

Source

pub fn is_pane_toggle_button_visible(self, value: bool) -> Self

Sets is_pane_toggle_button_visible.

Source

pub fn is_settings_visible(self, value: bool) -> Self

Sets is_settings_visible.

Source

pub fn is_back_button_visible( self, value: NavigationViewBackButtonVisible, ) -> Self

Sets is_back_button_visible.

Source

pub fn is_back_enabled(self, value: bool) -> Self

Sets is_back_enabled.

Source

pub fn always_show_header(self, value: bool) -> Self

Sets always_show_header.

Source

pub fn selection_follows_focus( self, value: NavigationViewSelectionFollowsFocus, ) -> Self

Sets selection_follows_focus.

Source

pub fn compact_mode_threshold_width(self, value: f64) -> Self

Sets compact_mode_threshold_width, coercing negative values to zero like the source property.

Source

pub fn expanded_mode_threshold_width(self, value: f64) -> Self

Sets expanded_mode_threshold_width, coercing negative values to zero like the source property.

Source

pub fn compact_pane_length(self, value: f64) -> Self

Sets compact_pane_length, coercing negative values to zero like the source property.

Source

pub fn open_pane_length(self, value: f64) -> Self

Sets open_pane_length, coercing negative values to zero like the source property.

Source

pub fn header<K>(self, child: impl IntoWidget<K>) -> Self

Supplies the source header content slot.

Source

pub fn pane_header<K>(self, child: impl IntoWidget<K>) -> Self

Supplies the source pane_header content slot.

Source

pub fn pane_custom_content<K>(self, child: impl IntoWidget<K>) -> Self

Supplies the source pane_custom_content content slot.

Supplies the source pane_footer content slot.

Source

pub fn content_overlay<K>(self, child: impl IntoWidget<K>) -> Self

Supplies the source content_overlay content slot.

Source

pub fn auto_suggest_box<K>(self, child: impl IntoWidget<K>) -> Self

Supplies the source auto_suggest_box content slot.

Source

pub fn pane_title(self, title: impl Into<String>) -> Self

Sets the pane title shown beside the toggle or before top items.

Source

pub fn footer_menu_items( self, items: impl IntoIterator<Item = NavigationViewItem>, ) -> Self

Supplies footer entries before the built-in settings item.

Source

pub fn is_pane_open( self, open: bool, changed: impl Fn(&mut App, bool) + 'static, ) -> Self

Gives the owner control of pane openness while retaining adaptive change requests.

Source

pub fn key(self, key: KeyRef) -> Self

Sets the widget identity.

Source

pub fn item_invoked( self, callback: impl Fn(&mut App, NavigationViewItemEventArgs) + 'static, ) -> Self

Receives the source item_invoked event.

Source

pub fn expanding( self, callback: impl Fn(&mut App, NavigationViewItemEventArgs) + 'static, ) -> Self

Receives the source expanding event.

Source

pub fn collapsed( self, callback: impl Fn(&mut App, NavigationViewItemEventArgs) + 'static, ) -> Self

Receives the source collapsed event.

Trait Implementations§

Source§

impl Clone for NavigationView

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for NavigationView

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl StatefulWidget for NavigationView

Source§

type State = NavigationViewState

The state this widget creates.
Source§

fn key(&self) -> Option<&KeyRef>

Source§

fn create_state(&self) -> Self::State

Creates the mutable state for this widget at a given location in the tree. Read more
Source§

fn debug_fill_properties( &self, _app: &App, properties: &mut DiagnosticPropertiesBuilder, )

Dart’s debugFillProperties: the properties a dump shows for this widget, in Dart’s order. Dart’s Widget base only sets the dense tree style, which the framework does.
Source§

fn debug_check_constructor(&self)

Source§

fn as_preferred_size_widget( &self, ) -> Option<&(dyn PreferredSizeWidget + 'static)>

Source§

fn type_name(&self) -> &'static str

See Widget::type_name. A stateful form another widget kind becomes (an animated or status transition widget) names the widget it wraps.

Auto Trait Implementations§

§

impl !RefUnwindSafe for NavigationView

§

impl !Send for NavigationView

§

impl !Sync for NavigationView

§

impl !UnwindSafe for NavigationView

§

impl Forget for NavigationView

§

impl Freeze for NavigationView
where *const RcInner<dyn Key> is !null: Freeze, PhantomData<RcInner<dyn Key>>: Freeze, *const u8 is !null: Freeze, PhantomData<NavigationViewItem>: Freeze, PhantomData<u8>: Freeze, *const RcInner<dyn Fn(&mut App, NavigationViewSelectionChangedEventArgs)> is !null: Freeze, PhantomData<RcInner<dyn Fn(&mut App, NavigationViewSelectionChangedEventArgs)>>: Freeze, *const RcInner<dyn Fn(&mut App, NavigationViewItemEventArgs)> is !null: Freeze, PhantomData<RcInner<dyn Fn(&mut App, NavigationViewItemEventArgs)>>: Freeze, *const RcInner<dyn Widget> is !null: Freeze, PhantomData<RcInner<dyn Widget>>: Freeze, *const RcInner<dyn Fn(&mut App, bool)> is !null: Freeze, PhantomData<RcInner<dyn Fn(&mut App, bool)>>: Freeze, *const RcInner<dyn Fn(&mut App)> is !null: Freeze, PhantomData<RcInner<dyn Fn(&mut App)>>: Freeze, NonZero<u32>: Freeze, *const (): Freeze, *const RcInner<dyn Fn(&mut App, NavigationViewDisplayMode)> is !null: Freeze, PhantomData<RcInner<dyn Fn(&mut App, NavigationViewDisplayMode)>>: Freeze, *const RcInner<dyn Fn(&mut App, &mut SplitViewPaneClosingEventArgs)> is !null: Freeze, PhantomData<RcInner<dyn Fn(&mut App, &mut SplitViewPaneClosingEventArgs)>>: Freeze,

§

impl Move for NavigationView

§

impl Unpin for NavigationView

§

impl UnsafeUnpin for NavigationView
where *const RcInner<dyn Key> is !null: UnsafeUnpin, PhantomData<RcInner<dyn Key>>: UnsafeUnpin, *const u8 is !null: UnsafeUnpin, PhantomData<NavigationViewItem>: UnsafeUnpin, PhantomData<u8>: UnsafeUnpin, *const RcInner<dyn Fn(&mut App, NavigationViewSelectionChangedEventArgs)> is !null: UnsafeUnpin, PhantomData<RcInner<dyn Fn(&mut App, NavigationViewSelectionChangedEventArgs)>>: UnsafeUnpin, *const RcInner<dyn Fn(&mut App, NavigationViewItemEventArgs)> is !null: UnsafeUnpin, PhantomData<RcInner<dyn Fn(&mut App, NavigationViewItemEventArgs)>>: UnsafeUnpin, *const RcInner<dyn Widget> is !null: UnsafeUnpin, PhantomData<RcInner<dyn Widget>>: UnsafeUnpin, *const RcInner<dyn Fn(&mut App, bool)> is !null: UnsafeUnpin, PhantomData<RcInner<dyn Fn(&mut App, bool)>>: UnsafeUnpin, *const RcInner<dyn Fn(&mut App)> is !null: UnsafeUnpin, PhantomData<RcInner<dyn Fn(&mut App)>>: UnsafeUnpin, NonZeroU32Inner: UnsafeUnpin, *const (): UnsafeUnpin, *const RcInner<dyn Fn(&mut App, NavigationViewDisplayMode)> is !null: UnsafeUnpin, PhantomData<RcInner<dyn Fn(&mut App, NavigationViewDisplayMode)>>: UnsafeUnpin, *const RcInner<dyn Fn(&mut App, &mut SplitViewPaneClosingEventArgs)> is !null: UnsafeUnpin, PhantomData<RcInner<dyn Fn(&mut App, &mut SplitViewPaneClosingEventArgs)>>: UnsafeUnpin,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> Downcast<T> for T

Source§

fn downcast(&self) -> &T

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<W> IntoWidget<StatefulKind> for W
where W: StatefulWidget,

Source§

fn into_widget(self) -> Rc<dyn Widget>

The widget as a tree node, made where this is called: its creation_location.
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> Upcast<T> for T

Source§

fn upcast(&self) -> Option<&T>