ReadableTableController<T> class

Inheritance

Constructors

ReadableTableController({required List<ReadableColumn<T>> columns, List<T>? rows, ReadableSelectionMode selectionMode = ReadableSelectionMode.none, Set<int>? selectedRows, Set<ReadableCell>? selectedCells, int? sortColumn, bool sortAscending = true})

Properties

activeCol int
no setter
activeRow int
no setter
colCount int
no setter
columnOrder List<int>
The current visual order as a list of LOGICAL column indices.
no setter
columns List<ReadableColumn<T>>
final
hashCode int
The hash code for this object.
no setterinherited
hasListeners bool
Whether any listeners are currently registered.
no setterinherited
isInteractive bool
no setter
rowCount int
no setter
rows List<T>
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
selectedCells Set<ReadableCell>
no setter
selectedCount int
no setter
selectedRowIndices Set<int>
no setter
selectedRows List<T>
no setter
selectionMode ReadableSelectionMode
What the user can select. Mutable so the view's selectionMode: can drive it; clears the selection when the kind of selection changes.
getter/setter pair
sortColumn int?
no setter
sortDir ReadableSortDir
no setter

Methods

addListener(VoidCallback listener) → void
Register a closure to be called when the object changes.
inherited
addRow(T value) → void
Append value as the last row.
addRowWhere(bool test(T value), T value, {bool after = true, bool firstOnly = true}) → void
Insert value adjacent to rows matching testafter the match by default, or before it. With firstOnly (default) only the first match is used; otherwise value is inserted next to every match.
cellText(int row, int col) String
Plain-text value of cell (row, col), via the column's copyTextsortKey → toString fallback chain. (Cells render as widgets, so the copy path needs its own flat accessor.)
clearSelection() → void
clearSort() → void
Clear the sort indicator (does not restore the original order).
columnAt(int visual) ReadableColumn<T>
The column shown at visual position visual.
copySelectionAsTsv({bool includeHeader = false}) String
Serialize the current selection to a TSV string: • row modes → every column of each selected row (in row & column order) • cell modes → the bounding rectangle of the selected cells; cells inside the rectangle but not selected are emitted as empty fields, so the block pastes into a spreadsheet with the right shape. Returns '' when nothing is selected.
copySelectionToClipboard({bool includeHeader = false}) Future<int>
Copy the current selection to the system clipboard as TSV. Returns the number of rows written (0 ⇒ nothing selected).
deleteRowAt(int index) → void
Remove the row at index.
deleteRowByValue(T value) → void
Remove the first row whose value == value.
deleteRowsWhere(bool test(T value)) int
Remove every row matching test. Returns the number removed.
deleteSelectedRows() → void
Remove every currently-selected row (row modes).
dispose() → void
Discards any resources used by the object.
inherited
hasWidthOverride(int visual) bool
Whether the column at visual currently has a drag-resize override.
insertRowAt(int index, T value) → void
Insert value at index (clamped to 0..rowCount).
isCellSelected(int row, int col) bool
isRowSelected(int index) bool
logicalColumnAt(int visual) int
The logical column index shown at visual position visual.
moveActive(int dRow, int dCol, {bool extend = false}) → void
moveActiveTo(int row, int col, {bool extend = false}) → void
moveColumn(int fromVisual, int toVisual) → void
Move the column at visual position fromVisual to toVisual (header drag-and-drop). Only the visual order changes; logical indices — and so the selection, sort column and cell addresses — are untouched.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
notifyListeners() → void
Call all the registered listeners.
inherited
removeListener(VoidCallback listener) → void
Remove a previously registered closure from the list of closures that are notified when the object changes.
inherited
replaceFirstWhere(bool test(T value), T update(T value)) → void
Replace only the first row matching test with update(currentValue).
replaceRowAt(int index, T value) → void
Replace the row at index with value.
replaceRowByValue(T oldValue, T newValue) → void
Replace the first row equal to oldValue with newValue.
replaceRowsWhere(bool test(T value), T update(T value)) int
Replace every row matching test with update(currentValue). Returns the number replaced.
resetColumnWidth(int visual) → void
Drop the resize override for the column at visual (double-tap the handle to restore its declared width / flex).
resizeColumn(int visual, double delta, {double min = columnMinWidth, double max = columnMaxWidth}) → void
Resize the column at visual position visual by delta px (drag), clamped to columnMinWidth..columnMaxWidth. A flex column becomes fixed-width on first resize. Pass an RTL-mirrored delta from the view.
rowAt(int index) → T
selectAll() → void
selectAllCells() → void
selectAllRows() → void
Select all rows (multi-row) — no-op in other modes.
selectCellAt(int row, int col, {bool additive = false, bool range = false}) → void
selectRowAt(int index, {bool additive = false, bool range = false}) → void
Select the row at index. additive toggles it within the existing selection (multi only); range extends from the anchor to index.
selectRowByValue(T value, {bool additive = false}) → void
Select the first row whose value == value. additive adds it to the current selection (multi) instead of replacing.
selectRowsWhere(bool test(T value), {bool additive = false}) → void
Select every row matching test. Replaces the selection unless additive. In single-row mode only the last match survives.
setRows(List<T> values) → void
Replace the entire row set (e.g. load from a data source). Clears the selection; keeps the sort column applied if any.
setSelectionMode(ReadableSelectionMode mode) → void
sortByColumn(int ci) → void
Click a sortable header: cycles asc → desc. Reorders the rows and remaps the selection / cursor so they follow their rows.
toggleActive() → void
toString() String
A string representation of this object.
inherited
widthOf(int visual) double?
The effective width of the column at visual position visual: a drag override if any, else the column's declared fixed ReadableColumn.width. Returns null when the column should flex (no override, no fixed width).

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

of<T>(BuildContext context) ReadableTableController<T>?
read<T>(BuildContext context) ReadableTableController<T>?

Constants

columnMaxWidth → const double
columnMinWidth → const double
Min / max a column can be dragged to (px).