NodeWidget<T> constructor

const NodeWidget<T>({
  1. Key? key,
  2. required Node<T> node,
  3. required NodeFlowController<T> controller,
  4. Widget? child,
  5. NodeShape? shape,
  6. List<Connection> connections = const [],
  7. void onPortTap(
    1. String nodeId,
    2. String portId,
    3. bool isOutput
    )?,
  8. void onPortHover(
    1. String nodeId,
    2. String portId,
    3. bool isHover
    )?,
  9. void onPortContextMenu(
    1. String nodeId,
    2. String portId,
    3. bool isOutput,
    4. Offset globalPosition,
    )?,
  10. Color? backgroundColor,
  11. Color? selectedBackgroundColor,
  12. Color? borderColor,
  13. Color? selectedBorderColor,
  14. double? borderWidth,
  15. double? selectedBorderWidth,
  16. BorderRadius? borderRadius,
  17. EdgeInsets? padding,
  18. PortBuilder<T>? portBuilder,
  19. VoidCallback? onTap,
  20. VoidCallback? onDoubleTap,
  21. void onContextMenu(
    1. Offset globalPosition
    )?,
  22. VoidCallback? onMouseEnter,
  23. VoidCallback? onMouseLeave,
  24. double portSnapDistance = 8.0,
})

Creates a node widget with optional custom content.

Parameters:

  • node - The node data model to render
  • child - Optional custom widget to display as node content
  • shape - Optional shape for the node (renders shaped node instead of rectangle)
  • connections - List of connections for determining port connection state
  • onPortTap - Callback when a port is tapped
  • onPortHover - Callback when a port is hovered
  • backgroundColor - Custom background color (overrides theme)
  • selectedBackgroundColor - Custom selected background color (overrides theme)
  • borderColor - Custom border color (overrides theme)
  • selectedBorderColor - Custom selected border color (overrides theme)
  • borderWidth - Custom border width (overrides theme)
  • selectedBorderWidth - Custom selected border width (overrides theme)
  • borderRadius - Custom border radius (overrides theme)
  • padding - Custom padding (overrides theme)
  • portBuilder - Optional builder for customizing port widgets
  • onTap - Callback when node is tapped
  • onDoubleTap - Callback when node is double-tapped
  • onContextMenu - Callback when node is right-clicked
  • onMouseEnter - Callback when mouse enters node
  • onMouseLeave - Callback when mouse leaves node
  • controller - Controller for direct drag handling (required)

Implementation

const NodeWidget({
  super.key,
  required this.node,
  required this.controller,
  this.child,
  this.shape,
  this.connections = const [],
  this.onPortTap,
  this.onPortHover,
  this.onPortContextMenu,
  this.backgroundColor,
  this.selectedBackgroundColor,
  this.borderColor,
  this.selectedBorderColor,
  this.borderWidth,
  this.selectedBorderWidth,
  this.borderRadius,
  this.padding,
  this.portBuilder,
  this.onTap,
  this.onDoubleTap,
  this.onContextMenu,
  this.onMouseEnter,
  this.onMouseLeave,
  this.portSnapDistance = 8.0,
});