NodeItem class

A tree-view navigation and entity node item component for the Alter Design System.

Figma Specifications (Node 657:1758 - NodeItem):

  • Variants:
    • type: Ghost, Gray
    • state: Default, Hover, Selected
    • isCollapsible: True
    • isCollapsed: False, True
  • Properties:
    • label: Label text (defaults to "Label")
    • hasIcon: Toggle leading icon (defaults to true)
    • hasRightSlot: Toggle trailing action slot (defaults to false)
    • hasSpacerOne: Indentation spacer 1 (20x20px)
    • hasSpacerTwo: Indentation spacer 2 (20x20px)
  • Geometries:
    • Padding: Uniform 6px on all sides.
    • Gap: 4px between elements.
    • Border Radius: 10px.
    • Expanded Height: ~32px (6px + 20px + 6px).
    • Collapsed Dimensions: 32x32px square icon tile.
  • Tokens:
Inheritance

Constructors

NodeItem({Key? key, NodeItemType type = NodeItemType.ghost, String label = 'Label', bool isSelected = false, bool? isHovered, bool isCollapsed = false, bool isCollapsible = true, bool hasIcon = true, Widget? icon, IconData? iconData, bool hasRightSlot = false, Widget? rightSlot, bool hasSpacerOne = false, bool hasSpacerTwo = false, int indentationLevel = 0, VoidCallback? onTap, VoidCallback? onToggleCollapse, VoidCallback? onRightSlotTap})
Creates a NodeItem instance.
const

Properties

hashCode → int
The hash code for this object.
no setterinherited
hasIcon → bool
Whether to display the leading icon.
final
hasRightSlot → bool
Whether to show the trailing action slot.
final
hasSpacerOne → bool
Explicit flag to render the first 20px indent spacer.
final
hasSpacerTwo → bool
Explicit flag to render the second 20px indent spacer.
final
icon → Widget?
Custom icon widget or glyph displayed at the start of the node (20x20px).
final
iconData → IconData?
IconData shorthand for leading icon glyph. Used if icon is null.
final
indentationLevel → int
Convenience indentation level (0, 1, 2, ...), automatically setting indent spacers.
final
isCollapsed → bool
Whether the node item is currently collapsed into a compact icon tile.
final
isCollapsible → bool
Whether the node item supports collapse/expand behavior.
final
isHovered → bool?
Optional override for hover state (useful in testing/catalogs).
final
isSelected → bool
Whether the node is currently in a selected state.
final
key → Key?
Controls how one widget replaces another widget in the tree.
finalinherited
label → String
The text label displayed in the node item.
final
onRightSlotTap → VoidCallback?
Callback executed specifically when tapping the default trailing action slot.
final
onTap → VoidCallback?
Primary callback executed when the node item is tapped.
final
onToggleCollapse → VoidCallback?
Callback executed when toggling collapse or tapping the trailing collapse chevron.
final
rightSlot → Widget?
Custom widget displayed in the trailing action slot. Defaults to a ButtonIconGhost with Icons.expand_more when null and hasRightSlot is true.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
type → NodeItemType
The visual style variant of the node item.
final

Methods

createElement() → StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() → State<NodeItem>
Creates the mutable state for this widget at a given location in the tree.
override
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

Constants

version → const String
Component version for reference.