EnhancedDataTable<T> class
A feature-rich data table with sorting, selection, pagination, and export.
EnhancedDataTable<DataRow>(
columns: [
DataColumn(label: 'Name', sortable: true),
DataColumn(label: 'Email'),
DataColumn(label: 'Role', sortable: true),
],
rows: [
DataRow(cells: [DataCell(Text('John')), DataCell(Text('john@x.com')), DataCell(Text('Admin'))]),
],
selectable: true,
onSelectionChanged: (selected) { ... },
)
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- EnhancedDataTable
- Available extensions
Constructors
-
EnhancedDataTable({Key? key, required List<
DataColumn> columns, required List<DataRow> rows, int? sortColumnIndex, bool sortAscending = true, void onSort(int columnIndex, bool ascending)?, bool selectable = false, void onSelectionChanged(Set<int> selectedIndices)?, Set<int> selectedRows = const <int>{}, void onRowTap(int index)?, void onRowDoubleTap(int index)?, void onRowLongPress(int index)?, TablePagination? pagination, void onPageChanged(int index)?, bool exportEnabled = false, void onExport(TableExportFormat format)?, Widget? emptyStateWidget, bool loading = false, Widget? header, List<Widget> ? actions, CrossAxisAlignment checkboxVerticalAlignment = CrossAxisAlignment.center, double? dataRowHeight, double headingRowHeight = 56, double dividerThickness = 1, bool showCheckboxColumn = true, TableBorder? border, Clip clipBehavior = Clip.none, bool shrinkWrap = false, ScrollPhysics? scrollPhysics, ScrollController? scrollController}) -
const
Properties
-
actions
→ List<
Widget> ? -
Action buttons in the header.
final
- border → TableBorder?
-
Table border.
final
- centered → Widget
-
Available on Widget, provided by the WidgetX extension
Wraps the widget in a Center.no setter - checkboxVerticalAlignment → CrossAxisAlignment
-
Checkbox vertical alignment.
final
- clipBehavior → Clip
-
Clip behavior.
final
-
columns
→ List<
DataColumn> -
Column definitions.
final
- dataRowHeight → double?
-
Data row height.
final
- dividerThickness → double
-
Divider thickness.
final
- emptyStateWidget → Widget?
-
Widget to show when the table is empty.
final
- exportEnabled → bool
-
Whether to show export buttons.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- header → Widget?
-
Optional header widget above the table.
final
- headingRowHeight → double
-
Heading row height.
final
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- loading → bool
-
Whether the table is in loading state.
final
- onExport → void Function(TableExportFormat format)?
-
Custom export handler. If null, defaults to clipboard copy.
final
- onPageChanged → void Function(int index)?
-
Callback when the page changes.
final
- onRowDoubleTap → void Function(int index)?
-
Callback when a row is double-tapped.
final
- onRowLongPress → void Function(int index)?
-
Callback when a row is long-pressed.
final
- onRowTap → void Function(int index)?
-
Callback when a row is tapped.
final
-
onSelectionChanged
→ void Function(Set<
int> selectedIndices)? -
Callback when selection changes.
final
- onSort → void Function(int columnIndex, bool ascending)?
-
Callback when a sortable column header is tapped.
final
- pagination → TablePagination?
-
Pagination configuration.
final
- repaint → Widget
-
Available on Widget, provided by the WidgetX extension
Wraps in RepaintBoundary to isolate repaints.no setter -
rows
→ List<
DataRow> -
Row data.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- scrollController → ScrollController?
-
Scroll controller.
final
- scrollPhysics → ScrollPhysics?
-
Scroll physics.
final
- selectable → bool
-
Whether rows are selectable with checkboxes.
final
-
selectedRows
→ Set<
int> -
Set of initially selected row indices.
final
- showCheckboxColumn → bool
-
Whether to show the checkbox column.
final
- shrinkWrap → bool
-
Whether the table should shrink-wrap.
final
- sortAscending → bool
-
Sort direction.
final
- sortColumnIndex → int?
-
Currently sorted column index.
final
Methods
-
animatedSwitcher(
{Duration duration = const Duration(milliseconds: 300), AnimatedSwitcherTransitionBuilder transitionBuilder = _defaultAnimatedSwitcherTransition, AnimatedSwitcherLayoutBuilder layoutBuilder = AnimatedSwitcher.defaultLayoutBuilder}) → Widget -
Available on Widget, provided by the WidgetX extension
Wraps in an AnimatedSwitcher withdurationand default fade. -
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → State< EnhancedDataTable< T> > -
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
-
expanded(
{int flex = 1}) → Widget -
Available on Widget, provided by the WidgetX extension
Expands the widget inside a Flex parent. -
fadeIn(
{double opacity = 1, Duration duration = const Duration(milliseconds: 300), Curve curve = Curves.easeIn}) → Widget -
Available on Widget, provided by the WidgetAnimateX extension
Wraps in an AnimatedOpacity. -
flexible(
{int flex = 1, FlexFit fit = FlexFit.loose}) → Widget -
Available on Widget, provided by the WidgetX extension
Applies flexible sizing. -
keyed(
Object key) → Widget -
Available on Widget, provided by the WidgetX extension
Wraps the widget in a KeyedSubtree withkey. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
onTap(
VoidCallback onTap, {HitTestBehavior behavior = HitTestBehavior.opaque}) → Widget -
Available on Widget, provided by the WidgetX extension
Wraps the widget in GestureDetector withonTap. -
pad(
{double horizontal = 0, double vertical = 0}) → Widget - Applies symmetric padding.
-
padded(
[double padding = AppSpacing.lg]) → Widget -
Available on Widget, provided by the WidgetX extension
Applies uniformpadding. -
scaleOnTap(
{double scale = 0.95, required VoidCallback onTap, Duration duration = const Duration(milliseconds: 150)}) → Widget -
Available on Widget, provided by the WidgetAnimateX extension
Wraps in an AnimatedScale. -
semantics(
{required String label, bool button = false}) → Widget -
Available on Widget, provided by the WidgetX extension
Wraps in a Semantics node withlabel. -
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
-
visible(
{bool condition = true}) → Widget -
Available on Widget, provided by the WidgetX extension
Hides the widget entirely whenconditionis false. -
withPadding(
EdgeInsetsGeometry padding) → Widget -
Available on Widget, provided by the WidgetX extension
Appliespaddingonly.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited