data_table_2 library

Data table and Paginated data table widgets for Flutter

Copyright (c) 2021 Maxim Saplin

Classes

AsyncDataTableSource
Implement this class and use it in conjunction with AsyncPaginatedDataTable2 to allow asynchronous data fetching. Please overide AsyncDataTableSource.getRows and DataTableSource.selectedRowCount to make it legible as a data source.
AsyncPaginatedDataTable2
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.
AsyncPaginatedDataTable2State
AsyncRowsResponse
DataColumn2
Extension of stock DataColumn, adds the capability to set relative column size via size property
DataRow2
Extension of standard DataRow, adds row level tap events. Also there're onSecondaryTap and onSecondaryTapDown which are not available in DataCells and which can be useful in Desktop settings when a reaction to the right click is required.
DataTable2
In-place replacement of standard DataTable widget, mimics it API. Has the header row always fixed and core of the table (with data rows) scrollable and stretching to max width/height of it's container. 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.
PaginatedDataTable2
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:
PaginatedDataTable2State
Holds the state of a PaginatedDataTable2.
PaginatorController
Allows to externally control PaginatedDataTable2 state and trigger actions such as changing page number or size. Instatiate an object, keep it somewhere (e.g. parent widgets state or static field/top level variable), pass it to PaginatedDataTable2.controller via constructor and you're ready to go. Please note that there're a few properties that allow to fetch internal state value's (such as rows per page), those values can't be fetched until the controller is attached - this happens during the first call to the build() method of PaginatedDataTable2. The controller extends ChangeNotifier in order to let consumers know if there're changes to PaginatedDataTable2 state. E.g. you can hide standard paginator of PaginatedDataTable2 and simplement your own paginator as a StatefullWidget, subsribe to controller in order to update the paginator.
SyncedScrollControllers
Creates pairs of scroll controllers which can be provided to scrollables and ensure that offset change in one scrollable scroll the second one (and vice a versa) There's a bug (or feature) on iOS with bouncing scroll (when it goes out of range) when scrollable get out of sync while in this bouncing position
SyncedScrollControllersState

Enums

ColumnSize
Relative size of a column determines the share of total table width allocated to each individual column. When determining column widths ratios between S, M and L columns are kept (i.e. Large columns are set to 1.2x width of Medium ones)
PageSyncApproach
Should data source return less rows that ca
SelectionState
AsyncDataTableSource states: none -> toggle/selectAllOnPage -> include include -> toggle/deselectAllOnPage -> no include -> selectAll -> exclude none -> selectAll -> exclude exclude -> deselectAll -> none exclude -> toggle/selectAllOnPage/deselectAllOnPage -> exclude
SourceState

Constants

defaultRowsPerPage → const int
The default value for rowsPerPage.

Properties

dataTableShowLogs bool
getter/setter pair