NodeWidget<T> constructor

const NodeWidget<T>({
  1. Key? key,
  2. required Node<T> node,
  3. Widget? child,
  4. NodeShape? shape,
  5. List<Connection> connections = const [],
  6. void onPortTap(
    1. String nodeId,
    2. String portId,
    3. bool isOutput
    )?,
  7. void onPortHover(
    1. String nodeId,
    2. String portId,
    3. bool isHover
    )?,
  8. void onNodeTap(
    1. String nodeId
    )?,
  9. void onNodeDoubleTap(
    1. String nodeId
    )?,
  10. ({bool isOutput, String nodeId, String portId})? hoveredPortInfo,
  11. Color? backgroundColor,
  12. Color? selectedBackgroundColor,
  13. Color? borderColor,
  14. Color? selectedBorderColor,
  15. double? borderWidth,
  16. double? selectedBorderWidth,
  17. BorderRadius? borderRadius,
  18. EdgeInsets? padding,
})

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
  • onNodeTap - Callback when the node is tapped
  • onNodeDoubleTap - Callback when the node is double-tapped
  • hoveredPortInfo - Information about the currently hovered port
  • 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)

Implementation

const NodeWidget({
  super.key,
  required this.node,
  this.child,
  this.shape,
  this.connections = const [],
  this.onPortTap,
  this.onPortHover,
  this.onNodeTap,
  this.onNodeDoubleTap,
  this.hoveredPortInfo,
  this.backgroundColor,
  this.selectedBackgroundColor,
  this.borderColor,
  this.selectedBorderColor,
  this.borderWidth,
  this.selectedBorderWidth,
  this.borderRadius,
  this.padding,
});