KinHeatmap.flat constructor
KinHeatmap.flat({})
Convenience factory: flat list of values mapped into a grid
with columns per row.
Implementation
factory KinHeatmap.flat({
Key? key,
required List<double> values,
required int columns,
List<String>? columnLabels,
List<String>? rowLabels,
double cellSize = 14,
double cellGap = 3,
double cellRadius = 3,
KinHeatmapColorScale? colorScale,
void Function(int row, int col, KinHeatmapCell cell)? onCellTap,
}) {
final rows = <List<KinHeatmapCell>>[];
for (int i = 0; i < values.length; i += columns) {
final end = (i + columns).clamp(0, values.length);
rows.add([
for (int j = i; j < end; j++) KinHeatmapCell(value: values[j]),
]);
}
return KinHeatmap(
key: key,
data: rows,
columnLabels: columnLabels,
rowLabels: rowLabels,
cellSize: cellSize,
cellGap: cellGap,
cellRadius: cellRadius,
colorScale: colorScale,
onCellTap: onCellTap,
);
}