EditablePathConnectionStyle class abstract
Abstract base class for connection styles that support interactive editing of connection paths through control points.
This class extends ConnectionStyle to add support for user-defined waypoints (control points) that allow customization of the connection path. Concrete implementations define how paths are created through these waypoints.
Control Points
Control points are intermediate waypoints through which the connection path should pass. They are stored in the Connection.controlPoints list and allow users to:
- Add extra bends to the connection
- Move existing bends to customize the path
- Remove waypoints to simplify the path
Path Creation Strategy
Editable path styles support two modes:
- Algorithmic mode (no control points): Uses the default path algorithm
- Manual mode (with control points): Creates path through user-defined waypoints
Implementation Requirements
Concrete subclasses must implement:
- createPathThroughWaypoints: How to create a path through control points
- Optionally override requiresControlPoints if the style only works in manual mode
Example
class EditableSmoothStepConnectionStyle extends EditablePathConnectionStyle {
@override
String get id => 'editable-smoothstep';
@override
String get displayName => 'Editable Smooth Step';
@override
Path createPathThroughWaypoints(
List<Offset> waypoints,
ConnectionPathParameters params,
) {
// Generate smooth step path through waypoints with rounded corners
return _generateSmoothPath(waypoints, params.cornerRadius);
}
}
- Inheritance
-
- Object
- ConnectionStyle
- EditablePathConnectionStyle
- Implementers
- Available extensions
Constructors
- EditablePathConnectionStyle()
-
const
Properties
- bendThreshold → double
-
Get bend detection threshold angle in radians
Used for detecting significant direction changes in the path
no setterinherited
- 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 setterinherited
- hasExactBendPoints → bool
-
Whether this connection style has predictable bend points that can be calculated exactly
no setterinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- id → String
-
Unique identifier for this connection style
no setterinherited
- 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 setter
- 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.
-
createDefaultPath(
ConnectionPathParameters params) → Path - Creates the default algorithmic path when no control points are provided.
-
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.
override
-
createPathThroughWaypoints(
List< Offset> waypoints, ConnectionPathParameters params) → Path - Creates a path through the given waypoints.
-
createWaypointsWithEnds(
List< Offset> controlPoints, ConnectionPathParameters params) → List<Offset> - Helper method to create waypoints including start and end points.
-
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
inherited
-
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.
inherited