ReadableColumn<T> class

One column descriptor. Either width (fixed px) or flex (proportional, filling the remaining width) sizes the column. cell builds the cell's content widget from a row value of type T.

Annotations

Constructors

ReadableColumn(String label, {required Widget cell(BuildContext context, T value), double? width, int flex = 1, ReadableAlign align = ReadableAlign.start, bool sortable = false, Comparable? sortKey(T value)?, ReadableColumnType type = ReadableColumnType.text, String copyText(T value)?})
const

Properties

align ReadableAlign
Content alignment (header + body).
final
cell Widget Function(BuildContext context, T value)
Builds the cell content for a given row value. Cells are arbitrary widgets — status pills, two-line bilingual text, progress bars, links…
final
copyText String Function(T value)?
Plain-text value of this column for a row, used when COPYING selection to the clipboard (TSV). Cells render as arbitrary widgets, so this gives the copy path a flat string. When null the table falls back to sortKey's result, then value.toString().
final
flex int
Proportional weight when width is null.
final
hashCode int
The hash code for this object.
no setterinherited
label String
Header label (uppercased on render). Empty string → blank header cell.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
sortable bool
Whether the header is clickable to sort by this column.
final
sortKey Comparable? Function(T value)?
Comparable key to sort this column by, derived from a row value. When a column is sortable but this is null, the table sorts by value.toString().
final
type ReadableColumnType
The semantic kind this column renders. The .<kind> factories set this (and an appropriate cell builder); the default unnamed constructor leaves it ReadableColumnType.text and uses the caller's cell.
final
width double?
Fixed pixel width. When null the column flexes by flex.
final

Methods

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

Static Methods

color<T>(String label, {required String hex(T v), double? width = 130}) ReadableColumn<T>
A colour cell — swatch + #RRGGBB hex.
date<T>(String label, {required DateTime value(T v), String format(DateTime d)?, double? width = 124, bool sortable = true}) ReadableColumn<T>
A formatted date (monospace). format defaults to ISO yyyy-MM-dd.
enumBadge<T>(String label, {required String value(T v), Color color(String tag)?, double? width = 132, bool sortable = true}) ReadableColumn<T>
A coloured status/type pill drawn from a small enum-like set. color maps the string to a swatch; falls back to a neutral pill.
A link affordance over a URL/reference.
number<T>(String label, {required num value(T v), int decimals = 2, String? suffix, double? width = 130, bool sortable = true, bool colorSign = false}) ReadableColumn<T>
Right-aligned monospace number with grouping + decimals.
progress<T>(String label, {required double value(T v), double? width = 150, bool sortable = true}) ReadableColumn<T>
A 0..1 ratio shown as a labelled progress bar.
text<T>(String label, {required String value(T v), String secondary(T v)?, double? width, int flex = 1, ReadableAlign align = ReadableAlign.start, bool sortable = false}) ReadableColumn<T>
Plain (optionally bilingual) text. secondary renders a muted second line.
time<T>(String label, {required String value(T v), double? width = 96, bool sortable = true}) ReadableColumn<T>
A 24-hour HH:mm time (monospace).