NavRailButton class

A button widget for use in navigation rails.

NavRailButton provides a customizable button with icon and label support. It automatically adapts to different states (selected/unselected) and screen sizes (mobile/desktop). The button can be expanded or collapsed based on the navigation rail's state.

Example:

NavRailButton(
  label: 'Home',
  icon: Icons.home,
  onTap: () => print('Home tapped'),
)
Inheritance

Constructors

Creates a NavRailButton widget.
const

Properties

borderRadius BorderRadius?
The border radius for the button's background.
finalinherited
direction NavRailDirection
The direction of the navigation rail this button belongs to.
finalinherited
expanded bool
Whether the button is in expanded state.
finalinherited
hashCode int
The hash code for this object.
no setterinherited
height double?
The height of the button.
finalinherited
icon IconData?
The icon to display on the button.
finalinherited
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
label String?
The text label to display on the button.
finalinherited
labelPosition NavRailButtonLabelPosition
The position of the label relative to the icon.
finalinherited
onTap → dynamic Function()?
The callback function to execute when the button is tapped.
finalinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
selected bool
Whether the button is currently selected.
finalinherited
selectedBackgroundColor Color?
The background color to use when the button is selected.
finalinherited
selectedColor Color?
The color to use when the button is selected.
finalinherited
showSelected bool
Whether to display when selected.
finalinherited
unselectedBackgroundColor Color?
The background color to use when the button is not selected.
finalinherited
unselectedColor Color?
The color to use when the button is not selected.
finalinherited
width double?
The width of the button.
finalinherited

Methods

build(BuildContext context) Widget
Describes the part of the user interface represented by this widget.
override
copyWith({String? label, IconData? icon, dynamic onTap()?, bool? expanded, bool? selected, bool? showSelected, double? width, double? height, Color? selectedColor, Color? selectedBackgroundColor, Color? unselectedColor, Color? unselectedBackgroundColor, BorderRadius? borderRadius, NavRailDirection? direction, NavRailButtonLabelPosition? labelPosition}) NavRailButton
Creates a copy of this NavRailButton with the given fields replaced.
override
createElement() StatelessElement
Creates a StatelessElement to manage this widget's location in the tree.
inherited
debugDescribeChildren() List<DiagnosticsNode>
Returns a list of DiagnosticsNode objects describing this node's children.
inherited
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toDiagnosticsNode({String? name, DiagnosticsTreeStyle? style}) DiagnosticsNode
Returns a debug representation of the object that is used by debugging tools and by DiagnosticsNode.toStringDeep.
inherited
toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) String
A string representation of this object.
inherited
toStringDeep({String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug, int wrapWidth = 65}) String
Returns a string representation of this node and its descendants.
inherited
toStringShallow({String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) String
Returns a one-line detailed description of the object.
inherited
toStringShort() String
A short, textual description of this widget.
inherited

Operators

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