ChartsConfig class

Optional configuration shared by all chart widgets.

Use ChartsConfig to set theme, visual effects, empty/error UI, and shadows in one place. When passed to a chart, config values override the chart's individual parameters when provided.

All parameters are optional. Omitted values fall back to the chart's own parameters or defaults.

Example

final config = ChartsConfig(
  theme: ChartTheme.light(),
  useGlassmorphism: true,
  emptyMessage: 'No data yet',
  errorMessage: 'Something went wrong',
);

LineChartWidget(
  dataSets: dataSets,
  config: config,
)

See also:

  • ChartTheme for theme configuration
  • ChartContainer for container styling

Constructors

ChartsConfig({bool? useGlassmorphism, bool? useNeumorphism, Widget? emptyWidget, String? emptyMessage, Widget? errorWidget, String? errorMessage, List<BoxShadow>? boxShadow, ChartTheme? theme, Duration? animationDuration})
const

Properties

animationDuration Duration?
Animation duration for the chart.
final
boxShadow List<BoxShadow>?
Custom box shadows for the chart container.
final
emptyMessage String?
Message shown in the default empty state when emptyWidget is null.
final
emptyWidget Widget?
Custom widget shown when the chart has no data or all values are zero. If null, charts use ChartEmptyState with emptyMessage.
final
errorMessage String?
Message shown in the default error state when errorWidget is null.
final
errorWidget Widget?
Custom widget shown when the chart is in error state. If null, charts use the default error UI with errorMessage.
final
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
theme ChartTheme?
Theme for colors, typography, and chart styling.
final
useGlassmorphism bool?
Whether to apply glassmorphism (frosted glass) to the chart container.
final
useNeumorphism bool?
Whether to apply neumorphism (soft shadow) to the chart container.
final

Methods

copyWith({ChartTheme? theme, bool? useGlassmorphism, bool? useNeumorphism, Widget? emptyWidget, String? emptyMessage, Widget? errorWidget, String? errorMessage, List<BoxShadow>? boxShadow, Duration? animationDuration}) ChartsConfig
Creates a copy of this config with the given fields replaced.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

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