PlTable<T> class

A grid of data on a sheet of glass.

PlTable<Invoice>(
  caption: const Text('Recent invoices'),
  hoverable: true,
  rows: invoices,
  columns: <PlTableColumn<Invoice>>[
    PlTableColumn<Invoice>(header: const Text('Invoice'), cell: (Invoice row, int _) => Text(row.id)),
    PlTableColumn<Invoice>(
      header: const Text('Total'),
      align: PlassAlign.end,
      cell: (Invoice row, int _) => Text(row.total),
    ),
  ],
)

The sheet is the ordinary Plass container — variant, size, color, density and elevation all mean what they mean everywhere else, and it is never dyed. What the table adds is the part that is genuinely tabular: the columns, the rows, and the fact that the two cannot drift apart.

Laid out by Flutter's own Table, which is also where the table, row, cell and column-header semantics come from. Every column is measured from the content in it, exactly as a browser's automatic table layout is, so the same data comes out the same shape in both packages.

There is no band behind the column names. The header is muted, semibold text over a rule one step firmer than the ones between the rows: a filled strip across the top of a grid is the fastest way to make data look like chrome, and it puts all of a table's weight in the one place that needs none of it.

Inheritance

Constructors

PlTable({required List<PlTableColumn<T>> columns, required List<T> rows, LocalKey rowKey(T row, int index)?, Widget? caption, Widget? empty, bool striped = false, bool hoverable = false, bool stickyHeader = false, double? maxHeight, void onRowPressed(T row, int index)?, PlassVariant variant = PlassVariant.glass, PlassSize? size, PlassColor? color, PlassDensity? density, PlassElevation elevation = 0, String? semanticLabel, Key? key})
Creates a grid.
const

Properties

caption Widget?
Drawn above the grid, inside the sheet.
final
color PlassColor?
Semantic colour role. It reaches the hover tint and the focus ring, and nothing else: data arrives with its own colours.
final
columns List<PlTableColumn<T>>
The columns, in the order they appear.
final
density PlassDensity?
How tightly the rows pack. Padding only — never the type scale.
final
elevation int
Drop shadow depth, 03.
final
empty Widget?
What is shown instead of rows when rows is empty.
final
hashCode int
The hash code for this object.
no setterinherited
hoverable bool
Lights the row under the pointer.
final
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
maxHeight double?
A hard cap on the grid's height, in logical pixels.
final
onRowPressed → void Function(T row, int index)?
Makes rows activatable, and turns on the hover treatment with them.
final
rowKey LocalKey Function(T row, int index)?
A stable key per row.
final
rows List<T>
The rows.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
semanticLabel String?
The name a screen reader gives the table.
final
size PlassSize?
Type scale and cell padding.
final
Pins the column names to the top of the grid while the rows scroll under them.
final
striped bool
Tints every other row.
final
variant PlassVariant
What the sheet under the grid is made of.
final

Methods

build(BuildContext context) Widget
Describes the part of the user interface represented by this widget.
override
createElement() StatelessElement
Creates a StatelessElement to manage this widget's location in the tree.
inherited
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