draw method
void
draw(
- Canvas canvas,
- Size size, {
- required Background background,
- required Offset cameraOffset,
- 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!);
}