paintCellBackground method

void paintCellBackground(
  1. Canvas canvas,
  2. Offset offset,
  3. CellData cellData
)

Paints the background of a cell represented by cellData to canvas at offset.

Implementation

@pragma('vm:prefer-inline')
void paintCellBackground(Canvas canvas, Offset offset, CellData cellData) {
  late Color color;
  final colorType = cellData.background & CellColor.typeMask;

  if (cellData.flags & CellFlags.inverse != 0) {
    color = resolveForegroundColor(cellData.foreground);
  } else if (colorType == CellColor.normal) {
    return;
  } else {
    color = resolveBackgroundColor(cellData.background);
  }

  final paint = Paint()..color = color;
  final doubleWidth = cellData.content >> CellContent.widthShift == 2;
  final widthScale = doubleWidth ? 2 : 1;
  final size = Size(_cellSize.width * widthScale + 1, _cellSize.height);
  canvas.drawRect(offset & size, paint);
}