buildStrokes function
Implementation
List<Widget> buildStrokes(BaseNode node, ScopedValues scopedValues) {
if (node is! GeometryMixin || node.strokeWeight <= 0) {
return [];
}
final List<Widget> strokeWidgets = [];
for (final paint in node.strokes.where((paint) => paint.visible)) {
final paintValue = PropertyValueDelegate.getPropertyValue<PaintModel>(
node,
'stroke-paint-${paint.id}',
scopedValues: scopedValues,
);
if (node.dashPattern.isEmpty) {
strokeWidgets.add(
Positioned.fill(
child: DecoratedBox(
decoration: BoxDecoration(
borderRadius: getBorderRadius(node),
border: Border.all(
strokeAlign: node.strokeAlign.alignment,
color: (paintValue ?? paint).toFlutterColor()!,
width: node.strokeWeight,
),
),
),
),
);
} else {
strokeWidgets.add(
Positioned.fill(
child: CustomPaint(
painter: StrokePainter(
color: (paintValue ?? paint).toFlutterColor()!,
borderRadius: getBorderRadius(node) ?? BorderRadius.zero,
dashPattern: node.dashPattern,
strokeWidth: node.strokeWeight,
strokeMiterLimit: node.strokeMiterLimit,
strokeCap: node.strokeCap,
strokeAlign: node.strokeAlign,
strokeSide: node.strokeSide,
boxShape: getBoxShape(node),
),
),
),
);
}
}
return strokeWidgets;
}