paint method
Paints the grid pattern on the canvas.
Calculates common parameters (visible area, grid area) once, then calls paintGrid for style-specific rendering.
Parameters:
canvas: The canvas to paint onsize: The size of the canvastheme: Theme containing grid configuration (size, color, thickness)viewport: Current viewport transformation (pan and zoom)
Implementation
void paint(
Canvas canvas,
Size size,
NodeFlowTheme theme,
GraphViewport viewport,
) {
final gridSize = theme.gridTheme.size;
if (gridSize <= 0) return;
// Calculate common parameters once
final visibleArea = _calculateVisibleArea(viewport, size);
final gridArea = _calculateGridArea(visibleArea, gridSize);
// Delegate to style-specific implementation
paintGrid(canvas, theme, gridArea);
}