FirebaseDatabaseDataTable constructor
const
FirebaseDatabaseDataTable({
- Key? key,
- required Query query,
- required Map<
String, Widget> columnLabels, - Widget? header,
- void onError(
- Object error,
- StackTrace stackTrace
- bool canDeleteItems = true,
- List<
Widget> ? actions, - int? sortColumnIndex,
- bool sortAscending = true,
- double dataRowHeight = kMinInteractiveDimension,
- double headingRowHeight = 56.0,
- double horizontalMargin = 24.0,
- double columnSpacing = 56.0,
- bool showCheckboxColumn = true,
- bool showFirstLastButtons = false,
- void onPageChanged(
- int page
- int rowsPerPage = 10,
- DragStartBehavior dragStartBehavior = DragStartBehavior.start,
- Color? arrowHeadColor,
- double? checkboxHorizontalMargin,
A PaginatedDataTable that is connected to Firestore.
The parameter columnLabels is required and is used to
- list the columns.
- give them a label.
- order the columns.
- let FirebaseDatabaseDataTable know what are the expected keys in a Firestore document.
An example usage would be:
// A collection of {'name': string, 'age': number}
final usersCollection = FirebaseDatabase.instance.ref('users');
// ...
FirebaseDatabaseDataTable(
query: usersCollection,
columnLabels: {
'name': Text('User name'),
'age': Text('age'),
},
);
Implementation
const FirebaseDatabaseDataTable({
Key? key,
required this.query,
required this.columnLabels,
this.header,
this.onError,
this.canDeleteItems = true,
this.actions,
this.sortColumnIndex,
this.sortAscending = true,
this.dataRowHeight = kMinInteractiveDimension,
this.headingRowHeight = 56.0,
this.horizontalMargin = 24.0,
this.columnSpacing = 56.0,
this.showCheckboxColumn = true,
this.showFirstLastButtons = false,
this.onPageChanged,
this.rowsPerPage = 10,
this.dragStartBehavior = DragStartBehavior.start,
this.arrowHeadColor,
this.checkboxHorizontalMargin,
}) : assert(
columnLabels is LinkedHashMap,
'only LinkedHashMap are supported as header',
), // using an assert instead of a type because `<A, B>{}` types as `Map` but is an instance of `LinkedHashMap`
super(key: key);