setNeedsConnector method
void
setNeedsConnector(
[ - bool needs = false,
- double? width
])
Implementation
void setNeedsConnector([bool needs = false, double? width]) {
if (needs || (forceConnector ?? false)) {
needsConnector = true;
if (width != null) {
setConnectorWidth(width);
} else {
bounds = Rect.fromXYWH(
bounds.x,
bounds.y,
widthWithoutConnector + getConnectorWidth(),
bounds.height,
);
}
if (spans.isNotEmpty && spans.last != connectorSpan) {
spans.add(connectorSpan!);
}
} else {
connectorWidth = 0;
needsConnector = false;
bounds = Rect.fromXYWH(
bounds.x,
bounds.y,
widthWithoutConnector,
bounds.height,
);
final span = spans.isNotEmpty ? spans.removeLast() : null;
if (span != null && span != connectorSpan) {
spans.add(span);
}
}
}