ConnectionStyleOverrides class

Defines style overrides for a connection at the widget level.

ConnectionStyleOverrides allows customizing the appearance of individual connections without modifying the connection model or theme. These overrides are resolved at render time via a callback.

Usage

Provide a connectionStyleResolver callback to NodeFlowEditor:

NodeFlowEditor(
  connectionStyleResolver: (connection) {
    if (connection.data?['type'] == 'error') {
      return ConnectionStyleOverrides(
        color: Colors.red,
        selectedColor: Colors.red.shade700,
        strokeWidth: 3.0,
      );
    }
    return null; // Use theme defaults
  },
)

Override Cascade

Colors and styles are resolved in this order of precedence:

  1. Widget-level overrides from connectionStyleResolver (if provided)
  2. Theme colors (from ConnectionTheme)

Constructors

ConnectionStyleOverrides({Color? color, Color? selectedColor, double? strokeWidth, double? selectedStrokeWidth})
Creates connection style overrides.
const

Properties

color Color?
Override for the connection color when not selected.
final
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
selectedColor Color?
Override for the connection color when selected.
final
selectedStrokeWidth double?
Override for the connection stroke width when selected.
final
strokeWidth double?
Override for the connection stroke width when not selected.
final

Methods

copyWith({Color? color, Color? selectedColor, double? strokeWidth, double? selectedStrokeWidth}) ConnectionStyleOverrides
Creates a copy of this instance with the given fields replaced.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

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