paint method Null safety

void paint(
  1. Canvas c,
  2. BPTablePainter p,
  3. {required bool drawLine}
)

Implementation

void paint(Canvas c, BPTablePainter p, {required bool drawLine}) {
  double x = panel.thickLineWidth;
  final double textUp = panel.textUp;
  c.translate(0, -textUp);
  final double bottomY = heightMM - panel.thinLineWidth;
  Offset bottomStart = Offset(0, bottomY);
  for (int i = 0; i < cells.length; i++) {
    final cell = cells[i];
    cell.paint(c, p, x, p.columnWidths[i]);
    if (cell.eraseBottom && drawLine) {
      c.drawLine(bottomStart, Offset(x + 1, bottomY), p.thinLine);
      x += p.columnWidths[i] + panel.thinLineWidth;
      bottomStart = Offset(x - 1, bottomY);
    } else {
      x += p.columnWidths[i] + panel.thinLineWidth;
    }
  }
  if (!drawLastTwoColumnsBottomLine) {
    x -= p.columnWidths[cells.length - 1] +
        p.columnWidths[cells.length - 2] +
        2 * panel.thinLineWidth;
  } else {
    x += panel.thickLineWidth - panel.thinLineWidth;
  }
  c.translate(0, textUp);
  if (drawLine) {
    c.drawLine(bottomStart, Offset(x, bottomY), p.thinLine);
  }
}