Skip to content

Keep the selection after 'Copy' pressed on iOS.#76327

Merged
fluttergithubbot merged 5 commits intoflutter:masterfrom
justinmc:cupertino-selection-preservation
Feb 23, 2021
Merged

Keep the selection after 'Copy' pressed on iOS.#76327
fluttergithubbot merged 5 commits intoflutter:masterfrom
justinmc:cupertino-selection-preservation

Conversation

@justinmc
Copy link
Contributor

Previously, Flutter hid the toolbar and collapsed the selection after "Copy" was pressed in the text selection toolbar. On native iOS though, the handles should stay visible and the selection should remain.

Screen.Recording.2021-02-18.at.12.16.13.PM.mov

Fixes #72124

@justinmc justinmc self-assigned this Feb 18, 2021
@flutter-dashboard flutter-dashboard bot added f: cupertino flutter/packages/flutter/cupertino repository framework flutter/packages/flutter repository. See also f: labels. labels Feb 18, 2021
@google-cla google-cla bot added the cla: yes label Feb 18, 2021
@@ -774,7 +774,7 @@ abstract class TextSelectionDelegate {
set textEditingValue(TextEditingValue value);

/// Hides the text selection toolbar.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: documentation of the optional parameter.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good call, I think this was a bit confusing overall. I added a bunch of comments to make this more clear, and I renamed the parameter from handlesOnly to hideHandles.

delegate.bringIntoView(delegate.textEditingValue.selection.extent);
// Hide the toolbar, but maintain the existing selection and keep the
// handles on the screen.
delegate.hideToolbar(true);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think ideally this should depend on what platform it is, since the material "copy" should have the same behavior on iOS.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a good point. I can get rid of this handleCopy override entirely then, and just put the switch statement in the main handleCopy for all platforms.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

f: cupertino flutter/packages/flutter/cupertino repository framework flutter/packages/flutter repository. See also f: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Missing selection area of the text after copy text in Flutter on IOS

3 participants