Sparkline
PaymentSparkline adds a small trend beside a host-provided amount.
It answers “which way is this going?” at a glance. It has no axes, labels or value at rest, so it always sits in a row next to a KPI that states the exact amount. For a chart someone reads point by point, use Line chart.


PaymentSparkline(points: points);Use onSelectionChanged to receive each new selected period index and null on return to rest. The index addresses points or the series’ shared periods. Repeated events within one period do not notify or rebuild. New periods reset selection silently. The kit plays no haptics; add them in your callback if you want them.
import 'package:flutter/services.dart';
PaymentSparkline( points: points, inspectable: true, onSelectionChanged: (i) { if (i != null) HapticFeedback.selectionClick(); },);Variants
Section titled “Variants”Variants: money, percentage, number; optional inspection.
States and variants
Section titled “States and variants”Settled marks are solid, pending marks are outlined or dashed, and unknown marks are hatched or dotted. A null point is a gap, never zero. Use one currency per chart. Bar and meter amounts must be non-negative; line charts accept negative amounts.
Series, axes and units
Section titled “Series, axes and units”Use named series with identical period labels and ordering. Line and bar charts accept up to three series; sparklines accept two. Series use an accent ramp and distinct dash patterns, never status tones. All series share a scale. showLegend controls the legend for multiple series.
axis and grid each take x, y, both or none. Colors come from named PaymentChartSeries. unit is money, percent or number.
Use a line for direction, bars for period comparisons, a meter for category proportions and a sparkline beside a KPI. Percent and number units read measure; money reads value. A measure of 45 means 45 percent. Missing readings remain gaps.
Sparklines can opt into inspectable, giving a 48 dp target. Press and hold to read a value. Unlike line and bar charts, a sparkline has no value label at rest: it sits beside a KPI that already states the amount. Meter onSegmentPressed activates full-width legend rows; the painted bar takes no taps.
Breaking: MeterSegment.color is removed. Use the semantic category ramp. MeterSegment.value is optional; supply measure for numeric units. Point value and chart points are optional when using measures or series.
PaymentChartSeries
class PaymentChartSeries · lib/src/charts/chart_models.dart
Named points sharing the same periods with the other series.
| Parameter | Type | Default | Description |
|---|---|---|---|
label:required | String | — | Legend and spoken name. |
points:required | List<ChartPoint> | — | One point per period. |
PaymentChartAxis
enum PaymentChartAxis · lib/src/charts/chart_models.dart
Axes to label or grid.
| Value | Description |
|---|---|
x | Horizontal axis. |
y | Vertical axis. |
both | Both axes. |
none | Neither axis. |
PaymentChartUnit
enum PaymentChartUnit · lib/src/charts/chart_models.dart
How a chart reads its values.
| Value | Description |
|---|---|
money | Currency amounts. |
percent | Host-computed percentages, where 45 means 45 percent. |
number | Plain counts or quantities. |
ChartPoint
class ChartPoint · lib/src/charts/chart_models.dart
One period reading, with missing values distinct from zero.
| Parameter | Type | Default | Description |
|---|---|---|---|
label:required | String | — | Visible period or category label. |
value: | Money? | — | Null is missing data, never zero. |
status: | ChartPointStatus | ChartPointStatus.settled | Settlement state; never encoded by a series color. |
spokenLabel: | String? | — | Optional expanded period name for spoken summaries. |
measure: | num? | — | Host-computed quantity; null is missing data. |
MeterSegment
class MeterSegment · lib/src/charts/chart_models.dart
One non-negative category in a meter.
| Parameter | Type | Default | Description |
|---|---|---|---|
label:required | String | — | Visible period or category label. |
value: | Money? | — | Money reading when using currency units. |
status: | ChartPointStatus | ChartPointStatus.settled | Settlement state; never encoded by a series color. |
measure: | num? | — | Host-computed non-negative quantity. |
Parameters: points, series, width, height, inspectable, unit, semanticLabel, onSelectionChanged.
Which variant when
Section titled “Which variant when”| Situation | Variant / composition | Payment example |
|---|---|---|
| Compact spending trend | money | Use as a supporting trend; put exact values elsewhere when they matter. |
Use Line chart for axes and detailed reading.
States
Section titled “States”Missing readings leave gaps. Keep the host amount beside the trend; the sparkline does not compute a payment total.
Do and don’t
Section titled “Do and don’t”Do: Use as a supporting trend; put exact values elsewhere when they matter.
Don’t: Use a sparkline alone to explain an exact payable amount.
Content guidelines
Section titled “Content guidelines”Use short period labels and a clear title. Explain what is settled in the headline caption. The host supplies the headline; the kit never adds plotted values to produce a customer total.
Accessibility
Section titled “Accessibility”A single generated summary announces settled lowest, highest and latest amounts plus pending, unknown and missing counts. Supply semanticLabel for a host-authored equivalent. Pointer inspection on line/bar charts is supplemental; it has no keyboard focus target. Status is conveyed by shape and words as well as color.
PaymentSparkline
class PaymentSparkline extends StatelessWidget · lib/src/charts/charts.dart
Compact trend with optional pointer inspection.
| Parameter | Type | Default | Description |
|---|---|---|---|
points: | List<ChartPoint> | const [] | Single-series points; leave empty when providing series. |
series: | List<PaymentChartSeries> | const [] | Named series with matching period labels; at most three. |
unit: | PaymentChartUnit | PaymentChartUnit.money | Which reading to display and announce. |
inspectable: | bool | false | Whether pointer gestures select a reading. |
width: | double | 80 | Width. |
height: | double | 24 | Height. |
semanticLabel: | String? | — | Host-authored replacement for the generated summary. |
onSelectionChanged: | ValueChanged<int?>? | — | Called with the index of the period a tap or hover selects (only when inspectable); a second tap on the same period, or the pointer leaving, reports null. Not called when new points or series reset the selection. Use it to play a selection haptic (D73); the kit plays none. |
See also
Section titled “See also”- Chart layout for height, state and headline composition.
- Money for precise and compact amounts.