StacNavigationBar class

A Stac model representing Flutter's Material 3 NavigationBar.

Displays a horizontal bar of StacNavigationDestinations, typically placed in StacScaffold's bottomNavigationBar slot. Pair with a StacDefaultNavigationController to drive selection state.

Dart example:

StacNavigationBar(
  destinations: [
    StacNavigationDestination(
      icon: StacIcon(icon: 'home_outlined'),
      selectedIcon: StacIcon(icon: 'home'),
      label: 'Home',
    ),
    StacNavigationDestination(
      icon: StacIcon(icon: 'settings_outlined'),
      selectedIcon: StacIcon(icon: 'settings'),
      label: 'Settings',
    ),
  ],
)

JSON example:

{
  "type": "navigationBar",
  "destinations": [
    {
      "icon": {"type": "icon", "icon": "home_outlined"},
      "selectedIcon": {"type": "icon", "icon": "home"},
      "label": "Home"
    },
    {
      "icon": {"type": "icon", "icon": "settings_outlined"},
      "selectedIcon": {"type": "icon", "icon": "settings"},
      "label": "Settings"
    }
  ]
}

See also:

  • Flutter's NavigationBar docs (https://api.flutter.dev/flutter/material/NavigationBar-class.html)
Inheritance
Annotations
  • @JsonSerializable.new(explicitToJson: true)

Constructors

StacNavigationBar({required List<StacNavigationDestination> destinations, StacDuration? animationDuration, int? selectedIndex, String? backgroundColor, double? elevation, String? shadowColor, String? surfaceTintColor, String? indicatorColor, StacBorder? indicatorShape, double? height, StacNavigationDestinationLabelBehavior? labelBehavior, StacTextStyle? labelTextStyle, StacEdgeInsets? labelPadding, bool? maintainBottomViewPadding})
Creates a navigation bar with the specified properties.
const
StacNavigationBar.fromJson(Map<String, dynamic> json)
Creates a StacNavigationBar from a JSON map.
factory

Properties

animationDuration StacDuration?
Transition time for each destination as it goes between selected and unselected.
final
backgroundColor String?
The color of the NavigationBar itself.
final
destinations List<StacNavigationDestination>
The destinations shown in the navigation bar.
final
elevation double?
The elevation of the navigation bar.
final
hashCode int
The hash code for this object.
no setterinherited
height double?
The height of the navigation bar.
final
indicatorColor String?
The color of the selected destination's indicator.
final
indicatorShape StacBorder?
The shape of the selected destination's indicator.
final
jsonData Map<String, dynamic>?
Raw JSON data for this widget
finalinherited
labelBehavior StacNavigationDestinationLabelBehavior?
Defines how destination labels are laid out and when they are displayed.
final
labelPadding StacEdgeInsets?
The padding around each destination's label widget.
final
labelTextStyle StacTextStyle?
The text style for destination labels.
final
maintainBottomViewPadding bool?
Whether the underlying SafeArea should maintain the bottom viewPadding instead of the bottom padding.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
selectedIndex int?
The initial selected destination index. Ignored when a StacDefaultNavigationController is provided.
final
shadowColor String?
The color used for the drop shadow to indicate elevation.
final
surfaceTintColor String?
The color used as an overlay on backgroundColor to indicate elevation.
final
type String
Widget type identifier.
no setteroverride

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJson() Map<String, dynamic>
Converts this StacNavigationBar instance to a JSON map.
override
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited