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§
Sourcepub fn new(icon: impl Into<DestinationIcon>, label: impl Into<String>) -> Self
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.
Sourcepub fn selected_icon(self, icon: impl Into<DestinationIcon>) -> Self
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.
Sourcepub fn badge(self, count: u32) -> Self
pub fn badge(self, count: u32) -> Self
A notification count on this destination, pinned to its glyph as a
Badge is pinned to a child, and written as it writes one (999+
past 999). 0 shows nothing, so a count straight out of a model needs no if
around it.
Sourcepub fn badge_dot(self) -> Self
pub fn badge_dot(self) -> Self
A dot on this destination’s glyph: something new here, without how much (milestone 707).
Sourcepub fn tooltip(self, message: impl Into<String>) -> Self
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.
Sourcepub fn disabled(self) -> Self
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.
Sourcepub fn indicator_color(self, color: Color) -> Self
pub fn indicator_color(self, color: Color) -> Self
This destination’s own indicator colour, over the theme’s
(navigation_rail.dart:1144).
Sourcepub fn indicator_shape(self, shape: ShapeBorder) -> Self
pub fn indicator_shape(self, shape: ShapeBorder) -> Self
This destination’s own indicator shape, over the theme’s
(navigation_rail.dart:1148).
Sourcepub fn overlay_color(self, overlay: WidgetStateProperty<Color>) -> Self
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).
Sourcepub fn tile_color(self, color: Color) -> Self
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).