Skip to main content

NavigationDestination

Struct NavigationDestination 

Source
pub struct NavigationDestination { /* private fields */ }
Expand description

A declared destination: everything the caller said about one entry in the list — its mark, its name, the mark it swaps to while selected, a badge, a tooltip, and the decorations that belong to this entry rather than to the list.

It exists as a value because an application that adapts across widths has three chromes to feed and one navigation to describe. NavigationRail, BottomBar, NavigationDrawer and NavScaffold all take destinations, so the list is written once and cannot drift between the forms.

use frus_widgets::{Icons, NavigationDestination};

let inbox = NavigationDestination::new(Icons::MAIL_OUTLINE, "Inbox")
    .selected_icon(Icons::MAIL)
    .badge(3)
    .tooltip("Unread messages");
assert_eq!(inbox.label(), "Inbox");

Implementations§

Source§

impl NavigationDestination

Source

pub fn new(icon: impl Into<DestinationIcon>, label: impl Into<String>) -> Self

A destination with nothing said about it but its mark and its name.

Source

pub fn selected_icon(self, icon: impl Into<DestinationIcon>) -> Self

The mark shown while this destination is selected, where it differs from the resting one (navigation_rail.dart:1132).

The convention the icon set is drawn for: an outline at rest, the filled twin when selected — Icons::FAVORITE_BORDER and Icons::FAVORITE, or an outlined style against the filled one. It is how a destination reads as selected without leaning on colour alone, which is the difference between navigation a colour-blind reader can use and navigation they cannot.

Source

pub fn badge(self, count: u32) -> Self

A notification count on this destination. 0 shows nothing, so a count straight out of a model needs no if around it.

Source

pub fn tooltip(self, message: impl Into<String>) -> Self

What a pointer resting here is told (navigation_rail.dart:1155).

A rail shows glyphs without labels by default, which is the case this is for: the mark is all a destination says about itself, and a mark is not always enough.

Source

pub fn disabled(self) -> Self

Marks this destination unreachable (navigation_rail.dart:1161): it takes the disabled ink, nothing lights under the pointer, it emits no message, and the keyboard steps over it.

Source

pub fn indicator_color(self, color: Color) -> Self

This destination’s own indicator colour, over the theme’s (navigation_rail.dart:1144).

Source

pub fn indicator_shape(self, shape: ShapeBorder) -> Self

This destination’s own indicator shape, over the theme’s (navigation_rail.dart:1148).

Source

pub fn overlay_color(self, overlay: WidgetStateProperty<Color>) -> Self

This destination’s own highlight per state, over the framework’s state layer (navigation_bar.dart:232).

Source

pub fn tile_color(self, color: Color) -> Self

The whole area behind this destination, edge to edge — read by a NavigationDrawer’s rows and by nothing else (navigation_drawer.dart:228).

Source

pub fn label(&self) -> &str

What this destination is called.

Trait Implementations§

Source§

impl Clone for NavigationDestination

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 NavigationDestination

Source§

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

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

impl Default for NavigationDestination

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

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<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> 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<Msg> IntoMsg<Msg> for Msg

Source§

fn defer(work: impl Fn() -> Msg + 'static) -> Msg

The message that stands for work’s result.
Source§

impl<T> MaybeSend for T
where T: Send,

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.