AsyncPaginatedDataTable2 class
Asynchronous version of PaginatedDataTable2 which relies on data source returning data rows wrappd in Future. Provides a straightworward way of integrating data table with remote back-end and is loaded with convenienece features such as error handling, reloading etc.
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- PaginatedDataTable2
- AsyncPaginatedDataTable2
Constructors
-
AsyncPaginatedDataTable2({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, bool sortArrowAlwaysVisible = false, Widget sortArrowBuilder(bool ascending, bool sorted)?, ValueSetter<bool?> ? onSelectAll, double dataRowHeight = kMinInteractiveDimension, MaterialStateProperty<Color?> ? headingRowColor, BoxDecoration? headingRowDecoration, double headingRowHeight = 56, CheckboxThemeData? headingCheckboxTheme, TextStyle? headingTextStyle, double horizontalMargin = 24, double columnSpacing = 56, double? dividerThickness, bool renderEmptyRowsInTheEnd = true, int fixedLeftColumns = 0, int fixedTopRows = 1, Color? fixedColumnsColor, Color? fixedCornerColor, CheckboxThemeData? datarowCheckboxTheme, TextStyle? dataTextStyle, 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, Widget? loading, Widget errorBuilder(Object? error)?, PageSyncApproach pageSyncApproach = PageSyncApproach.doNothing, TableBorder? border, bool autoRowsToHeight = false, double smRatio = 0.67, double lmRatio = 1.2})
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.
finalinherited
- 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
finalinherited
-
availableRowsPerPage
→ List<
int> -
The options to offer for the rowsPerPage.
finalinherited
- 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
finalinherited
- checkboxAlignment → Alignment
-
Alignment of the checkbox if it is displayed
Defaults to the Alignment.center
finalinherited
- checkboxHorizontalMargin → double?
-
Horizontal margin around the checkbox, if it is displayed.
finalinherited
-
columns
→ List<
DataColumn> -
The configuration and labels for the columns in the table.
finalinherited
- columnSpacing → double
-
The horizontal margin between the contents of each data column.
finalinherited
- controller → PaginatorController?
-
Used to comntrol widget's state externally and trigger actions. See
PaginatorController
finalinherited
- datarowCheckboxTheme → CheckboxThemeData?
-
Overrides theme of the checkbox that is displayed in the checkbox column
in each data row (should checkboxes be enabled)
finalinherited
- dataRowHeight → double
-
The height of each row (excluding the row that contains column headings).
finalinherited
- dataTextStyle → TextStyle?
-
The text style for data rows.
finalinherited
- dividerThickness → double?
-
The divider thickness between rows.
finalinherited
- dragStartBehavior → DragStartBehavior
-
Determines the way that drag start behavior is handled.
finalinherited
- empty → Widget?
-
Placeholder widget which is displayed whenever the data rows are empty.
The widget will be displayed below column
finalinherited
- errorBuilder → Widget Function(Object? error)?
-
The function allows displaying custom widget on top of table should an error happen.
E.g. data source faild to load data
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)
finalinherited
- 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
finalinherited - 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
finalinherited - fixedLeftColumns → int
-
Number of sticky columns fixed at the left side of the table.
Check box column (if enabled) is also counted
finalinherited
- 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)
finalinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- header → Widget?
-
The table card's optional header.
finalinherited
- headingCheckboxTheme → CheckboxThemeData?
-
The theme for the heading row checkboxes.
finalinherited
-
headingRowColor
→ MaterialStateProperty<
Color?> ? -
The background color for the heading row.
finalinherited
- headingRowDecoration → BoxDecoration?
-
If set this field will override the current BoxDecoration.
It takes precedence over headerRowColor when both are provided.
finalinherited
- headingRowHeight → double
-
The height of the heading row.
finalinherited
- headingTextStyle → TextStyle?
-
The text style for the heading row.
finalinherited
- 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
finalinherited
- horizontalMargin → double
-
The horizontal margin between the edges of the table and the content
in the first and last cells of each row.
finalinherited
- horizontalScrollController → ScrollController?
-
Exposes scroll controller of the SingleChildScrollView that makes data rows horizontally scrollable
finalinherited
- initialFirstRowIndex → int?
-
The index of the first row to display when the widget is first created.
finalinherited
- isHorizontalScrollBarVisible → bool?
-
Determines whether the horizontal scroll bar is visible, for iOS takes value from scrollbarTheme when null
finalinherited
- isLoadingBarShown → bool?
-
Determines whether the loading bar is visible
finalinherited
- 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.
finalinherited
- loading → Widget?
-
Widget that is goin to be displayed while loading is in progress
If no widget is specified the following defaul widget will be disoplayed:
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)
finalinherited
-
onPageChanged
→ ValueChanged<
int> ? -
Invoked when the user switches to another page.
finalinherited
-
onRowsPerPageChanged
→ ValueChanged<
int?> ? -
Invoked when the user selects a different number of rows per page.
finalinherited
-
onSelectAll
→ ValueSetter<
bool?> ? -
Invoked when the user selects or unselects every row, using the
checkbox in the heading row.
finalinherited
- pageSyncApproach → PageSyncApproach
-
Should a data source return less rows than required to fill the current
page of the table (e.g. when regresshin with a new filter value),
the widget can take 3 actions (see PageSyncApproach):
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
finalinherited
- rowsPerPage → int
-
The number of rows to show on each page.
finalinherited
- 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
finalinherited
- showCheckboxColumn → bool
-
Whether the widget should display checkboxes for selectable rows.
finalinherited
- showFirstLastButtons → bool
-
Flag to display the pagination buttons to go to the first and last pages.
finalinherited
- 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.
finalinherited
- 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.finalinherited - 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.
finalinherited
- 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.
finalinherited
- sortArrowIcon → IconData
-
Icon to be displayed when sorting is applied to a column.
If not set, the default icon is Icons.arrow_upward
finalinherited
- sortAscending → bool
-
Whether the column mentioned in sortColumnIndex, if any, is sorted
in ascending order.
finalinherited
- sortColumnIndex → int?
-
The current primary sort key's column.
finalinherited
- source → DataTableSource
-
The data source which provides data to show in each row. Must be non-null.
finalinherited
- wrapInCard → bool
-
finalinherited
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, 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