NavigationRail constructor

const NavigationRail(
  1. {Color backgroundColor,
  2. bool extended: false,
  3. Widget leading,
  4. Widget trailing,
  5. @required List<NavigationRailDestination> destinations,
  6. @required int selectedIndex,
  7. ValueChanged<int> onDestinationSelected,
  8. double elevation,
  9. double groupAlignment,
  10. NavigationRailLabelType labelType,
  11. TextStyle unselectedLabelTextStyle,
  12. TextStyle selectedLabelTextStyle,
  13. IconThemeData unselectedIconTheme,
  14. IconThemeData selectedIconTheme,
  15. double minWidth,
  16. double minExtendedWidth}
)

Creates a material design navigation rail.

The value of destinations must be a list of one or more NavigationRailDestination values.

If elevation is specified, it must be non-negative.

If minWidth is specified, it must be non-negative, and if minExtendedWidth is specified, it must be non-negative and greater than minWidth.

The argument extended must not be null. extended can only be set to true when when the labelType is null or NavigationRailLabelType.none.

If backgroundColor, elevation, groupAlignment, labelType, unselectedLabelTextStyle, selectedLabelTextStyle, unselectedIconTheme, or selectedIconTheme are null, then their NavigationRailThemeData values will be used. If the corresponding NavigationRailThemeData property is null, then the navigation rail defaults are used. See the individual properties for more information.

Typically used within a Row that defines the Scaffold.body property.

Implementation

const NavigationRail({
  this.backgroundColor,
  this.extended = false,
  this.leading,
  this.trailing,
  @required this.destinations,
  @required this.selectedIndex,
  this.onDestinationSelected,
  this.elevation,
  this.groupAlignment,
  this.labelType,
  this.unselectedLabelTextStyle,
  this.selectedLabelTextStyle,
  this.unselectedIconTheme,
  this.selectedIconTheme,
  this.minWidth,
  this.minExtendedWidth,
}) :  assert(destinations != null && destinations.length >= 2),
      assert(selectedIndex != null),
      assert(0 <= selectedIndex && selectedIndex < destinations.length),
      assert(elevation == null || elevation > 0),
      assert(minWidth == null || minWidth > 0),
      assert(minExtendedWidth == null || minExtendedWidth > 0),
      assert((minWidth == null || minExtendedWidth == null) || minExtendedWidth >= minWidth),
      assert(extended != null),
      assert(!extended || (labelType == null || labelType == NavigationRailLabelType.none));