@@ -148,6 +148,7 @@ class DataRow {
148
148
this .selected = false ,
149
149
this .onSelectChanged,
150
150
this .onLongPress,
151
+ this .onHover,
151
152
this .color,
152
153
this .mouseCursor,
153
154
required this .cells,
@@ -160,6 +161,7 @@ class DataRow {
160
161
this .selected = false ,
161
162
this .onSelectChanged,
162
163
this .onLongPress,
164
+ this .onHover,
163
165
this .color,
164
166
this .mouseCursor,
165
167
required this .cells,
@@ -200,6 +202,12 @@ class DataRow {
200
202
/// that particular cell.
201
203
final GestureLongPressCallback ? onLongPress;
202
204
205
+ /// Called when a pointer enters or exits the row.
206
+ ///
207
+ /// The boolean value passed to the callback is true if a pointer has entered the row and false
208
+ /// when a pointer has exited the row.
209
+ final ValueChanged <bool >? onHover;
210
+
203
211
/// Whether the row is selected.
204
212
///
205
213
/// If [onSelectChanged] is non-null for any row in the table, then
@@ -951,6 +959,7 @@ class DataTable extends StatelessWidget {
951
959
required GestureTapCancelCallback ? onTapCancel,
952
960
required MaterialStateProperty <Color ?>? overlayColor,
953
961
required GestureLongPressCallback ? onRowLongPress,
962
+ required ValueChanged <bool >? onRowHover,
954
963
required MouseCursor ? mouseCursor,
955
964
}) {
956
965
final ThemeData themeData = Theme .of (context);
@@ -1007,10 +1016,11 @@ class DataTable extends StatelessWidget {
1007
1016
overlayColor: overlayColor,
1008
1017
child: label,
1009
1018
);
1010
- } else if (onSelectChanged != null || onRowLongPress != null ) {
1019
+ } else if (onSelectChanged != null || onRowLongPress != null || onRowHover != null ) {
1011
1020
label = TableRowInkWell (
1012
1021
onTap: onSelectChanged,
1013
1022
onLongPress: onRowLongPress,
1023
+ onHover: onRowHover,
1014
1024
overlayColor: overlayColor,
1015
1025
mouseCursor: mouseCursor,
1016
1026
child: label,
@@ -1223,6 +1233,7 @@ class DataTable extends StatelessWidget {
1223
1233
: () => row.onSelectChanged? .call (! row.selected),
1224
1234
overlayColor: row.color ?? effectiveDataRowColor,
1225
1235
onRowLongPress: row.onLongPress,
1236
+ onRowHover: row.onHover,
1226
1237
mouseCursor:
1227
1238
row.mouseCursor? .resolve (states) ?? dataTableTheme.dataRowCursor? .resolve (states),
1228
1239
);
@@ -1276,6 +1287,7 @@ class TableRowInkWell extends InkResponse {
1276
1287
super .onDoubleTap,
1277
1288
super .onLongPress,
1278
1289
super .onHighlightChanged,
1290
+ super .onHover,
1279
1291
super .onSecondaryTap,
1280
1292
super .onSecondaryTapDown,
1281
1293
super .overlayColor,
0 commit comments