drawPattern method
Draws the pattern once at origin.
Implementation
@override
void drawPattern(Canvas canvas, Size size) {
final paint1 = Paint()
..color = foregroundColor
..style = PaintingStyle.fill;
final paint2 = Paint()
..color = secondaryColor
..style = PaintingStyle.fill;
// Top-left
canvas.drawRect(
Rect.fromLTWH(0, 0, squareSize, squareSize),
paint1,
);
// Top-right
canvas.drawRect(
Rect.fromLTWH(squareSize, 0, squareSize, squareSize),
paint2,
);
// Bottom-left
canvas.drawRect(
Rect.fromLTWH(0, squareSize, squareSize, squareSize),
paint2,
);
// Bottom-right
canvas.drawRect(
Rect.fromLTWH(squareSize, squareSize, squareSize, squareSize),
paint1,
);
}