DataTable constructor

DataTable({
  1. required List<TableColumn> columns,
  2. List<TableRowData> rows = const [],
  3. bool loading = false,
  4. Object? emptyState,
  5. Object? loadingState,
  6. String? className,
  7. Map<String, Object?> props = const {},
  8. Map<String, Object?> style = const {},
  9. DartStyle? dartStyle,
  10. String? tableClassName,
  11. Map<String, Object?> tableProps = const {},
  12. Map<String, Object?> tableStyle = const {},
  13. DartStyle? tableDartStyle,
  14. String? headerClassName,
  15. Map<String, Object?> headerStyle = const {},
  16. DartStyle? headerDartStyle,
  17. String? rowClassName,
  18. String? selectedRowClassName,
  19. Map<String, Object?> rowStyle = const {},
  20. Map<String, Object?> selectedRowStyle = const {},
  21. DartStyle? rowDartStyle,
  22. DartStyle? selectedRowDartStyle,
  23. String? cellClassName,
  24. Map<String, Object?> cellStyle = const {},
  25. DartStyle? cellDartStyle,
  26. void onRowClick(
    1. Object event,
    2. TableRowData row
    )?,
})

Creates a data table with Flint UI defaults.

Implementation

DataTable({
  required List<TableColumn> columns,
  List<TableRowData> rows = const [],
  bool loading = false,
  Object? emptyState,
  Object? loadingState,
  String? className,
  Map<String, Object?> props = const {},
  Map<String, Object?> style = const {},
  DartStyle? dartStyle,
  String? tableClassName,
  Map<String, Object?> tableProps = const {},
  Map<String, Object?> tableStyle = const {},
  DartStyle? tableDartStyle,
  String? headerClassName,
  Map<String, Object?> headerStyle = const {},
  DartStyle? headerDartStyle,
  String? rowClassName,
  String? selectedRowClassName,
  Map<String, Object?> rowStyle = const {},
  Map<String, Object?> selectedRowStyle = const {},
  DartStyle? rowDartStyle,
  DartStyle? selectedRowDartStyle,
  String? cellClassName,
  Map<String, Object?> cellStyle = const {},
  DartStyle? cellDartStyle,
  void Function(Object event, TableRowData row)? onRowClick,
}) : super(
       columns: columns,
       rows: rows,
       loading: loading,
       emptyState:
           emptyState ??
           EmptyState(
             title: 'No data',
             message: 'There are no records to show yet.',
           ),
       loadingState:
           loadingState ??
           FlintElement(
             'div',
             props: const {
               'style': {
                 'display': 'flex',
                 'align-items': 'center',
                 'gap': '8px',
                 'padding': '16px',
               },
             },
             children: [Spinner(), const FlintText('Loading data...')],
           ),
       className: className,
       props: props,
       style: style,
       dartStyle: dartStyle,
       tableClassName: tableClassName,
       tableProps: tableProps,
       tableStyle: tableStyle,
       tableDartStyle: tableDartStyle,
       headerClassName: headerClassName,
       headerStyle: headerStyle,
       headerDartStyle: headerDartStyle,
       rowClassName: rowClassName,
       selectedRowClassName: selectedRowClassName,
       rowStyle: rowStyle,
       selectedRowStyle: selectedRowStyle,
       rowDartStyle: rowDartStyle,
       selectedRowDartStyle: selectedRowDartStyle,
       cellClassName: cellClassName,
       cellStyle: cellStyle,
       cellDartStyle: cellDartStyle,
       onRowClick: onRowClick,
     );