@@ -192,6 +192,8 @@ class InkResponse extends StatefulWidget {
192
192
Key key,
193
193
this .child,
194
194
this .onTap,
195
+ this .onTapDown,
196
+ this .onTapCancel,
195
197
this .onDoubleTap,
196
198
this .onLongPress,
197
199
this .onHighlightChanged,
@@ -218,6 +220,13 @@ class InkResponse extends StatefulWidget {
218
220
/// Called when the user taps this part of the material.
219
221
final GestureTapCallback onTap;
220
222
223
+ /// Called when the user taps down this part of the material.
224
+ final GestureTapDownCallback onTapDown;
225
+
226
+ /// Called when the user cancels a tap that was started on this part of the
227
+ /// material.
228
+ final GestureTapCallback onTapCancel;
229
+
221
230
/// Called when the user double taps this part of the material.
222
231
final GestureTapCallback onDoubleTap;
223
232
@@ -464,6 +473,9 @@ class _InkResponseState<T extends InkResponse> extends State<T> with AutomaticKe
464
473
_splashes ?? = new HashSet <InteractiveInkFeature >();
465
474
_splashes.add (splash);
466
475
_currentSplash = splash;
476
+ if (widget.onTapDown != null ) {
477
+ widget.onTapDown (details);
478
+ }
467
479
updateKeepAlive ();
468
480
updateHighlight (true );
469
481
}
@@ -482,6 +494,9 @@ class _InkResponseState<T extends InkResponse> extends State<T> with AutomaticKe
482
494
void _handleTapCancel () {
483
495
_currentSplash? .cancel ();
484
496
_currentSplash = null ;
497
+ if (widget.onTapCancel != null ) {
498
+ widget.onTapCancel ();
499
+ }
485
500
updateHighlight (false );
486
501
}
487
502
@@ -548,7 +563,7 @@ class _InkResponseState<T extends InkResponse> extends State<T> with AutomaticKe
548
563
///
549
564
/// ![The highlight is a rectangle the size of the box.] (https://flutter.github.io/assets-for-api-docs/material/ink_well.png)
550
565
///
551
- /// The [InkResponse ] widget must have a [Material] widget as an ancestor. The
566
+ /// The [InkWell ] widget must have a [Material] widget as an ancestor. The
552
567
/// [Material] widget is where the ink reactions are actually painted. This
553
568
/// matches the material design premise wherein the [Material] is what is
554
569
/// actually reacting to touches by spreading ink.
@@ -599,6 +614,8 @@ class InkWell extends InkResponse {
599
614
GestureTapCallback onTap,
600
615
GestureTapCallback onDoubleTap,
601
616
GestureLongPressCallback onLongPress,
617
+ GestureTapDownCallback onTapDown,
618
+ GestureTapCancelCallback onTapCancel,
602
619
ValueChanged <bool > onHighlightChanged,
603
620
Color highlightColor,
604
621
Color splashColor,
@@ -613,6 +630,8 @@ class InkWell extends InkResponse {
613
630
onTap: onTap,
614
631
onDoubleTap: onDoubleTap,
615
632
onLongPress: onLongPress,
633
+ onTapDown: onTapDown,
634
+ onTapCancel: onTapCancel,
616
635
onHighlightChanged: onHighlightChanged,
617
636
containedInkWell: true ,
618
637
highlightShape: BoxShape .rectangle,
0 commit comments