Skip to content

Commit

Permalink
Exposed tooltip longPress action when available (#117338)
Browse files Browse the repository at this point in the history
* Exposed tooltip longPress action when available (Trigger mode is long press)
  • Loading branch information
harperl-lgtm committed Dec 20, 2022
1 parent 7f7a877 commit 38e3930
Show file tree
Hide file tree
Showing 9 changed files with 28 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/flutter/lib/src/material/tooltip.dart
Original file line number Diff line number Diff line change
Expand Up @@ -751,7 +751,7 @@ class TooltipState extends State<Tooltip> with SingleTickerProviderStateMixin {
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.
Expand Down
2 changes: 2 additions & 0 deletions packages/flutter/test/material/back_button_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ void main() {
hasEnabledState: true,
isEnabled: true,
hasTapAction: true,
hasLongPressAction: true,
isFocusable: true,
));
handle.dispose();
Expand Down Expand Up @@ -216,6 +217,7 @@ void main() {
hasEnabledState: true,
isEnabled: true,
hasTapAction: true,
hasLongPressAction: true,
isFocusable: true,
));
handle.dispose();
Expand Down
2 changes: 2 additions & 0 deletions packages/flutter/test/material/calendar_date_picker_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -672,6 +672,7 @@ void main() {
tooltip: 'Previous month',
isButton: true,
hasTapAction: true,
hasLongPressAction: true,
isEnabled: true,
hasEnabledState: true,
isFocusable: true,
Expand All @@ -680,6 +681,7 @@ void main() {
tooltip: 'Next month',
isButton: true,
hasTapAction: true,
hasLongPressAction: true,
isEnabled: true,
hasEnabledState: true,
isFocusable: true,
Expand Down
5 changes: 4 additions & 1 deletion packages/flutter/test/material/chip_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2047,7 +2047,10 @@ void main() {
children: <TestSemantics>[
TestSemantics(
tooltip: 'Delete',
actions: <SemanticsAction>[SemanticsAction.tap],
actions: <SemanticsAction>[
SemanticsAction.tap,
SemanticsAction.longPress
],
textDirection: TextDirection.ltr,
flags: <SemanticsFlag>[
SemanticsFlag.isButton,
Expand Down
2 changes: 2 additions & 0 deletions packages/flutter/test/material/date_picker_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -833,6 +833,7 @@ void main() {
tooltip: 'Switch to input',
isButton: true,
hasTapAction: true,
hasLongPressAction: true,
isEnabled: true,
hasEnabledState: true,
isFocusable: true,
Expand Down Expand Up @@ -876,6 +877,7 @@ void main() {
tooltip: 'Switch to calendar',
isButton: true,
hasTapAction: true,
hasLongPressAction: true,
isEnabled: true,
hasEnabledState: true,
isFocusable: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -699,6 +699,7 @@ void main() {
tooltip: 'Add Photo',
actions: <SemanticsAction>[
SemanticsAction.tap,
SemanticsAction.longPress,
],
flags: <SemanticsFlag>[
SemanticsFlag.hasEnabledState,
Expand Down
5 changes: 4 additions & 1 deletion packages/flutter/test/material/search_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -620,7 +620,10 @@ void main() {
SemanticsFlag.isEnabled,
SemanticsFlag.isFocusable,
],
actions: <SemanticsAction>[SemanticsAction.tap],
actions: <SemanticsAction>[
SemanticsAction.tap,
SemanticsAction.longPress,
],
tooltip: 'Back',
textDirection: TextDirection.ltr,
),
Expand Down
6 changes: 6 additions & 0 deletions packages/flutter/test/material/tooltip_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1450,6 +1450,9 @@ void main() {
id: 1,
tooltip: 'TIP',
textDirection: TextDirection.ltr,
actions: <SemanticsAction>[
SemanticsAction.longPress,
],
),
],
);
Expand Down Expand Up @@ -1650,6 +1653,9 @@ void main() {
tooltip: 'Foo',
label: 'Bar',
textDirection: TextDirection.ltr,
actions: <SemanticsAction>[
SemanticsAction.longPress,
],
),
],
),
Expand Down
6 changes: 6 additions & 0 deletions packages/flutter/test/material/tooltip_theme_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1105,6 +1105,9 @@ void main() {
tooltip: 'Foo',
label: 'Bar',
textDirection: TextDirection.ltr,
actions: <SemanticsAction>[
SemanticsAction.longPress,
],
),
],
),
Expand Down Expand Up @@ -1148,6 +1151,9 @@ void main() {
tooltip: 'Foo',
label: 'Bar',
textDirection: TextDirection.ltr,
actions: <SemanticsAction>[
SemanticsAction.longPress,
],
),
],
),
Expand Down

0 comments on commit 38e3930

Please sign in to comment.