Unverified Commit d2788080 authored by Eilidh Southren's avatar Eilidh Southren Committed by GitHub

[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: 's avatarTaha Tesser <tessertaha@gmail.com>
Co-authored-by: 's avatarTaha Tesser <tessertaha@gmail.com>

* exposed tooltip longPress action when available

* updated tooltip test

* updated date picker test

---------
Co-authored-by: 's avatarMingyu <lyming90@gmail.com>
Co-authored-by: 's avatarTaha Tesser <tessertaha@gmail.com>
Co-authored-by: 's avatarHarper Liu <harperl0818@gmail.com>
parent 3af30ff5
...@@ -751,7 +751,7 @@ class TooltipState extends State<Tooltip> with SingleTickerProviderStateMixin { ...@@ -751,7 +751,7 @@ class TooltipState extends State<Tooltip> with SingleTickerProviderStateMixin {
behavior: HitTestBehavior.opaque, behavior: HitTestBehavior.opaque,
onLongPress: (_triggerMode == TooltipTriggerMode.longPress) ? _handlePress : null, onLongPress: (_triggerMode == TooltipTriggerMode.longPress) ? _handlePress : null,
onTap: (_triggerMode == TooltipTriggerMode.tap) ? _handleTap : null, onTap: (_triggerMode == TooltipTriggerMode.tap) ? _handleTap : null,
excludeFromSemantics: true, excludeFromSemantics: _excludeFromSemantics,
child: result, child: result,
); );
// Only check for hovering if there is a mouse connected. // Only check for hovering if there is a mouse connected.
......
...@@ -172,6 +172,7 @@ void main() { ...@@ -172,6 +172,7 @@ void main() {
hasEnabledState: true, hasEnabledState: true,
isEnabled: true, isEnabled: true,
hasTapAction: true, hasTapAction: true,
hasLongPressAction: true,
isFocusable: true, isFocusable: true,
)); ));
handle.dispose(); handle.dispose();
...@@ -216,6 +217,7 @@ void main() { ...@@ -216,6 +217,7 @@ void main() {
hasEnabledState: true, hasEnabledState: true,
isEnabled: true, isEnabled: true,
hasTapAction: true, hasTapAction: true,
hasLongPressAction: true,
isFocusable: true, isFocusable: true,
)); ));
handle.dispose(); handle.dispose();
......
...@@ -672,6 +672,7 @@ void main() { ...@@ -672,6 +672,7 @@ void main() {
tooltip: 'Previous month', tooltip: 'Previous month',
isButton: true, isButton: true,
hasTapAction: true, hasTapAction: true,
hasLongPressAction: true,
isEnabled: true, isEnabled: true,
hasEnabledState: true, hasEnabledState: true,
isFocusable: true, isFocusable: true,
...@@ -680,6 +681,7 @@ void main() { ...@@ -680,6 +681,7 @@ void main() {
tooltip: 'Next month', tooltip: 'Next month',
isButton: true, isButton: true,
hasTapAction: true, hasTapAction: true,
hasLongPressAction: true,
isEnabled: true, isEnabled: true,
hasEnabledState: true, hasEnabledState: true,
isFocusable: true, isFocusable: true,
......
...@@ -2047,7 +2047,10 @@ void main() { ...@@ -2047,7 +2047,10 @@ void main() {
children: <TestSemantics>[ children: <TestSemantics>[
TestSemantics( TestSemantics(
tooltip: 'Delete', tooltip: 'Delete',
actions: <SemanticsAction>[SemanticsAction.tap], actions: <SemanticsAction>[
SemanticsAction.tap,
SemanticsAction.longPress
],
textDirection: TextDirection.ltr, textDirection: TextDirection.ltr,
flags: <SemanticsFlag>[ flags: <SemanticsFlag>[
SemanticsFlag.isButton, SemanticsFlag.isButton,
......
...@@ -833,6 +833,7 @@ void main() { ...@@ -833,6 +833,7 @@ void main() {
tooltip: 'Switch to input', tooltip: 'Switch to input',
isButton: true, isButton: true,
hasTapAction: true, hasTapAction: true,
hasLongPressAction: true,
isEnabled: true, isEnabled: true,
hasEnabledState: true, hasEnabledState: true,
isFocusable: true, isFocusable: true,
...@@ -876,6 +877,7 @@ void main() { ...@@ -876,6 +877,7 @@ void main() {
tooltip: 'Switch to calendar', tooltip: 'Switch to calendar',
isButton: true, isButton: true,
hasTapAction: true, hasTapAction: true,
hasLongPressAction: true,
isEnabled: true, isEnabled: true,
hasEnabledState: true, hasEnabledState: true,
isFocusable: true, isFocusable: true,
......
...@@ -700,6 +700,7 @@ void main() { ...@@ -700,6 +700,7 @@ void main() {
tooltip: 'Add Photo', tooltip: 'Add Photo',
actions: <SemanticsAction>[ actions: <SemanticsAction>[
SemanticsAction.tap, SemanticsAction.tap,
SemanticsAction.longPress,
], ],
flags: <SemanticsFlag>[ flags: <SemanticsFlag>[
SemanticsFlag.hasEnabledState, SemanticsFlag.hasEnabledState,
......
...@@ -620,7 +620,10 @@ void main() { ...@@ -620,7 +620,10 @@ void main() {
SemanticsFlag.isEnabled, SemanticsFlag.isEnabled,
SemanticsFlag.isFocusable, SemanticsFlag.isFocusable,
], ],
actions: <SemanticsAction>[SemanticsAction.tap], actions: <SemanticsAction>[
SemanticsAction.tap,
SemanticsAction.longPress,
],
tooltip: 'Back', tooltip: 'Back',
textDirection: TextDirection.ltr, textDirection: TextDirection.ltr,
), ),
......
...@@ -1418,6 +1418,9 @@ void main() { ...@@ -1418,6 +1418,9 @@ void main() {
id: 1, id: 1,
tooltip: 'TIP', tooltip: 'TIP',
textDirection: TextDirection.ltr, textDirection: TextDirection.ltr,
actions: <SemanticsAction>[
SemanticsAction.longPress,
],
), ),
], ],
); );
...@@ -1618,6 +1621,9 @@ void main() { ...@@ -1618,6 +1621,9 @@ void main() {
tooltip: 'Foo', tooltip: 'Foo',
label: 'Bar', label: 'Bar',
textDirection: TextDirection.ltr, textDirection: TextDirection.ltr,
actions: <SemanticsAction>[
SemanticsAction.longPress,
],
), ),
], ],
), ),
......
...@@ -1075,6 +1075,9 @@ void main() { ...@@ -1075,6 +1075,9 @@ void main() {
tooltip: 'Foo', tooltip: 'Foo',
label: 'Bar', label: 'Bar',
textDirection: TextDirection.ltr, textDirection: TextDirection.ltr,
actions: <SemanticsAction>[
SemanticsAction.longPress,
],
), ),
], ],
), ),
...@@ -1118,6 +1121,9 @@ void main() { ...@@ -1118,6 +1121,9 @@ void main() {
tooltip: 'Foo', tooltip: 'Foo',
label: 'Bar', label: 'Bar',
textDirection: TextDirection.ltr, textDirection: TextDirection.ltr,
actions: <SemanticsAction>[
SemanticsAction.longPress,
],
), ),
], ],
), ),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment