toPdfWidget method

Future<Table> toPdfWidget(
  1. List<Widget> children
)

Converts the Table to a pw.Table.

Implementation

Future<pw.Table> toPdfWidget(List<pw.Widget> children) async => pw.Table(
      border: border?.toPdfTableBorder(),
      columnWidths:
          columnWidths?.map((int key, TableColumnWidth value) => MapEntry(
                key,
                value.toPdfTableColumnWidth(),
              )),
      defaultColumnWidth: defaultColumnWidth.toPdfTableColumnWidth(),
      defaultVerticalAlignment:
          defaultVerticalAlignment.toPdfTableCellVerticalAlignment(),
      children: [
        for (int i = 0; i < this.children.length; i++)
          pw.TableRow(
            decoration: await (this.children[i].decoration as BoxDecoration?)
                ?.toPdfBoxDecoration(),
            children: children
                .getRange(
                  i * (children.length ~/ this.children.length),
                  (i + 1) * (children.length ~/ this.children.length),
                )
                .toList(),
          ),
      ],
    );