NodeWidget<T> constructor
const
NodeWidget<T> ({
- Key? key,
- required Node<
T> node, - required NodeFlowController<
T> controller, - Widget? child,
- NodeShape? shape,
- List<
Connection> connections = const [], - void onPortTap()?,
- void onPortHover()?,
- void onPortContextMenu()?,
- Color? backgroundColor,
- Color? selectedBackgroundColor,
- Color? borderColor,
- Color? selectedBorderColor,
- double? borderWidth,
- double? selectedBorderWidth,
- BorderRadius? borderRadius,
- EdgeInsets? padding,
- PortBuilder<
T> ? portBuilder, - VoidCallback? onTap,
- VoidCallback? onDoubleTap,
- void onContextMenu(
- Offset globalPosition
- VoidCallback? onMouseEnter,
- VoidCallback? onMouseLeave,
- double portSnapDistance = 8.0,
Creates a node widget with optional custom content.
Parameters:
node- The node data model to renderchild- Optional custom widget to display as node contentshape- Optional shape for the node (renders shaped node instead of rectangle)connections- List of connections for determining port connection stateonPortTap- Callback when a port is tappedonPortHover- Callback when a port is hoveredbackgroundColor- 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 widgetsonTap- Callback when node is tappedonDoubleTap- Callback when node is double-tappedonContextMenu- Callback when node is right-clickedonMouseEnter- Callback when mouse enters nodeonMouseLeave- Callback when mouse leaves nodecontroller- 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,
});