paint method

void paint(
  1. PrinterCanvas canvas,
  2. PrinterOffset offset,
  3. PrinterSize size,
  4. int rowCount,
  5. int columnCount,
  6. List<TableCellData> cells,
)

Implementation

void paint(PrinterCanvas canvas, PrinterOffset offset, PrinterSize size, int rowCount,
    int columnCount, List<TableCellData> cells) {
  for (var i = 0; i < cells.length; i++) {
    final cell = cells[i];
    if (horizontalInside != null) {
      if (cell.rowIndex! < rowCount - 1) {
        var x = cell.offset!.x;
        var y = cell.offset!.y! + cell.size!.height!;
        canvas.drawLine(offset.translate(x!, y),
            PrinterSize(cell.size!.width, horizontalInside!.toDouble()));
      }
    }
    if (verticalInside != null) {
      if (cell.columnIndex! < columnCount - 1) {
        var x = cell.offset!.x! + cell.size!.width!;
        var y = cell.offset!.y;
        canvas.drawLine(offset.translate(x, y!),
            PrinterSize(verticalInside!.toDouble(), cell.size!.height));
      }
    }
  }

  if (top != null) {
    canvas.drawLine(offset, PrinterSize(size.width, top!.toDouble()));
  }

  if (left != null) {
    canvas.drawLine(offset, PrinterSize(left!.toDouble(), size.width));
  }

  if (bottom != null) {
    canvas.drawLine(offset.translate(0, size.height!),
        PrinterSize(size.width, bottom!.toDouble()));
  }

  if (right != null) {
    canvas.drawLine(
        offset.translate(size.width!, 0), PrinterSize(right!.toDouble(), size.height));
    canvas.drawLine(offset, PrinterSize(size.width, top!.toDouble()));
  }
}