paintEdgesBarPath method
void
paintEdgesBarPath(})
Implementation
void paintEdgesBarPath(
Canvas canvas,
Size size, {
required Paint edges,
required Offset centerLeft,
required Offset centerRight,
required double halfLineWidth,
}) {
if (style.borderRadius == 0) {
canvas.drawPath(
Path()
// LEFT EDGE
..addRect(
Rect.fromCenter(
center: centerLeft,
width: style.edgesSize,
height: size.height + style.lineWidth * 2,
),
)
// RIGTH EDGE
..addRect(
Rect.fromCenter(
center: centerRight,
width: style.edgesSize,
height: size.height + style.lineWidth * 2,
),
),
edges,
);
}
final Radius borderRadius = Radius.circular(style.borderRadius);
/// Left and right edges, with a reversed border radius on the inside of the rect
canvas.drawPath(
// LEFT EDGE
Path()
..fillType = PathFillType.evenOdd
..addRRect(
RRect.fromRectAndCorners(
Rect.fromLTWH(
centerLeft.dx - halfLineWidth,
-style.lineWidth,
style.edgeWidth + style.borderRadius,
size.height + style.lineWidth * 2,
),
topLeft: borderRadius,
bottomLeft: borderRadius,
),
)
..addRRect(
RRect.fromRectAndCorners(
Rect.fromLTWH(
centerLeft.dx + halfLineWidth,
0.0,
style.borderRadius,
size.height,
),
topLeft: borderRadius,
bottomLeft: borderRadius,
),
),
edges,
);
canvas.drawPath(
// RIGHT EDGE
Path()
..fillType = PathFillType.evenOdd
..addRRect(
RRect.fromRectAndCorners(
Rect.fromLTWH(
centerRight.dx - halfLineWidth - style.borderRadius,
-style.lineWidth,
style.edgeWidth + style.borderRadius,
size.height + style.lineWidth * 2,
),
topRight: borderRadius,
bottomRight: borderRadius,
),
)
..addRRect(
RRect.fromRectAndCorners(
Rect.fromLTWH(
centerRight.dx - halfLineWidth - style.borderRadius,
0.0,
style.borderRadius,
size.height,
),
topRight: borderRadius,
bottomRight: borderRadius,
),
),
edges,
);
}