PrismDataTable<T> class
A data table that becomes a card list on narrow windows.
Desktop users get a real table with sticky header, zebra striping and sortable columns. Phone users get the same data as stacked cards, with the column labels rendered as field labels. One widget, two layouts — no horizontal scrolling, no cut-off columns.
PrismDataTable<Invoice>(
rows: invoices,
columns: [
PrismColumn(label: 'Invoice', cell: (c, r, i) => Text(r.id), alwaysVisible: true),
PrismColumn(label: 'Client', cell: (c, r, i) => Text(r.client)),
PrismColumn(label: 'Total', numeric: true, cell: (c, r, i) => Text(r.total)),
],
onRowTap: (row, index) => open(row),
)
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- PrismDataTable
Constructors
-
PrismDataTable({Key? key, required List<
T> rows, required List<PrismColumn< columns, void onRowTap(T row, int index)?, String emptyMessage = 'No data', bool zebraStripes = true, bool stickyHeader = true, bool dense = false, Key? rowKey(T row, int index)?, Widget trailing(BuildContext context, T row, int index)?, double? compactBreakpoint})T> > -
Creates a data table.
const
Properties
-
columns
→ List<
PrismColumn< T> > -
Column definitions, left to right.
final
- compactBreakpoint → double?
-
Overrides the token breakpoint below which cards are used.
final
- dense → bool
-
Tightens row height and padding.
final
- emptyMessage → String
-
Shown when rows is empty.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- onRowTap → void Function(T row, int index)?
-
Called when a row or card is tapped.
final
- rowKey → Key? Function(T row, int index)?
-
Identity key per row, keeping sort order stable across rebuilds.
final
-
rows
→ List<
T> -
The data to display.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- stickyHeader → bool
-
Whether the header sticks while the body scrolls.
final
- trailing → Widget Function(BuildContext context, T row, int index)?
-
Widget rendered at the end of each row (e.g. a menu button).
final
- zebraStripes → bool
-
Alternating row background on wide layouts.
final
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → State< PrismDataTable< T> > -
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