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({required ConnectionStyle style, required Color color, required Color selectedColor, required double strokeWidth, required double selectedStrokeWidth, List<
double> ? dashPattern, required ConnectionEndPoint startPoint, required ConnectionEndPoint endPoint, required Color endpointColor, required Color endpointBorderColor, required double endpointBorderWidth, ConnectionEffect? animationEffect, required double bezierCurvature, required double cornerRadius, required double portExtension, required double hitTolerance, double startGap = 0.0, double endGap = 0.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
- endGap → double
-
Gap between the target port and the end endpoint in logical pixels.
final
- endPoint → ConnectionEndPoint
-
Endpoint marker for the connection end (target).
final
- endpointBorderColor → Color
-
Border color for endpoint markers.
final
- endpointBorderWidth → double
-
Border width for endpoint markers in logical pixels.
final
- endpointColor → Color
-
Fill color for endpoint markers.
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
- startGap → double
-
Gap between the source port and the start endpoint 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, Color? endpointColor, Color? endpointBorderColor, double? endpointBorderWidth, ConnectionEffect? animationEffect, double? bezierCurvature, double? cornerRadius, double? portExtension, double? hitTolerance, double? startGap, double? endGap}) → 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.