NavigationSidebar constructor
const
NavigationSidebar({
- Key? key,
- Color? backgroundColor,
- double? spacing,
- NavigationLabelType labelType = NavigationLabelType.expanded,
- NavigationLabelPosition labelPosition = NavigationLabelPosition.end,
- NavigationLabelSize labelSize = NavigationLabelSize.large,
- EdgeInsetsGeometry? padding,
- BoxConstraints? constraints,
- int? index,
- ValueChanged<
int> ? onSelected, - double? surfaceOpacity,
- double? surfaceBlur,
- bool expanded = true,
- bool keepCrossAxisSize = false,
- bool keepMainAxisSize = false,
- 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(ListlabelType(NavigationLabelType, default: expanded): Label display behaviorlabelPosition(NavigationLabelPosition, default: end): Label positioninglabelSize(NavigationLabelSize, default: large): Size variant for itemsindex(int?, optional): Currently selected item indexonSelected(ValueChangedexpanded(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,
});