CanvasBarStack constructor
CanvasBarStack(})
Implementation
factory CanvasBarStack(
List<CanvasRect> segments, {
int? radius,
int stackedBarPadding = 1,
bool roundTopLeft = false,
bool roundTopRight = false,
bool roundBottomLeft = false,
bool roundBottomRight = false,
}) {
final firstBarBounds = segments.first.bounds;
// Find the rectangle that would represent the full stack of bars.
var left = firstBarBounds.left;
var top = firstBarBounds.top;
var right = firstBarBounds.right;
var bottom = firstBarBounds.bottom;
for (var barIndex = 1; barIndex < segments.length; barIndex++) {
final bounds = segments[barIndex].bounds;
left = min(left, bounds.left);
top = min(top, bounds.top);
right = max(right, bounds.right);
bottom = max(bottom, bounds.bottom);
}
final width = right - left;
final height = bottom - top;
final fullStackRect = Rectangle(left, top, width, height);
return CanvasBarStack._internal(
segments,
radius: radius,
stackedBarPadding: stackedBarPadding,
roundTopLeft: roundTopLeft,
roundTopRight: roundTopRight,
roundBottomLeft: roundBottomLeft,
roundBottomRight: roundBottomRight,
fullStackRect: fullStackRect,
);
}