ModulaDataTable class

A customizable data table widget for displaying tabular data

Example:

ModulaDataTable(
  columns: [
    ModulaDataColumn(label: 'Name', field: 'name'),
    ModulaDataColumn(label: 'Age', field: 'age'),
  ],
  rows: [
    {'name': 'John', 'age': 25},
    {'name': 'Jane', 'age': 30},
  ],
  showCheckbox: true,
  sortable: true,
)
Inheritance

Constructors

ModulaDataTable({required List<ModulaDataColumn> columns, required List<Map<String, dynamic>> rows, Key? key, bool showCheckbox = false, bool sortable = false, bool hoverEnable = true, bool striped = false, ModulaDataTableBorder border = ModulaDataTableBorder.horizontal, ModulaDataTableSize size = ModulaDataTableSize.medium, void onRowSelected(int index, {required bool selected})?, void onSelectAll({required bool selected})?, void onRowTap(int index, Map<String, dynamic> row)?, void onSort(String field, {required bool ascending})?, String? sortedField, bool sortAscending = true, Set<int> selectedRows = const {}, Widget? emptyWidget, bool showPagination = false, int currentPage = 1, int rowsPerPage = 10, int? totalRows, void onPageChanged(int page)?})
const

Properties

border ModulaDataTableBorder
Border style
final
columns List<ModulaDataColumn>
List of column definitions
final
currentPage int
Current page (1-indexed)
final
emptyWidget Widget?
Custom empty state widget
final
hashCode int
The hash code for this object.
no setterinherited
hoverEnable bool
Whether to show row hover effect
final
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
onPageChanged → void Function(int page)?
Callback when page changes
final
onRowSelected → void Function(int index, {required bool selected})?
Callback when a row is selected
final
onRowTap → void Function(int index, Map<String, dynamic> row)?
Callback when a row is tapped
final
onSelectAll → void Function({required bool selected})?
Callback when all rows are selected
final
onSort → void Function(String field, {required bool ascending})?
Callback when sort is triggered
final
rows List<Map<String, dynamic>>
List of row data (each row is a Map)
final
rowsPerPage int
Rows per page
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
selectedRows Set<int>
Selected row indices
final
showCheckbox bool
Whether to show selection checkboxes
final
showPagination bool
Whether to show pagination controls
final
size ModulaDataTableSize
Table size/density
final
sortable bool
Whether columns are sortable
final
sortAscending bool
Sort direction (true = ascending)
final
sortedField String?
Currently sorted field
final
striped bool
Whether to show zebra striping
final
totalRows int?
Total number of rows (for pagination)
final

Methods

createElement() StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() State<ModulaDataTable>
Creates the mutable state for this widget at a given location in the tree.
override
debugDescribeChildren() List<DiagnosticsNode>
Returns a list of DiagnosticsNode objects describing this node's children.
inherited
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toDiagnosticsNode({String? name, DiagnosticsTreeStyle? style}) DiagnosticsNode
Returns a debug representation of the object that is used by debugging tools and by DiagnosticsNode.toStringDeep.
inherited
toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) String
A string representation of this object.
inherited
toStringDeep({String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug, int wrapWidth = 65}) String
Returns a string representation of this node and its descendants.
inherited
toStringShallow({String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) String
Returns a one-line detailed description of the object.
inherited
toStringShort() String
A short, textual description of this widget.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited