getCheckboxDecoration function
Returns the pw.BoxDecoration
for the given Checkbox.
Implementation
pw.BoxDecoration getCheckboxDecoration(Checkbox checkbox) {
final pw.Border defaultBorder = pw.Border.all(
color: checkbox.side?.color.toPdfColor() ?? PdfColors.black,
width: checkbox.side?.width ?? 1.0,
style: checkbox.side?.style.toPdfBorderStyle() ?? pw.BorderStyle.solid,
);
switch (checkbox.shape.runtimeType) {
case RoundedRectangleBorder:
return pw.BoxDecoration(
color: checkbox.fillColor?.resolve({})?.toPdfColor(),
borderRadius: ((checkbox.shape as RoundedRectangleBorder).borderRadius
as BorderRadius)
.toPdfBorderRadius(),
border: defaultBorder,
);
case CircleBorder:
return pw.BoxDecoration(
shape: pw.BoxShape.circle,
color: checkbox.fillColor?.resolve({})?.toPdfColor(),
border: defaultBorder,
);
default:
return pw.BoxDecoration(border: defaultBorder);
}
}