toPdfWidget method

FlatButton toPdfWidget(
  1. Widget child
)

Converts the ButtonStyleButton to a pw.FlatButton.

Implementation

pw.FlatButton toPdfWidget(pw.Widget child) => pw.FlatButton(
      name: hashCode.toString(),
      textColor: style?.foregroundColor?.resolve({})?.toPdfColor() ??
          PdfColors.white,
      decoration: pw.BoxDecoration(
        border: style?.side?.resolve({}) != null
            ? pw.Border.fromBorderSide(
                style!.side!.resolve({})!.toPdfBorderSide())
            : null,
        color: style?.backgroundColor?.resolve({})?.toPdfColor() ??
            const PdfColor(0.2, 0.4, 0.4, 0.1)
                .flatten(background: PdfColors.white),
        shape: style?.shape != null
            ? style!.shape!.resolve({})!.toPdfBoxShape()
            : pw.BoxShape.rectangle,
        borderRadius: style?.shape?.resolve({})?.toPdfBorderRadius(),
      ),
      padding:
          (style?.padding?.resolve({}) as EdgeInsets?)?.toPdfEdgeInsets() ??
              const pw.EdgeInsets.all(4.0),
      child: child,
    );