draw method

void draw(
  1. Canvas canvas,
  2. Size size, {
  3. required Background background,
  4. required Offset cameraOffset,
  5. required double gridStrokeWidth,
})

Implementation

void draw(
  Canvas canvas,
  Size size, {
  required Background background,
  required Offset cameraOffset,
  required double gridStrokeWidth,
}) {
  final key = _StaticLayerKey(
    size: size,
    backgroundColor: background.color,
    gridEnabled: background.grid.isEnabled,
    gridCellSize: background.grid.cellSize,
    gridColor: background.grid.color,
    gridStrokeWidth: gridStrokeWidth,
    cameraOffset: cameraOffset,
  );

  if (_picture == null || _key != key) {
    _disposePictureIfNeeded();
    _key = key;
    _picture = _recordPicture(
      size,
      background,
      cameraOffset,
      gridStrokeWidth,
    );
    _debugBuildCount += 1;
  }

  canvas.drawPicture(_picture!);
}