EditableSmoothStepConnectionStyle class
An editable connection style that creates smooth step paths with rounded corners.
This style maintains the 90-degree turn characteristic of smooth step connections while allowing users to customize the path by adding, moving, or removing control points. The path is rendered as a series of horizontal and vertical segments with smoothly rounded corners.
Features
- Editable flat edges: Users can tweak the horizontal and vertical segments
- Add control points: Insert intermediate waypoints along the path
- Maintain orthogonal routing: All segments remain horizontal or vertical
- Smooth corners: Configurable corner radius for rounded turns
Path Behavior
Without Control Points (Algorithmic Mode)
Uses the standard smooth step algorithm to automatically calculate an optimal path between the source and target ports based on their positions.
With Control Points (Manual Mode)
Creates a path that passes through all control points while maintaining the smooth step visual style (90-degree turns with rounded corners).
Usage Example
// Create a connection with editable smooth step style
final connection = Connection(
id: 'conn-1',
sourceNodeId: 'node-a',
sourcePortId: 'output-1',
targetNodeId: 'node-b',
targetPortId: 'input-1',
style: editableSmoothStepStyle,
controlPoints: [
Offset(150, 100), // First bend point
Offset(150, 200), // Second bend point
],
);
See also:
- EditablePathConnectionStyle for the base editable path functionality
- SmoothstepPathCalculator for the underlying path algorithm
- Inheritance
-
- Object
- ConnectionStyle
- EditablePathConnectionStyle
- EditableSmoothStepConnectionStyle
- Available extensions
Constructors
- EditableSmoothStepConnectionStyle({double defaultCornerRadius = 8.0})
-
Creates an editable smooth step connection style.
const
Properties
- bendThreshold → double
-
Get bend detection threshold angle in radians
Used for detecting significant direction changes in the path
no setterinherited
- defaultCornerRadius → double
-
The default corner radius for rounded corners
final
- defaultHitTolerance → double
-
Default hit tolerance for this connection style
Some styles may need different tolerances based on their geometry
no setterinherited
- displayName → String
-
Human-readable display name
no setteroverride
- hasExactBendPoints → bool
-
Whether this connection style has predictable bend points that can be calculated exactly
no setteroverride
- hashCode → int
-
The hash code for this object.
no setteroverride
- id → String
-
Unique identifier for this connection style
no setteroverride
- isBuiltIn → bool
-
Available on ConnectionStyle, provided by the ConnectionStyleExtension extension
Check if this is a built-in connection styleno setter - minBendDistance → double
-
Get minimum distance between bend points as multiplier of tolerance
no setterinherited
- needsBendDetection → bool
-
Whether this connection style needs bend detection for hit testing optimization
no setterinherited
- requiresControlPoints → bool
-
Whether this style requires control points to function.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
calculatePointAtPosition(
Path path, double position) → Offset? -
Calculates the position along a path for inserting new control points.
inherited
-
createDefaultPath(
ConnectionPathParameters params) → Path -
Creates the default algorithmic path when no control points are provided.
override
-
createHitTestPath(
Path originalPath, double tolerance, {ConnectionPathParameters? pathParams}) → Path -
Creates an expanded path for hit testing
The base implementation provides a simple stroke-based expansion
inherited
-
createPath(
ConnectionPathParameters params) → Path -
Creates a path for this connection, using control points if available.
inherited
-
createPathThroughWaypoints(
List< Offset> waypoints, ConnectionPathParameters params) → Path -
Creates a path through the given waypoints.
override
-
createWaypointsWithEnds(
List< Offset> controlPoints, ConnectionPathParameters params) → List<Offset> -
Helper method to create waypoints including start and end points.
inherited
-
getExactBendPoints(
ConnectionPathParameters params) → List< Offset> ? -
Get exact bend points for styles that support it (e.g., step connections)
Returns null if the style doesn't support exact bend point calculation
override
-
getSampleCount(
double pathLength) → int -
Get number of samples to use for bend detection based on path length
inherited
-
isEquivalentTo(
ConnectionStyle other) → bool -
Check if two connection styles are equivalent
This is used for caching decisions and theme comparisons
inherited
-
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.
override