PaginatedDataTable2 class

In-place replacement of standard PaginatedDataTable widget, mimics it API. Has the header row and paginatior always fixed to top and bottom (correspondingly). Core of the table (with data rows) is scrollable and stretching to max width/height of it's container. You can set minimal width of the table via minWidth property and Flex behavior of table core via fit property. By using DataColumn2 instead of DataColumn it is possible to control relative column sizes (setting them to S, M and L). DataRow2 provides row-level tap event handlers. See also:

Inheritance
Implementers

Constructors

PaginatedDataTable2({Key? key, Widget? header, List<Widget>? actions, required List<DataColumn> columns, int? sortColumnIndex, bool sortAscending = true, Duration sortArrowAnimationDuration = const Duration(milliseconds: 150), IconData sortArrowIcon = Icons.arrow_upward, Widget sortArrowBuilder(bool ascending, bool sorted)?, bool sortArrowAlwaysVisible = false, ValueSetter<bool?>? onSelectAll, TextStyle? dataTextStyle, double dataRowHeight = kMinInteractiveDimension, CheckboxThemeData? datarowCheckboxTheme, TextStyle? headingTextStyle, double headingRowHeight = 56.0, MaterialStateProperty<Color?>? headingRowColor, CheckboxThemeData? headingCheckboxTheme, double horizontalMargin = 24.0, double columnSpacing = 56.0, double? dividerThickness, bool renderEmptyRowsInTheEnd = true, int fixedLeftColumns = 0, int fixedTopRows = 1, Color? fixedColumnsColor, Color? fixedCornerColor, 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, required DataTableSource source, double? checkboxHorizontalMargin, Alignment checkboxAlignment = Alignment.center, bool wrapInCard = true, double? minWidth, FlexFit fit = FlexFit.tight, bool hidePaginator = false, PaginatorController? controller, ScrollController? scrollController, ScrollController? horizontalScrollController, Widget? empty, TableBorder? border, bool autoRowsToHeight = false, double smRatio = 0.67, double lmRatio = 1.2, BoxDecoration? headingRowDecoration, bool? isVerticalScrollBarVisible, bool? isHorizontalScrollBarVisible})
Check out PaginatedDataTable for the API decription. Key differences are minWidth and fit properties.

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
autoRowsToHeight bool
If true rows per page is set to fill available height so that no scroll bar is ever displayed. rowsPerPage is ignore when this field is set to true
final
availableRowsPerPage List<int>
The options to offer for the rowsPerPage.
final
border TableBorder?
Set vertical and horizontal borders between cells, as well as outside borders around table. NOTE: setting this field will disable standard horizontal dividers which are controlled by themes and dividerThickness property
final
checkboxAlignment Alignment
Alignment of the checkbox if it is displayed Defaults to the Alignment.center
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 PaginatorController?
Used to comntrol widget's state externally and trigger actions. See PaginatorController
final
datarowCheckboxTheme CheckboxThemeData?
Overrides theme of the checkbox that is displayed in the checkbox column in each data row (should checkboxes be enabled)
final
dataRowHeight double
The height of each row (excluding the row that contains column headings).
final
dataTextStyle TextStyle?
The text style for data rows.
final
dividerThickness double?
The divider thickness between rows.
final
dragStartBehavior DragStartBehavior
Determines the way that drag start behavior is handled.
final
empty Widget?
Placeholder widget which is displayed whenever the data rows are empty. The widget will be displayed below column
final
fit FlexFit
Data rows are wrapped in Flexible widget, this property sets its' fit property. When ther're few rows it determines if the core of the table must grow and fill the contrainer (FlexFit.tight - useful if you want the paginator to stick to the bottom when there're few rows) or of you want to have the table to take minimal space and do not have bottom pager stick to the bottom (FlexFit.loose)
final
fixedColumnsColor Color?
Backgound color of the sticky columns fixed via fixedLeftColumns. Note: unlike data rows which can change their colors depending on material state (e.g. selected, hovered) this color is static and doesn't repond to state change Note: to change background color of fixed data rows use PaginatedDataTable2.headingRowColor and individual row colors of data rows provided via rows
final
fixedCornerColor Color?
Backgound color of the top left corner which is fixed whenere both fixedTopRows and fixedLeftColumns are greater than 0 Note: unlike data rows which can change their colors depending on material state (e.g. selected, hovered) this color is static and doesn't repond to state change Note: to change background color of fixed data rows use PaginatedDataTable2.headingRowColor and individual row colors of data rows provided via rows
final
fixedLeftColumns int
Number of sticky columns fixed at the left side of the table. Check box column (if enabled) is also counted
final
fixedTopRows int
The number of sticky rows fixed at the top of the table. The heading row is counted/included. By defult the value is 1 which means header row is fixed. Set to 0 in order to unstick the header, set to >1 in order to fix data rows (i.e. in order to fix both header and the first data row use value of 2)
final
hashCode int
The hash code for this object.
no setterinherited
The table card's optional header.
final
headingCheckboxTheme CheckboxThemeData?
The theme for the heading row checkboxes.
final
headingRowColor MaterialStateProperty<Color?>?
The background color for the heading row.
final
headingRowDecoration BoxDecoration?
If set this field will override the current BoxDecoration. It takes precedence over headerRowColor when both are provided.
final
headingRowHeight double
The height of the heading row.
final
headingTextStyle TextStyle?
The text style for the heading row.
final
hidePaginator bool
Hides the paginator at the bottom. Can be useful in case you decide create your own paginator and control the widget via PaginatedDataTable2.controller
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
horizontalScrollController ScrollController?
Exposes scroll controller of the SingleChildScrollView that makes data rows horizontally scrollable
final
initialFirstRowIndex int?
The index of the first row to display when the widget is first created.
final
isHorizontalScrollBarVisible bool?
Determines whether the horizontal scroll bar is visible, for iOS takes value from scrollbarTheme when null
final
isVerticalScrollBarVisible bool?
Determines whether the vertical scroll bar is visible, for iOS takes value from scrollbarTheme when null
final
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
lmRatio double
Determines ratio of Large column's width to Medium column's width. I.e. 2.0 means that Large column is twice wider than Medium column.
final
minWidth double?
If set, the table will stop shrinking below the threshold and provide horizontal scrolling. Useful for the cases with narrow screens (e.g. portrait phone orientation) and lots of columns (that get messed with little space)
final
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
renderEmptyRowsInTheEnd bool
Flag to render empty(invisible) rows in the end of the table when there is a fixed number of rowsPerPage and the number of visible rows is smaller This value defaults to true
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
scrollController ScrollController?
Exposes scroll controller of the SingleChildScrollView that makes data rows vertically scrollable
final
showCheckboxColumn bool
Whether the widget should display checkboxes for selectable rows.
final
showFirstLastButtons bool
Flag to display the pagination buttons to go to the first and last pages.
final
smRatio double
Determines ratio of Small column's width to Medium column's width. I.e. 0.5 means that Small column is twice narower than Medium column.
final
sortArrowAlwaysVisible bool
This used in combination with sortArrowBuilder to create a custom sort arrow widget behavior. If this is set to true the sortArrowBuilder will run for all columns that have onSort != null.
final
sortArrowAnimationDuration Duration
When changing sort direction an arrow icon in the header is rotated clockwise. The value defines the duration of the rotation animation. If not set, the default animation duration is 150 ms.
final
sortArrowBuilder → (Widget Function(bool ascending, bool sorted)?)
A builder for the sort arrow widget. Can be used in combination with sortArrowAlwaysVisible for a custom sort arrow behavior. If this is used sortArrowIcon, sortArrowAnimationDuration will be ignored.
final
sortArrowIcon IconData
Icon to be displayed when sorting is applied to a column. If not set, the default icon is Icons.arrow_upward
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. Must be non-null.
final
wrapInCard bool
final

Methods

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