TTable<T, K> class

A rich data table with responsive layout.

TTable displays tabular data with:

  • Responsive design (switches to cards on mobile)
  • Sortable, filterable columns
  • Pagination
  • Selection (single/multiple)
  • Expandable rows
  • Editable cells
  • Async loading

Basic Usage

TTable<User, String>(
  headers: [
    TTableHeader(text: 'Name', map: (user) => user.name),
    TTableHeader(text: 'Email', map: (user) => user.email),
  ],
  items: users,
)

Advanced Usage

TTable<User, String>(
  headers: [
    TTableHeader.image('Avatar', (user) => user.avatarUrl),
    TTableHeader(text: 'Name', map: (user) => user.name),
    TTableHeader.actions((user) => [
      TButton.icon(icon: Icons.edit, onPressed: () => edit(user)),
    ]),
  ],
  controller: listController,
  customTheme: myTableTheme,
)

See also:

Inheritance
Mixed-in types

Constructors

TTable({Key? key, required List<TTableHeader<T, K>> headers, TTableTheme? theme, List<T>? items, int? itemsPerPage, String? search, int? searchDelay, TLoadListener<T>? onLoad, ItemKeyAccessor<T, K>? itemKey, TListController<T, K>? controller, Widget expandedBuilder(BuildContext ctx, TListItem<T, K> item, int index)?, bool editable = false})
Creates a data table.
const

Properties

controller TListController<T, K>?
The controller managing the list state.
final
editable bool
Whether specific cells are editable.
final
expandedBuilder Widget Function(BuildContext ctx, TListItem<T, K> item, int index)?
Builder for expanded content of a row.
final
hashCode int
The hash code for this object.
no setterinherited
headers List<TTableHeader<T, K>>
Defines the columns of the table.
final
itemKey ItemKeyAccessor<T, K>?
Function to extract a unique key from an item.
final
items List<T>?
The list of items to display.
final
itemsPerPage int?
The number of items to display per page.
final
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
onLoad TLoadListener<T>?
Callback for loading items from a server.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
The current search query.
final
searchDelay int?
Debounce delay for search in milliseconds.
final
theme TTableTheme?
Custom theme for the table.
final

Methods

createElement() StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() State<TTable<T, K>>
Creates the mutable state for this widget at a given location in the tree.
override
debugDescribeChildren() List<DiagnosticsNode>
Returns a list of DiagnosticsNode objects describing this node's children.
inherited
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toDiagnosticsNode({String? name, DiagnosticsTreeStyle? style}) DiagnosticsNode
Returns a debug representation of the object that is used by debugging tools and by DiagnosticsNode.toStringDeep.
inherited
toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) String
A string representation of this object.
inherited
toStringDeep({String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug, int wrapWidth = 65}) String
Returns a string representation of this node and its descendants.
inherited
toStringShallow({String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) String
Returns a one-line detailed description of the object.
inherited
toStringShort() String
A short, textual description of this widget.
inherited

Operators

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