NavigationSidebar constructor

const NavigationSidebar({
  1. Key? key,
  2. Color? backgroundColor,
  3. double? spacing,
  4. NavigationLabelType labelType = NavigationLabelType.expanded,
  5. NavigationLabelPosition labelPosition = NavigationLabelPosition.end,
  6. NavigationLabelSize labelSize = NavigationLabelSize.large,
  7. EdgeInsetsGeometry? padding,
  8. BoxConstraints? constraints,
  9. int? index,
  10. ValueChanged<int>? onSelected,
  11. double? surfaceOpacity,
  12. double? surfaceBlur,
  13. bool expanded = true,
  14. bool keepCrossAxisSize = false,
  15. bool keepMainAxisSize = false,
  16. required List<NavigationBarItem> children,
})

Creates a NavigationSidebar with the specified configuration and items.

The children parameter is required and should contain NavigationBarItem widgets that define the navigation destinations. Default values are optimized for sidebar presentation with expanded labels and large sizing.

The sidebar defaults to expanded label presentation with large sizing and end-positioned labels, creating a comprehensive navigation experience suitable for desktop and tablet interfaces.

Parameters:

  • children (List
  • labelType (NavigationLabelType, default: expanded): Label display behavior
  • labelPosition (NavigationLabelPosition, default: end): Label positioning
  • labelSize (NavigationLabelSize, default: large): Size variant for items
  • index (int?, optional): Currently selected item index
  • onSelected (ValueChanged
  • expanded (bool, default: true): Whether to fill available width

Example:

NavigationSidebar(
  backgroundColor: Theme.of(context).colorScheme.surface,
  index: selectedIndex,
  onSelected: (index) => _handleNavigation(index),
  children: sidebarItems,
)

Implementation

const NavigationSidebar({
  super.key,
  this.backgroundColor,
  this.spacing,
  this.labelType = NavigationLabelType.expanded,
  this.labelPosition = NavigationLabelPosition.end,
  this.labelSize = NavigationLabelSize.large,
  this.padding,
  this.constraints,
  this.index,
  this.onSelected,
  this.surfaceOpacity,
  this.surfaceBlur,
  this.expanded = true,
  this.keepCrossAxisSize = false,
  this.keepMainAxisSize = false,
  required this.children,
});