async_table

Last updated:

0 purchases

async_table Image
async_table Images
Add to Cart

Description:

async table

Flutter Async Table #




A convenience package over PaginatedDataTable optimized for fetching items asynchronously.
Features #

AsyncTableWidget<T> that wraps a PaginatedDataTable
AsyncTableSource<T> that extends a DataTableSource

Getting started #

Add the package as a dependency in pubspec.yaml

dart pub add async_table
copied to clipboard
Usage #
//An optional wrapper to handle rowsPerPage
RowsPerPageWrapper(
initialRowsPerPage: initialrowsPerPage,
builder: (context, rowsPerPage, setRowsPerPage) {
return AsyncTableWidget<T>(
requestItems: (offset, rowsPerPage) async {
//send a request to the server here
},
//pass rowsPerPage, availableRowsPerPage, onRowsPerPageChanged
rowsPerPage: rowsPerPage,
onRowsPerPageChanged: setRowsPerPage,
//define the columns, and how each column builds the cell
columns: [
AsyncTableColumnDef(
cellBuilder: (context, item) => DataCell(Text(item.id)),
column: const DataColumn(label: Text('Id')),
),
AsyncTableColumnDef(
cellBuilder: (context, item) => DataCell(Text(item.title)),
column: const DataColumn(label: Text('Title')),
),
],
//store the AsyncTableSource<T> after its creation.
initState: (value) => dataSrc = value,
);
}
);
copied to clipboard

License:

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.