ConnectionTheme class
Defines the visual styling and behavior of connections in the node flow.
ConnectionTheme centralizes all visual properties for connections including colors, stroke widths, endpoint markers, animation settings, and geometric parameters like curvature and corner radius.
Usage Example
const theme = ConnectionTheme(
color: Colors.grey,
selectedColor: Colors.blue,
strokeWidth: 2.0,
selectedStrokeWidth: 3.0,
endPoint: ConnectionEndPoint.triangle,
bezierCurvature: 0.5,
);
Predefined Themes
- ConnectionTheme.light: Optimized for light backgrounds
- ConnectionTheme.dark: Optimized for dark backgrounds
See also:
- ConnectionEndPoint for endpoint marker configuration
- NodeFlowTheme for overall theme configuration
Constructors
-
ConnectionTheme({ConnectionStyle style = ConnectionStyles.smoothstep, Color color = Colors.grey, Color selectedColor = Colors.blue, double strokeWidth = 2.0, double selectedStrokeWidth = 3.0, List<
double> ? dashPattern, ConnectionEndPoint startPoint = ConnectionEndPoint.none, ConnectionEndPoint endPoint = ConnectionEndPoint.capsuleHalf, ConnectionEffect? animationEffect, double bezierCurvature = 0.3, double cornerRadius = 4.0, double portExtension = 20.0, double hitTolerance = 8.0}) -
Creates a connection theme with the specified visual properties.
const
Properties
- animationEffect → ConnectionEffect?
-
Optional default animation effect for all connections.
final
- bezierCurvature → double
-
Curvature factor for bezier-style connections.
final
- color → Color
-
Default color for unselected connections.
final
- cornerRadius → double
-
Radius for rounded corners in step-style connections.
final
-
dashPattern
→ List<
double> ? -
Optional dash pattern for dashed lines.
final
- endPoint → ConnectionEndPoint
-
Endpoint marker for the connection end (target).
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- hitTolerance → double
-
Distance tolerance for hit testing in logical pixels.
final
- portExtension → double
-
Distance connections extend straight from ports before curving.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- selectedColor → Color
-
Color for selected connections.
final
- selectedStrokeWidth → double
-
Stroke width for selected connections in logical pixels.
final
- startPoint → ConnectionEndPoint
-
Endpoint marker for the connection start (source).
final
- strokeWidth → double
-
Stroke width for unselected connections in logical pixels.
final
- style → ConnectionStyle
-
The connection line style (bezier, smoothstep, straight, etc.).
final
Methods
-
copyWith(
{ConnectionStyle? style, Color? color, Color? selectedColor, double? strokeWidth, double? selectedStrokeWidth, List< double> ? dashPattern, ConnectionEndPoint? startPoint, ConnectionEndPoint? endPoint, ConnectionEffect? animationEffect, double? bezierCurvature, double? cornerRadius, double? portExtension, double? hitTolerance}) → ConnectionTheme - Creates a copy of this theme with optionally updated properties.
-
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
Constants
- dark → const ConnectionTheme
- Predefined dark theme optimized for dark backgrounds.
- light → const ConnectionTheme
- Predefined light theme optimized for light backgrounds.