Destination class

A model class representing a navigation destination in a drawer or navigation bar.

Each destination consists of:

  • A label displayed next to or below the icon
  • An icon shown when the destination is not selected
  • A selectedIcon shown when the destination is selected

Example usage:

final destinations = [
  Destination(
    'Profile',
    profileOutlinedIcon,  // Unselected state icon
    profileFilledIcon,    // Selected state icon
  ),
  Destination(
    'Settings',
    settingsOutlinedIcon,
    settingsFilledIcon,
  ),
];

This class is designed to work with NavigationDrawer. The icons typically form a pair where one is the outlined version and the other is the filled version of the same icon.

Example usage with NavigationDrawer:

final destinations = [
  Destination(
    'Profile',
    Icon(Icons.person_outline),  // Outlined version for unselected state
    Icon(Icons.person),         // Filled version for selected state
  ),
  Destination(
    'Settings',
    Icon(Icons.settings_outlined),
    Icon(Icons.settings),
  ),
];

NavigationDrawer(
  destinations: destinations.map((d) =>
    NavigationDrawerDestination(
      icon: d.icon,
      selectedIcon: d.selectedIcon,
      label: Text(d.label),
    ),
  ).toList(),
)

Common icon pairs:

Constructors

Destination(String label, Widget icon, Widget selectedIcon)
Creates a new navigation destination.
const

Properties

hashCode → int
The hash code for this object.
no setterinherited
icon → Widget
The icon displayed when this destination is not selected.
final
label → String
The text label displayed for this destination.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
selectedIcon → Widget
The icon displayed when this destination is selected.
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

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