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

Segment Creation Strategy

Editable path styles support two modes:

  1. Algorithmic mode (no control points): Uses the default segment algorithm
  2. Manual mode (with control points): Creates segments through user-defined waypoints

Implementation Requirements

Concrete subclasses must implement:

Example

class EditableSmoothStepConnectionStyle extends EditablePathConnectionStyle {
  @override
  String get id => 'editable-smoothstep';

  @override
  String get displayName => 'Editable Smooth Step';

  @override
  ({Offset start, List<PathSegment> segments}) createSegmentsThroughWaypoints(
    List<Offset> waypoints,
    ConnectionPathParameters params,
  ) {
    // Generate smooth step segments through waypoints with rounded corners
    return _generateSmoothSegments(waypoints, params.cornerRadius);
  }
}
Inheritance
Implementers
Available extensions

Constructors

EditablePathConnectionStyle()
const

Properties

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
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 style
no setter
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

buildHitTestPath(List<Rect> rects) Path
Builds a hit test path from rectangle bounds.
inherited
buildHitTestRects(Offset start, List<PathSegment> segments, double tolerance) List<Rect>
Builds hit test rectangles from segments.
inherited
buildPath(Offset start, List<PathSegment> segments) Path
Builds a Path from segments.
inherited
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.
createDefaultSegments(ConnectionPathParameters params) → ({List<PathSegment> segments, Offset start})
Creates the default algorithmic segments when no control points are provided.
createPathThroughWaypoints(List<Offset> waypoints, ConnectionPathParameters params) Path
Creates a path through the given waypoints.
createSegments(ConnectionPathParameters params) → ({List<PathSegment> segments, Offset start})
Creates segments for this connection, using control points if available.
override
createSegmentsThroughWaypoints(List<Offset> waypoints, ConnectionPathParameters params) → ({List<PathSegment> segments, Offset start})
Creates segments through the given waypoints.
createWaypointsWithEnds(List<Offset> controlPoints, ConnectionPathParameters params) List<Offset>
Helper method to create waypoints including start and end points.
extractBendPoints(Offset start, List<PathSegment> segments) List<Offset>
Extracts bend points from segments.
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