PaginatedDataTable class

A Material Design data table that shows data using multiple pages.

A paginated data table shows rowsPerPage rows of data per page and provides controls for showing other pages.

Data is read lazily from a DataTableSource. The widget is presented as a Card.

If the key is a PageStorageKey, the initialFirstRowIndex is persisted to PageStorage.

This sample shows how to display a DataTable with three columns: name, age, and role. The columns are defined by three DataColumn objects. The table contains three rows of data for three example users, the data for which is defined by three DataRow objects.
link

To create a local project with this code sample, run:
flutter create --sample=material.PaginatedDataTable.1 mysample

This example shows how paginated data tables can supported sorted data.
link

To create a local project with this code sample, run:
flutter create --sample=material.PaginatedDataTable.2 mysample

See also:

Inheritance

Constructors

PaginatedDataTable({Key? key, Widget? header, List<Widget>? actions, required List<DataColumn> columns, int? sortColumnIndex, bool sortAscending = true, ValueSetter<bool?>? onSelectAll, @Deprecated('Migrate to use dataRowMinHeight and dataRowMaxHeight instead. ' 'This feature was deprecated after v3.7.0-5.0.pre.') double? dataRowHeight, double? dataRowMinHeight, double? dataRowMaxHeight, double headingRowHeight = 56.0, double horizontalMargin = 24.0, double columnSpacing = 56.0, bool showCheckboxColumn = true, bool showFirstLastButtons = false, int? initialFirstRowIndex = 0, ValueChanged<int>? onPageChanged, int rowsPerPage = defaultRowsPerPage, List<int> availableRowsPerPage = const <int>[defaultRowsPerPage, defaultRowsPerPage * 2, defaultRowsPerPage * 5, defaultRowsPerPage * 10], ValueChanged<int?>? onRowsPerPageChanged, DragStartBehavior dragStartBehavior = DragStartBehavior.start, Color? arrowHeadColor, required DataTableSource source, double? checkboxHorizontalMargin, ScrollController? controller, bool? primary, MaterialStateProperty<Color?>? headingRowColor, bool showEmptyRows = true})
Creates a widget describing a paginated DataTable on a Card.

Properties

actions List<Widget>?
Icon buttons to show at the top end side of the table. The header must not be null to show the actions.
final
arrowHeadColor Color?
Defines the color of the arrow heads in the footer.
final
availableRowsPerPage List<int>
The options to offer for the rowsPerPage.
final
checkboxHorizontalMargin double?
Horizontal margin around the checkbox, if it is displayed.
final
columns List<DataColumn>
The configuration and labels for the columns in the table.
final
columnSpacing double
The horizontal margin between the contents of each data column.
final
controller ScrollController?
An object that can be used to control the position to which this scroll view is scrolled.
final
dataRowHeight double?
The height of each row (excluding the row that contains column headings).
no setter
dataRowMaxHeight double?
The maximum height of each row (excluding the row that contains column headings).
final
dataRowMinHeight double?
The minimum height of each row (excluding the row that contains column headings).
final
dragStartBehavior DragStartBehavior
Determines the way that drag start behavior is handled.
final
hashCode int
The hash code for this object.
no setterinherited
The table card's optional header.
final
headingRowColor MaterialStateProperty<Color?>?
The background color for the heading row.
final
headingRowHeight double
The height of the heading row.
final
horizontalMargin double
The horizontal margin between the edges of the table and the content in the first and last cells of each row.
final
initialFirstRowIndex int?
The index of the first row to display when the widget is first created.
final
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
onPageChanged ValueChanged<int>?
Invoked when the user switches to another page.
final
onRowsPerPageChanged ValueChanged<int?>?
Invoked when the user selects a different number of rows per page.
final
onSelectAll ValueSetter<bool?>?
Invoked when the user selects or unselects every row, using the checkbox in the heading row.
final
primary bool?
Whether this is the primary scroll view associated with the parent PrimaryScrollController.
final
rowsPerPage int
The number of rows to show on each page.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
showCheckboxColumn bool
Whether the widget should display checkboxes for selectable rows.
final
showEmptyRows bool
Controls the visibility of empty rows on the last page of a PaginatedDataTable.
final
showFirstLastButtons bool
Flag to display the pagination buttons to go to the first and last pages.
final
sortAscending bool
Whether the column mentioned in sortColumnIndex, if any, is sorted in ascending order.
final
sortColumnIndex int?
The current primary sort key's column.
final
source DataTableSource
The data source which provides data to show in each row.
final

Methods

createElement() StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() PaginatedDataTableState
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}) 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

Constants

defaultRowsPerPage → const int
The default value for rowsPerPage.