pub struct BottomNavigationBarItem {
pub key: Option<KeyRef>,
pub icon: WidgetRef,
pub active_icon: WidgetRef,
pub label: Option<String>,
pub background_color: Option<AnyColor>,
pub tooltip: Option<String>,
pub semantics_label: Option<String>,
}Expand description
An interactive button within either material’s BottomNavigationBar or the iOS themed
CupertinoTabBar with an icon and title.
This class is rarely used in isolation. It is typically embedded in one of the bottom navigation widgets above.
See also:
BottomNavigationBar- https://material.io/design/components/bottom-navigation.html
CupertinoTabBar- https://developer.apple.com/design/human-interface-guidelines/tab-bars/
Fields§
§key: Option<KeyRef>A key to be passed through to the resultant widget.
This allows the identification of different BottomNavigationBarItems through their
keys.
When changing the number of bar items in response to a bar item being tapped, giving each item a key will allow the inkwell / splash animation to be correctly positioned.
icon: WidgetRefThe icon of the item.
Typically the icon is an Icon or an ImageIcon widget. If another type of widget is
provided then it should configure itself to match the current IconTheme size and
color.
If active_icon is provided, this will only be displayed when the
item is not selected.
To make the bottom navigation bar more accessible, consider choosing an icon with a
stroked and filled version, such as Icons.cloud and Icons.cloud_queue.
icon should be set to the stroked version and
active_icon to the filled version.
If a particular icon doesn’t have a stroked or filled version, then don’t pair
unrelated icons. Instead, make sure to use a BottomNavigationBarType.shifting.
active_icon: WidgetRefAn alternative icon displayed when this bottom navigation item is selected.
If this icon is not provided, the bottom navigation bar will display
icon in either state.
label: Option<String>The text label for this BottomNavigationBarItem.
This will be used to create a Text widget to put in the bottom navigation bar.
background_color: Option<AnyColor>The color of the background radial animation for material BottomNavigationBar.
If the navigation bar’s type is BottomNavigationBarType.shifting, then the entire bar
is flooded with the background_color when this item is
tapped. This will override BottomNavigationBar.backgroundColor.
Not used for CupertinoTabBar. Control the invariant bar color directly via
CupertinoTabBar.backgroundColor.
tooltip: Option<String>The text to display in the Tooltip for this BottomNavigationBarItem.
A Tooltip will only appear on this item if tooltip is set to a
non-empty string.
Defaults to None, in which case the tooltip is not shown.
semantics_label: Option<String>The semantic label for this BottomNavigationBarItem.
This is used by accessibility tools to describe the item. When provided,
it overrides the default label String when read by accessibility
tools.
This is useful when the visual label does not fully describe the action or destination, or when you want to provide additional context for screen reader users.
If null, the default semantic description is used.
Implementations§
Sourcepub fn new<K>(icon: impl IntoWidget<K>) -> BottomNavigationBarItem
pub fn new<K>(icon: impl IntoWidget<K>) -> BottomNavigationBarItem
Creates an item that is used with BottomNavigationBar.items; Dart’s optional named
arguments are the setters.
The argument icon should not be None and the argument label should not be None
when used in a Material Design’s BottomNavigationBar.
Sourcepub fn key(self, key: KeyRef) -> BottomNavigationBarItem
pub fn key(self, key: KeyRef) -> BottomNavigationBarItem
Dart BottomNavigationBarItem(key:).
Sourcepub fn label(self, label: impl Into<String>) -> BottomNavigationBarItem
pub fn label(self, label: impl Into<String>) -> BottomNavigationBarItem
Dart BottomNavigationBarItem(label:).
Sourcepub fn active_icon<K>(
self,
active_icon: impl IntoWidget<K>,
) -> BottomNavigationBarItem
pub fn active_icon<K>( self, active_icon: impl IntoWidget<K>, ) -> BottomNavigationBarItem
Dart BottomNavigationBarItem(activeIcon:).
Sourcepub fn background_color(
self,
background_color: impl Into<AnyColor>,
) -> BottomNavigationBarItem
pub fn background_color( self, background_color: impl Into<AnyColor>, ) -> BottomNavigationBarItem
Dart BottomNavigationBarItem(backgroundColor:).
Sourcepub fn tooltip(self, tooltip: impl Into<String>) -> BottomNavigationBarItem
pub fn tooltip(self, tooltip: impl Into<String>) -> BottomNavigationBarItem
Dart BottomNavigationBarItem(tooltip:).
Sourcepub fn semantics_label(
self,
semantics_label: impl Into<String>,
) -> BottomNavigationBarItem
pub fn semantics_label( self, semantics_label: impl Into<String>, ) -> BottomNavigationBarItem
Dart BottomNavigationBarItem(semanticsLabel:).