ChartContainer constructor
const
ChartContainer({})
Creates a chart container.
child is required and should be the chart widget to display.
theme is optional and will be inferred from the Material theme if not provided.
boxShadow is optional and allows custom shadow configuration. If not provided,
default shadows will be used based on the selected visual style.
The container supports three visual styles:
- Default: Clean card with subtle shadows
- Glassmorphism: Frosted glass effect with backdrop blur
- Neumorphism: Soft shadow effect with depth
Only one effect should be enabled at a time. If both useGlassmorphism
and useNeumorphism are true, neumorphism takes precedence.
Example
ChartContainer(
title: 'Sales',
subtitle: 'Q1 2024',
isLoading: isLoading,
isError: hasError,
errorMessage: errorMessage,
boxShadow: [
BoxShadow(
color: Colors.black.withValues(alpha: 0.1),
blurRadius: 10,
offset: Offset(0, 4),
),
],
child: MyChart(...),
)
Implementation
const ChartContainer({
super.key,
required this.child,
this.theme,
this.padding,
this.title,
this.subtitle,
this.header,
this.footer,
this.useGlassmorphism = false,
this.useNeumorphism = false,
this.isLoading = false,
this.isError = false,
this.errorMessage,
this.errorWidget,
this.boxShadow,
});