AnimatedPieChartView class
A widget that displays an animated pie chart with configurable appearance and behavior.
The pie chart animation can be triggered automatically when the widget is built or when it becomes visible in a scrollable view (using the provided scrollController).
This widget displays filled pie slices that represent data proportions, unlike AnimatedCircleView which draws stroke-based circles. Each slice is drawn as a filled wedge with optional stroke outlines.
Example usage:
AnimatedPieChartView(
pieChartPainterConfig: PieChartPainterConfig(
data: [
PieData(value: 30, color: Colors.blue, label: 'Category A'),
PieData(value: 45, color: Colors.green, label: 'Category B'),
PieData(value: 25, color: Colors.orange, label: 'Category C'),
],
strokeWidth: 2.0,
separatorAngle: 0.02,
),
duration: Duration(milliseconds: 1200),
)
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- AnimatedPieChartView
Constructors
- AnimatedPieChartView.new({required PieChartPainterConfig pieChartPainterConfig, ScrollController? scrollController, VoidCallback? onAnimationCompleted, Duration duration = const Duration(milliseconds: 1200), Duration fadeInDuration = const Duration(milliseconds: 300), Curve curve = Curves.easeInOut, Key? key})
-
Creates an animated pie chart view with the given configuration.
const
Properties
- curve → Curve
-
The curve to apply to the pie chart drawing animation.
final
- duration → Duration
-
Duration of the pie chart drawing animation.
final
- fadeInDuration → Duration
-
Duration of the fade-in effect when the pie chart becomes visible.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- onAnimationCompleted → VoidCallback?
-
Callback function that is called when the animation completes.
final
- pieChartPainterConfig → PieChartPainterConfig
-
Configuration for the pie chart painter that determines data, colors,
and other visual properties.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- scrollController → ScrollController?
-
ScrollController that triggers animation when the widget becomes
visible in the viewport.
final
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → State< AnimatedPieChartView> -
Creates the mutable state for this widget at a given location in the tree.
override
-
debugDescribeChildren(
) → List< DiagnosticsNode> -
Returns a list of DiagnosticsNode objects describing this node's
children.
inherited
-
debugFillProperties(
DiagnosticPropertiesBuilder properties) → void -
Add additional properties associated with the node.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toDiagnosticsNode(
{String? name, DiagnosticsTreeStyle? style}) → DiagnosticsNode -
Returns a debug representation of the object that is used by debugging
tools and by DiagnosticsNode.toStringDeep.
inherited
-
toString(
{DiagnosticLevel minLevel = DiagnosticLevel.info}) → String -
A string representation of this object.
inherited
-
toStringDeep(
{String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug, int wrapWidth = 65}) → String -
Returns a string representation of this node and its descendants.
inherited
-
toStringShallow(
{String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) → String -
Returns a one-line detailed description of the object.
inherited
-
toStringShort(
) → String -
A short, textual description of this widget.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited