DesignPieChart class

A pie or donut: the look draws slices from the angles in builder's details; the chart picks a slice, says it, and springs from one set of values to the next.

A pointer or a finger picks the slice under it (by angle, inside the radius and outside the hole), as DesignChart picks a point. Keys (one tab stop): Right and Down the next slice, Left and Up the previous (Left and Right mirrored right to left), Home and End the first and last, Escape lets go. A screen reader hears semanticLabel, then "4 slices, lowest 120, highest 1,200" (semanticSummary overrides it) or the picked slice ("40%, Rent: 1,200"), and steps through the slices.

The pie fills the width it is given (300 when unbounded) and the height (as tall as wide when unbounded).

DesignPieChart(semanticLabel: 'Spending', slices: const [DesignPieSlice(label: 'Rent', value: 1200), DesignPieSlice(label: 'Food', value: 600)], builder: (context, pie) => CustomPaint(size: pie.size))
Inheritance

Constructors

DesignPieChart({Key? key, required List<DesignPieSlice> slices, required DesignPieChartBuilder builder, required String semanticLabel, EdgeInsetsGeometry padding = EdgeInsets.zero, double holeRadius = 0, DesignChartFormat? formatValue, String? semanticSummary, ValueChanged<int?>? onActiveSliceChanged, VoidCallback? onShowTable, FocusNode? focusNode, bool autofocus = false, double dampingRatio = 1, double stiffness = 400})
A pie of slices.
const

Properties

autofocus → bool
Whether the chart takes focus when it first shows.
final
builder → DesignPieChartBuilder
Draws the pie.
final
dampingRatio → double
The damping of the spring a data change runs on (critically damped, 1, under Reduce Motion). Defaults to 1.
final
focusNode → FocusNode?
The chart's focus; null: its own. A node given is never disposed here.
final
formatValue → DesignChartFormat?
The values' readout and speech; null: the reader's numbers.
final
hashCode → int
The hash code for this object.
no setterinherited
holeRadius → double
A donut's hole, as a fraction of the radius: a pointer in it picks nothing. Defaults to 0, a pie.
final
key → Key?
Controls how one widget replaces another widget in the tree.
finalinherited
onActiveSliceChanged → ValueChanged<int?>?
Called as the picked slice changes (null: none).
final
onShowTable → VoidCallback?
Shows the data as a table: offered to a screen reader as "Show data table". Null: not offered.
final
padding → EdgeInsetsGeometry
The room kept round the pie for the look's labels.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
semanticLabel → String
The chart's name, said first ("Spending").
final
semanticSummary → String?
What a screen reader hears of the data; null: a sentence built from it.
final
slices → List<DesignPieSlice>
The slices, clockwise from twelve o'clock (counter-clockwise right to left).
final
stiffness → double
The stiffness of that spring. Defaults to 400.
final

Methods

createElement() → StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() → State<DesignPieChart>
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.
override
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