PortWidget class

Widget for rendering a port on a node.

The PortWidget displays a port with its shape, color, and optional label. It supports property overrides at both widget and model levels.

Property Cascade (lowest to highest priority)

Properties are resolved in this order of precedence:

  1. Theme values (from PortTheme) - lowest priority
  2. Widget-level overrides (constructor parameters)
  3. Model-level values (from Port) - highest priority

For example, port size is resolved as:

  • port.size (if different from default) → widget sizetheme.size

Example with overrides:

PortWidget(
  port: myPort, // port.size = 12.0 takes precedence
  theme: PortTheme.light,
  color: Colors.blue, // Override idle color
  connectedColor: Colors.green, // Override connected color
)
Inheritance
Available extensions

Constructors

PortWidget({Key? key, required Port port, required PortTheme theme, bool isConnected = false, ValueChanged<Port>? onTap, ValueChanged<(Port, bool)>? onHover, bool isHighlighted = false, Size? size, Color? color, Color? connectedColor, Color? snappingColor, Color? borderColor, Color? highlightBorderColor, double? borderWidth, double? highlightBorderWidthDelta})
const

Properties

borderColor Color?
Override for the border color.
final
borderWidth double?
Override for the border width.
final
color Color?
Override for the idle port color.
final
connectedColor Color?
Override for the connected port color.
final
hashCode int
The hash code for this object.
no setterinherited
highlightBorderColor Color?
Override for the highlight border color.
final
highlightBorderWidthDelta double?
Override for the additional highlight border width.
final
isConnected bool
final
isHighlighted bool
final
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
onHover ValueChanged<(Port, bool)>?
final
onTap ValueChanged<Port>?
final
port Port
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
size Size?
Override for the port size. Resolution: port.size → widget.size → theme.size
final
snappingColor Color?
Override for the snapping (drag-over) port color.
final
theme PortTheme
final

Methods

build(BuildContext context) Widget
Describes the part of the user interface represented by this widget.
override
createElement() StatelessElement
Creates a StatelessElement to manage this widget's location in the tree.
inherited
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
withAnnotationLayer(NodeFlowController<T> controller) Widget

Available on Widget, provided by the AnnotationLayerSupport extension

Wraps this widget with an annotation layer.

Operators

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