-
Notifications
You must be signed in to change notification settings - Fork 26.8k
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 toolbar not showing on drag end #121110
Fix selection toolbar not showing on drag end #121110
Conversation
058d8d1
to
5c017ea
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.
Thank you for fixing this! We totally missed this when implementing the magnifier.
Just a minor comment about the use of pump
in your tests, and you also need to sync with the master branch. Otherwise this should be good to go.
@@ -533,6 +533,7 @@ class SelectableRegionState extends State<SelectableRegion> with TextSelectionDe | |||
} else { | |||
_selectionOverlay!.hideMagnifier(); | |||
_selectionOverlay!.showToolbar( | |||
context: context, |
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 catch, context should be provided when contextMenuBuilder is provided. Thanks!
|
||
await gesture.up(); | ||
await tester.pump(const Duration(milliseconds: 500)); | ||
await tester.pump(const Duration(milliseconds: 500)); |
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.
Can you replace these pump
s with pumpAndSettle
or, if possible, a pump
with no Duration? Ideally we shouldn't have any arbitrary timing things like this unless it's totally necessary.
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 was able to remove most of the pump
s with duration, except for one location. I believe this one is necessary though, because it is also used in other tests.
For example, here:
https://github.com/flutter/flutter/blob/686266e4184a107b5e52ddc871cb5400d8caf9df/packages/flutter/test/material/selection_area_test.dart#L61
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.
Sounds good, it's fine like this then 👍
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 think this particular use of pump
is so the down event is held and detected as a long press.
5c017ea
to
686266e
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 👍
I re-ran two tests that looked like infrastructure flakes.
686266e
to
ae81915
Compare
The test failure is something unrelated that I've seen on another PR as well. Can you push a merge commit? Or a rerun may do it. |
ae81915
to
63b67ba
Compare
@Renzo-Olivares @LongCatIsLooong could you take a look? |
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
Would be good cherry pick candidate IMO |
A new stable release will be cut soon with this fix in it, so I think that will work out and we won't need to cherry pick. Well CC @itsjustkevin in case. I guess it won't be released for awhile. |
Hello, which flutter version fixes this function? |
Looks like this was tagged in 3.9.0-18.0.pre. |
Fixes #119314
The regression was caused initially by this commit: f014c1e
Before
Before, ending the drag didn't show the toolbar, making it impossible to copy the text after adjusting the selection handles.
Screen.Recording.2023-02-20.at.23.32.51.mov
After
Now ending the drag will show the toolbar again:
Screen.Recording.2023-02-20.at.23.29.18.mov
Pre-launch Checklist
///
).