GridStyle class

Styling for chart grid lines (major and optional minor).

Grid lines can be solid or dashed. Dash patterns follow Canvas API format.

Example:

final grid = GridStyle(
  majorColor: Colors.grey[300]!,
  majorWidth: 1.0,
  majorDashPattern: [5.0, 5.0], // 5px on, 5px off
  showMinor: true,
  minorColor: Colors.grey[200]!,
  minorWidth: 0.5,
);
Available extensions
Annotations
  • @ChartSurface.new(combinedSetters: [CombinedSetter('withMinorGrid', ['showMinor', 'minorColor', 'minorWidth'])])

Constructors

GridStyle({required Color majorColor, required double majorWidth, List<double> majorDashPattern = const [], Color? minorColor, double? minorWidth, List<double> minorDashPattern = const [], bool showMinor = false})
const

Properties

hashCode int
The hash code for this object.
no setteroverride
majorColor Color
Color of major grid lines.
final
majorDashPattern List<double>
Dash pattern for major grid lines. Empty list = solid line. Pattern format: [onLength, offLength, onLength, offLength, ...] Example: [5.0, 5.0] = 5px on, 5px off
final
majorWidth double
Width of major grid lines in pixels. Use 0.0 for no major grid.
final
minorColor Color?
Color of minor grid lines (if showMinor is true).
final
minorDashPattern List<double>
Dash pattern for minor grid lines. Empty list = solid line.
final
minorWidth double?
Width of minor grid lines in pixels.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
showMinor bool
Whether to show minor grid lines.
final

Methods

clearMinorColor() GridStyle

Available on GridStyle, provided by the GridStyleFluent extension

Clears GridStyle.minorColor to null.
clearMinorWidth() GridStyle

Available on GridStyle, provided by the GridStyleFluent extension

Clears GridStyle.minorWidth to null.
copyWith({Color? majorColor, double? majorWidth, List<double>? majorDashPattern, Color? minorColor, double? minorWidth, List<double>? minorDashPattern, bool? showMinor, bool clearMinorColor = false, bool clearMinorWidth = false}) GridStyle
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJson() Map<String, dynamic>
toString() String
A string representation of this object.
inherited
withMajorColor(Color value) GridStyle

Available on GridStyle, provided by the GridStyleFluent extension

Replaces GridStyle.majorColor with value.
withMajorDashPattern(List<double> value) GridStyle

Available on GridStyle, provided by the GridStyleFluent extension

Replaces GridStyle.majorDashPattern with value.
withMajorWidth(double value) GridStyle

Available on GridStyle, provided by the GridStyleFluent extension

Replaces GridStyle.majorWidth with value.
withMinorDashPattern(List<double> value) GridStyle

Available on GridStyle, provided by the GridStyleFluent extension

Replaces GridStyle.minorDashPattern with value.
withMinorGrid({required bool showMinor, required Color minorColor, required double minorWidth}) GridStyle

Available on GridStyle, provided by the GridStyleFluent extension

Replaces GridStyle.showMinor, GridStyle.minorColor, and GridStyle.minorWidth together.

Operators

operator ==(Object other) bool
The equality operator.
override

Static Methods

fromJson(Map<String, dynamic> json) GridStyle

Constants

colorblindFriendly → const GridStyle
corporateBlue → const GridStyle
defaultDark → const GridStyle
defaultLight → const GridStyle
highContrast → const GridStyle
minimal → const GridStyle
vibrant → const GridStyle