DataRow class

An enhanced version of Flutter's standard DataRow with additional functionality.

This class extends Flutter's DataRow with row-level tap events and customization options. It adds support for right-click (secondary tap) events, double-tap events, specific row heights, and custom decorations.

See also:

  • doc/component/data_table.md for more detailed documentation
  • DataTable, which uses these rows
Inheritance
Annotations

Constructors

DataRow.new({LocalKey? key, bool selected = false, ValueChanged<bool?>? onSelectChanged, MaterialStateProperty<Color?>? color, Decoration? decoration, required List<DataCell> cells, double? specificRowHeight, GestureTapCallback? onTap, GestureTapCallback? onDoubleTap, GestureLongPressCallback? onLongPress, GestureTapCallback? onSecondaryTap, GestureTapDownCallback? onSecondaryTapDown})
Creates the configuration for a row of a DataTable.
const
DataRow.byIndex({int? index, bool selected = false, ValueChanged<bool?>? onSelectChanged, MaterialStateProperty<Color?>? color, Decoration? decoration, required List<DataCell> cells, double? specificRowHeight, GestureTapCallback? onTap, GestureTapCallback? onDoubleTap, GestureLongPressCallback? onLongPress, GestureTapCallback? onSecondaryTap, GestureTapDownCallback? onSecondaryTapDown})
Creates a DataRow for a DataTable with a specific index.

Properties

cells List<DataCell>
The data for this row.
finalinherited
color MaterialStateProperty<Color?>?
The color for the row.
finalinherited
decoration Decoration?
Custom decoration to be applied to this row.
final
hashCode int
The hash code for this object.
no setterinherited
key LocalKey?
A Key that uniquely identifies this row. This is used to ensure that if a row is added or removed, any stateful widgets related to this row (e.g. an in-progress checkbox animation) remain on the right row visually.
finalinherited
mouseCursor MaterialStateProperty<MouseCursor?>?
The cursor for a mouse pointer when it enters or is hovering over the data row.
finalinherited
onDoubleTap GestureTapCallback?
Callback function when the row is double-tapped.
final
onLongPress GestureLongPressCallback?
Called if the row is long-pressed.
finalinherited
onSecondaryTap GestureTapCallback?
Callback function when the row is right-clicked.
final
onSecondaryTapDown GestureTapDownCallback?
Callback function when the right mouse button is pressed down on this row.
final
onSelectChanged ValueChanged<bool?>?
Called when the user selects or unselects a selectable row.
finalinherited
onTap GestureTapCallback?
Callback function when the row is tapped.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
selected bool
Whether the row is selected.
finalinherited
specificRowHeight double?
Specific height for this row in pixels.
final

Methods

clone({LocalKey? key, bool? selected, ValueChanged<bool?>? onSelectChanged, WidgetStateProperty<Color?>? color, Decoration? decoration, List<DataCell>? cells, double? specificRowHeight, GestureTapCallback? onTap, GestureTapCallback? onDoubleTap, GestureLongPressCallback? onLongPress, GestureTapCallback? onSecondaryTap, GestureTapDownCallback? onSecondaryTapDown}) DataRow
Creates a copy of this row with the given fields replaced with new values.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

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