buildTable method
- BuildMetadata node,
- TextStyleHtml tsh,
- TableMetadata table
Builds Table.
Implementation
Widget buildTable(
BuildMetadata node, TextStyleHtml tsh, TableMetadata table) {
final rows = <TableRow>[];
final slotIndices = <int>[];
final tableCols = table.cols;
final tableRows = table.rows;
for (var r = 0; r < tableRows; r++) {
final cells = List<Widget>(tableCols);
for (var c = 0; c < tableCols; c++) {
final index = table.getIndexAt(row: r, column: c);
if (index == -1 || slotIndices.contains(index)) {
cells[c] = widget0;
continue;
}
slotIndices.add(index);
cells[c] = TableCell(child: table.getWidgetAt(index));
}
if (cells.isEmpty) continue;
rows.add(TableRow(children: cells));
}
if (rows.isEmpty) return null;
final tableBorder = table.border != null
// TODO: support different styling for border sides
? TableBorder.symmetric(inside: table.border, outside: table.border)
: null;
return Table(border: tableBorder, children: rows);
}