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 super.columns,
  super.rows = const [],
  super.loading = false,
  Object? emptyState,
  Object? loadingState,
  super.className,
  super.props = const {},
  super.style = const {},
  super.dartStyle,
  super.tableClassName,
  super.tableProps = const {},
  super.tableStyle = const {},
  super.tableDartStyle,
  super.headerClassName,
  super.headerStyle = const {},
  super.headerDartStyle,
  super.rowClassName,
  super.selectedRowClassName,
  super.rowStyle = const {},
  super.selectedRowStyle = const {},
  super.rowDartStyle,
  super.selectedRowDartStyle,
  super.cellClassName,
  super.cellStyle = const {},
  super.cellDartStyle,
  super.onRowClick,
}) : super(
        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...')],
            ),
      );