GridStyle class abstract
Abstract base class for all grid styles.
Calculates common grid parameters once and delegates to paintGrid for style-specific rendering. This eliminates code duplication across grid styles.
Each grid style extends this class and implements paintGrid to render its specific pattern (lines, dots, crosses, etc.).
Example:
class MyGridStyle extends GridStyle {
const MyGridStyle({this.customSize = 5.0});
final double customSize;
@override
void paintGrid(
Canvas canvas,
NodeFlowTheme theme,
({double left, double top, double right, double bottom}) gridArea,
) {
// Calculate style-specific positions and render
final startX = (gridArea.left / theme.gridSize).floor() * theme.gridSize;
// ... custom grid painting logic here
}
}
Constructors
- GridStyle()
-
const
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
createGridPaint(
NodeFlowTheme theme) → Paint - Helper to create a base paint object with grid color and thickness.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
paint(
Canvas canvas, Size size, NodeFlowTheme theme, GraphViewport viewport) → void - Paints the grid pattern on the canvas.
-
paintGrid(
Canvas canvas, NodeFlowTheme theme, ({double bottom, double left, double right, double top}) gridArea) → void - Renders the style-specific grid pattern.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited