-
Notifications
You must be signed in to change notification settings - Fork 29.4k
Fix selection handles showing when using a mouse #168751
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix selection handles showing when using a mouse #168751
Conversation
0746422 to
7f019f6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍. Thanks for fixing my issue so quick!
| _shouldShowSelectionHandles = | ||
| details.kind == null || | ||
| details.kind == PointerDeviceKind.touch || | ||
| details.kind == PointerDeviceKind.stylus; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I double checked this on native Android and indeed the selection handles show when using a stylus. Good call.
| /// [onDragSelectionStart], is called. This getter will return true if the | ||
| /// current [onTapDown], [onSecondaryTapDown], or [onDragSelectionStart] event | ||
| /// is triggered by a touch or a stylus. | ||
| bool get shouldShowSelectionHandles => _shouldShowSelectionHandles; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree it's worth it to expose this 👍 .
| testWidgets( | ||
| 'Selection handles should not show when using a mouse on Apple platforms using Flutter context menu', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this test separate from the previous test because iOS uses the system context menu?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No its mostly separate because of cupertino vs material toolbar. I don't think we can test this specific scenario using the system rendered context menu on iOS since from my understanding they wouldn't show up in a widget test because SystemContextMenu only builds a SizedBox.shrink(). I did try to verify it myself on device and found the behavior is a bit buggy, I opened an issue here with more details and a possible solution (using custom buttons) #168857 .
| await tester.tapAt(firstBlah, kind: PointerDeviceKind.mouse, buttons: kSecondaryMouseButton); | ||
| await tester.pumpAndSettle(); | ||
|
|
||
| switch (defaultTargetPlatform) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you need this switch if variant says it's always iOS?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good point!
933409c to
93a7d39
Compare
93a7d39 to
cdfb4b2
Compare
Fixes #168252
Pre-launch Checklist
///).