Heatmap class

A 2D grid of values, each rendered as a block character whose density represents the cell's intensity within the visible range.

Common shapes: GitHub-style activity calendars, time-of-day usage matrices, attention heatmaps. Each value maps to one of four blocks (░▒▓█) by where it falls in the range from min to max (fitted to the data by default); a value at or below the low end leaves its cell blank. Cells draw in the theme's primary color unless you pass color.

Heatmap(
  values: weeklyActivity, // List<List<num>>: 7 rows (days) × 4 columns
  rowLabels: const ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
  colLabels: const ['W1', 'W2', 'W3', 'W4'], // clipped to cellWidth
  showLegend: true,
)

Screen readers and agents get one chart node: semanticLabel plus the row and column counts and the value range the blocks are scaled to, not a node per cell.

Inheritance
Available extensions

Constructors

Heatmap({Key? key, required List<List<num>> values, num? min, num? max, int cellWidth = 2, Color? color, List<String>? rowLabels, List<String>? colLabels, bool showLegend = false, String semanticLabel = 'Heatmap'})
const

Properties

cellWidth → int
Cells per data point (≥ 1). Wider cells make each data point easier to read; 2 is a nice default.
final
colLabels → List<String>?
Optional labels for the columns (drawn above the grid).
final
color → Color?
Foreground for active cells. Defaults to the theme's primary.
final
hashCode → int
The hash code for this object.
no setterinherited
key → Key?
finalinherited
max → num?
High end. null autoscales.
final
min → num?
Low end of the color/intensity range. null autoscales.
final
rowLabels → List<String>?
Optional labels for the rows (drawn to the left).
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
semanticLabel → String
Label exposed through the semantic app graph.
final
showLegend → bool
When true, append a ░▒▓█ min – max scale strip below the grid so the intensity ladder maps to real values — the encoding is otherwise opaque (and color/glyph-density-only is an accessibility red flag).
final
values → List<List<num>>
values[row][col] — outer list is rows top→bottom, inner is cols left→right.
final

Methods

animate({Duration? duration, Curve? curve, Object? trigger, bool repeat = false}) → Animate

Available on Widget, provided by the AnimateExtension extension

Starts an Animate chain over this widget. duration / curve apply to the whole chain. With no trigger it plays on mount; with a non-null trigger it rests on mount and replays whenever the token changes.
build(BuildContext context) → Widget
Describes the part of the user interface represented by this widget.
override
createElement() → StatelessElement
Creates the Element that will mount this widget into the tree.
inherited
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