DesignTableController<R> class

A table's data and its view of it: the filter, the sort, the selection and the page.

The caller makes it (a State's field, say), keeps it across rebuilds and disposes it; a widget it is given to only listens to it.

DesignTableController<String>(rows: const ['a', 'b'], columns: [DesignTableColumn<String>(id: 'name', label: 'Name', sortKey: (row) => row)])
Inheritance

Constructors

DesignTableController({required List<R> rows, required List<DesignTableColumn<R>> columns, Object rowKey(R row)?, int? pageSize, bool filter(R row, String query)?, bool cycleToUnsorted = true})
A table of rows in columns. rowKey tells rows apart across replacements of the data (the row itself by default); pageSize null shows every row.

Properties

columns → List<DesignTableColumn<R>>
The columns, in order.
final
cycleToUnsorted → bool
Whether a third press on a sorted column's header unsorts it (else it flips between ascending and descending).
final
filter → bool Function(R row, String query)?
Whether query keeps a row; null: every row is kept.
final
filteredRows → List<R>
The rows the filter keeps, sorted: every page.
no setter
hashCode → int
The hash code for this object.
no setterinherited
hasListeners → bool
Whether any listeners are currently registered.
no setterinherited
page → int
The page shown, from 0.
no setter
pageCount → int
How many pages there are (at least 1).
no setter
pageRows → List<R>
The rows on the shown page.
no setter
pageSelection → DesignSelection
The shown page's selection, for its select-all box.
no setter
pageSize ↔ int?
Rows per page, or null for one page of all.
getter/setter pair
query ↔ String
The filter's query.
getter/setter pair
rows ↔ List<R>
Every row, unfiltered and unsorted.
getter/setter pair
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
selectedCount → int
How many rows are selected.
no setter
selectedRows → List<R>
The selected rows, in the view's order (filtered-out ones last).
no setter
sortColumn → String?
The sorted column's id, or null.
no setter
sortDirection → DesignSortDirection
Which way it sorts.
no setter

Methods

addListener(VoidCallback listener) → void
Register a closure to be called when the object changes.
inherited
clearSelection() → void
Clears the selection.
dispose() → void
Discards any resources used by the object.
inherited
goToPage(int page) → void
Shows page page (clamped).
isSelected(R row) → bool
Whether row is selected.
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
selectAll() → void
Selects every row the filter keeps, on every page.
sort(String id) → void
A header's press: sorts by the column id ascending, then descending, then (with cycleToUnsorted) not at all. Equal rows keep their order.
sortBy(String? id, [DesignSortDirection direction = DesignSortDirection.ascending]) → void
Sorts by id in direction (null id: unsorted).
sortOf(String id) → DesignSortDirection?
The sort of the column id: its direction, or null while it is not the sorted column.
toggle(R row, {bool extend = false}) → void
Toggles row; with extend (Shift) selects every row of the view from the last toggled row to this one.
togglePage() → void
The select-all box's press: clears the page when all of it is selected, else selects all of it.
toString() → String
A string representation of this object.
inherited

Operators

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