我的PaginatedDataTable
小部件:
var shopData = ShopDataSource();
return PaginatedDataTable(
header: Text('Shops'),
columns: [
DataColumn(label: Text('Shop')),
DataColumn(label: Text('Type')),
DataColumn(label: Text('Location')),
DataColumn(label: Text('Status')),
DataColumn(label: Text('Actions')),
],
rowsPerPage: 5,
source: shopData,
);
ShopDataSource
类扩展DataTableSource
如下:
class ShopDataSource extends DataTableSource {
var _shops;
// fetch data from provider
var docProvider = Provider.of(context);
DataRow getRow(int index) {
return DataRow.byIndex(cells: [
// dataCells
], index: index);
}
@override
bool get isRowCountApproximate => false;
@override
int get rowCount => _shops.length;
@override
int get selectedRowCount => 0;
}
我的问题:如何从 DataProvider 类获取数据到DataCell
s.
或者
Firestore
任何从有StreamBuilder
或没有此获取数据的替代方式。