[Re-land] Exposed tooltip longPress (#118796)
* Check whether slider is mounted before interaction, no-op if unmounted (#113556)
* Check whether slider is unmounted before interaction
* Update slider.dart
* Update Slider
* Add test
* Update slider_test.dart
* Update packages/flutter/test/material/slider_test.dart
Co-authored-by: Taha Tesser <tessertaha@gmail.com>
Co-authored-by: Taha Tesser <tessertaha@gmail.com>
* exposed tooltip longPress action when available
* updated tooltip test
* updated date picker test
---------
Co-authored-by: Mingyu <lyming90@gmail.com>
Co-authored-by: Taha Tesser <tessertaha@gmail.com>
Co-authored-by: Harper Liu <harperl0818@gmail.com>
diff --git a/packages/flutter/lib/src/material/tooltip.dart b/packages/flutter/lib/src/material/tooltip.dart
index 12f80d6..af7aba9 100644
--- a/packages/flutter/lib/src/material/tooltip.dart
+++ b/packages/flutter/lib/src/material/tooltip.dart
@@ -751,7 +751,7 @@
behavior: HitTestBehavior.opaque,
onLongPress: (_triggerMode == TooltipTriggerMode.longPress) ? _handlePress : null,
onTap: (_triggerMode == TooltipTriggerMode.tap) ? _handleTap : null,
- excludeFromSemantics: true,
+ excludeFromSemantics: _excludeFromSemantics,
child: result,
);
// Only check for hovering if there is a mouse connected.
diff --git a/packages/flutter/test/material/back_button_test.dart b/packages/flutter/test/material/back_button_test.dart
index 09d9fd1..df7801f 100644
--- a/packages/flutter/test/material/back_button_test.dart
+++ b/packages/flutter/test/material/back_button_test.dart
@@ -172,6 +172,7 @@
hasEnabledState: true,
isEnabled: true,
hasTapAction: true,
+ hasLongPressAction: true,
isFocusable: true,
));
handle.dispose();
@@ -216,6 +217,7 @@
hasEnabledState: true,
isEnabled: true,
hasTapAction: true,
+ hasLongPressAction: true,
isFocusable: true,
));
handle.dispose();
diff --git a/packages/flutter/test/material/calendar_date_picker_test.dart b/packages/flutter/test/material/calendar_date_picker_test.dart
index ac77882..fe6d1eb 100644
--- a/packages/flutter/test/material/calendar_date_picker_test.dart
+++ b/packages/flutter/test/material/calendar_date_picker_test.dart
@@ -672,6 +672,7 @@
tooltip: 'Previous month',
isButton: true,
hasTapAction: true,
+ hasLongPressAction: true,
isEnabled: true,
hasEnabledState: true,
isFocusable: true,
@@ -680,6 +681,7 @@
tooltip: 'Next month',
isButton: true,
hasTapAction: true,
+ hasLongPressAction: true,
isEnabled: true,
hasEnabledState: true,
isFocusable: true,
diff --git a/packages/flutter/test/material/chip_test.dart b/packages/flutter/test/material/chip_test.dart
index 27daaf4..4d4abbc 100644
--- a/packages/flutter/test/material/chip_test.dart
+++ b/packages/flutter/test/material/chip_test.dart
@@ -2047,7 +2047,10 @@
children: <TestSemantics>[
TestSemantics(
tooltip: 'Delete',
- actions: <SemanticsAction>[SemanticsAction.tap],
+ actions: <SemanticsAction>[
+ SemanticsAction.tap,
+ SemanticsAction.longPress
+ ],
textDirection: TextDirection.ltr,
flags: <SemanticsFlag>[
SemanticsFlag.isButton,
diff --git a/packages/flutter/test/material/date_picker_test.dart b/packages/flutter/test/material/date_picker_test.dart
index 648080c..b6b6bce 100644
--- a/packages/flutter/test/material/date_picker_test.dart
+++ b/packages/flutter/test/material/date_picker_test.dart
@@ -833,6 +833,7 @@
tooltip: 'Switch to input',
isButton: true,
hasTapAction: true,
+ hasLongPressAction: true,
isEnabled: true,
hasEnabledState: true,
isFocusable: true,
@@ -876,6 +877,7 @@
tooltip: 'Switch to calendar',
isButton: true,
hasTapAction: true,
+ hasLongPressAction: true,
isEnabled: true,
hasEnabledState: true,
isFocusable: true,
diff --git a/packages/flutter/test/material/floating_action_button_test.dart b/packages/flutter/test/material/floating_action_button_test.dart
index 3a18270..15b4f27 100644
--- a/packages/flutter/test/material/floating_action_button_test.dart
+++ b/packages/flutter/test/material/floating_action_button_test.dart
@@ -700,6 +700,7 @@
tooltip: 'Add Photo',
actions: <SemanticsAction>[
SemanticsAction.tap,
+ SemanticsAction.longPress,
],
flags: <SemanticsFlag>[
SemanticsFlag.hasEnabledState,
diff --git a/packages/flutter/test/material/search_test.dart b/packages/flutter/test/material/search_test.dart
index 19f03af..a3d1c60 100644
--- a/packages/flutter/test/material/search_test.dart
+++ b/packages/flutter/test/material/search_test.dart
@@ -620,7 +620,10 @@
SemanticsFlag.isEnabled,
SemanticsFlag.isFocusable,
],
- actions: <SemanticsAction>[SemanticsAction.tap],
+ actions: <SemanticsAction>[
+ SemanticsAction.tap,
+ SemanticsAction.longPress,
+ ],
tooltip: 'Back',
textDirection: TextDirection.ltr,
),
diff --git a/packages/flutter/test/material/tooltip_test.dart b/packages/flutter/test/material/tooltip_test.dart
index 5500883..dcb2c66 100644
--- a/packages/flutter/test/material/tooltip_test.dart
+++ b/packages/flutter/test/material/tooltip_test.dart
@@ -1418,6 +1418,9 @@
id: 1,
tooltip: 'TIP',
textDirection: TextDirection.ltr,
+ actions: <SemanticsAction>[
+ SemanticsAction.longPress,
+ ],
),
],
);
@@ -1618,6 +1621,9 @@
tooltip: 'Foo',
label: 'Bar',
textDirection: TextDirection.ltr,
+ actions: <SemanticsAction>[
+ SemanticsAction.longPress,
+ ],
),
],
),
diff --git a/packages/flutter/test/material/tooltip_theme_test.dart b/packages/flutter/test/material/tooltip_theme_test.dart
index 4595bda..d26a8d3 100644
--- a/packages/flutter/test/material/tooltip_theme_test.dart
+++ b/packages/flutter/test/material/tooltip_theme_test.dart
@@ -1075,6 +1075,9 @@
tooltip: 'Foo',
label: 'Bar',
textDirection: TextDirection.ltr,
+ actions: <SemanticsAction>[
+ SemanticsAction.longPress,
+ ],
),
],
),
@@ -1118,6 +1121,9 @@
tooltip: 'Foo',
label: 'Bar',
textDirection: TextDirection.ltr,
+ actions: <SemanticsAction>[
+ SemanticsAction.longPress,
+ ],
),
],
),