NxCustomNavigationDrawer class

A Material 3 style navigation drawer with support for destinations and sign-out functionality.

This widget extends Flutter's NavigationDrawer with additional features:

  • List of destinations with selected and unselected icons
  • Optional sign-out destination at the bottom
  • Customizable header with "Menu" text
  • Theme-aware styling with extensive customization options
  • Optional Sequrify branding button

The drawer uses Material 3's navigation rail style with indicator highlighting for the selected destination.

Example usage:

NxCustomNavigationDrawer(
  destinations: [
    Destination(
      'Profile',
      Icon(Icons.person_outline),  // Unselected state
      Icon(Icons.person),         // Selected state
    ),
    Destination(
      'Settings',
      Icon(Icons.settings_outline),
      Icon(Icons.settings),
    ),
  ],
  selectedIndex: 0,
  onDestinationSelected: (index) {
    // Handle destination selection
  },
  signOutDestination: Destination(
    'Sign out',
    Icon(Icons.logout_outlined),
    Icon(Icons.logout),
  ),
)

The drawer automatically handles selection state and provides visual feedback through the indicator color and shape.

Inheritance

Constructors

NxCustomNavigationDrawer.new({required List<Destination> destinations, Key? key, dynamic onDestinationSelected(int)?, int? selectedIndex, Destination? signOutDestination, TextStyle? optionTextStyle, Widget? sequrifyButton, Color? backgroundColor, double? elevation, TextStyle? headerTextStyle, Color? shadowColor, Color? surfaceTintColor, Color? indicatorColor, ShapeBorder? indicatorShape})
Creates a Material 3 style navigation drawer.
const

Properties

backgroundColor Color?
Background color of the drawer.
final
destinations List<Destination>
The list of destinations to display in the drawer.
final
elevation double?
Z-coordinate at which to place the drawer relative to its parent.
final
hashCode int
The hash code for this object.
no setterinherited
headerTextStyle TextStyle?
Text style for the "Menu" header text.
final
indicatorColor Color?
Color of the selection indicator.
final
indicatorShape ShapeBorder?
Shape of the selection indicator.
final
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
onDestinationSelected → dynamic Function(int)?
Called when the user selects a destination.
final
optionTextStyle TextStyle?
Text style for the destination labels.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
selectedIndex int?
The index of the currently selected destination.
final
sequrifyButton Widget?
Optional widget shown above the sign-out option.
final
shadowColor Color?
Color of the drawer's shadow.
final
signOutDestination Destination?
Optional destination for the sign-out action.
final
surfaceTintColor Color?
Color used for surface tinting.
final

Methods

build(BuildContext context) Widget
Describes the part of the user interface represented by this widget.
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