NavigationBar constructor

NavigationBar({
  1. Key? key,
  2. Duration? animationDuration,
  3. int selectedIndex = 0,
  4. required List<Widget> destinations,
  5. ValueChanged<int>? onDestinationSelected,
  6. Color? backgroundColor,
  7. double? elevation,
  8. Color? shadowColor,
  9. Color? surfaceTintColor,
  10. Color? indicatorColor,
  11. ShapeBorder? indicatorShape,
  12. double? height,
  13. NavigationDestinationLabelBehavior? labelBehavior,
  14. MaterialStateProperty<Color?>? overlayColor,
})

Creates a Material 3 Navigation Bar component.

The value of destinations must be a list of two or more NavigationDestination values.

Implementation

// TODO(goderbauer): This class cannot be const constructed, https://github.com/dart-lang/linter/issues/3366.
// ignore: prefer_const_constructors_in_immutables
NavigationBar({
  super.key,
  this.animationDuration,
  this.selectedIndex = 0,
  required this.destinations,
  this.onDestinationSelected,
  this.backgroundColor,
  this.elevation,
  this.shadowColor,
  this.surfaceTintColor,
  this.indicatorColor,
  this.indicatorShape,
  this.height,
  this.labelBehavior,
  this.overlayColor,
}) :  assert(destinations.length >= 2),
      assert(0 <= selectedIndex && selectedIndex < destinations.length);