createSegments method
({List<PathSegment> segments, Offset start})
createSegments(
- ConnectionPathParameters params
override
Creates segments for this connection, using control points if available.
This method is the main entry point called by the rendering system. It delegates to either:
- createSegmentsThroughWaypoints if control points are provided
- createDefaultSegments if no control points exist
Implementation
@override
({Offset start, List<PathSegment> segments}) createSegments(
ConnectionPathParameters params,
) {
if (params.controlPoints.isNotEmpty) {
// Manual mode: use control points as waypoints
// IMPORTANT: Include start and end points in the waypoints list
final waypoints = createWaypointsWithEnds(params.controlPoints, params);
return createSegmentsThroughWaypoints(waypoints, params);
} else if (!requiresControlPoints) {
// Algorithmic mode: use default segment creation
return createDefaultSegments(params);
} else {
// Style requires control points but none provided
// Fall back to simple straight line
return (
start: params.start,
segments: [StraightSegment(end: params.end)],
);
}
}