-
Notifications
You must be signed in to change notification settings - Fork 29.7k
[framework] Add Look Up to selection controls for iOS #130532
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
[framework] Add Look Up to selection controls for iOS #130532
Conversation
| return false; | ||
| } | ||
| return !widget.obscureText | ||
| && !textEditingValue.selection.isCollapsed; |
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.
what does collapsed mean?
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.
Collapsed means when the selection is empty - i.e when the selection "bars" don't contain at least one character/whitespace
|
|
||
| /// Look Up current selection. | ||
| Future<void> lookUpSelection(SelectionChangedCause cause) async { | ||
| if (widget.obscureText) { |
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.
should we assert it's not obscured here?
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.
In production mode, if this somehow gets called when obscureText is true, then I guess we should do nothing and not make the platform channel call? If so then we still need this early return. Maybe an assertion and an early return both?
| if (widget.obscureText) { | ||
| return; | ||
| } | ||
| final String text = textEditingValue.selection.textInside(textEditingValue.text); |
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 we need to check text not empty?
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.
You shouldn't be able to get here if the text is empty cuz I think that would mean the selection is collapsed - but I will add a check just in case 👀
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.
+1 for a check. I guess someone could just directly call this when the selection is collapsed since it's public.
| ); | ||
|
|
||
| final RenderEditable renderEditable = findRenderEditable(tester); | ||
| final bool isTargetPlatformMobile = defaultTargetPlatform == TargetPlatform.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.
isTargetPlatformIOS?
| "searchTextFieldPlaceholderLabel": "సెర్చ్ చేయి", | ||
| "noSpellCheckReplacementsLabel": "No Replacements Found" | ||
| "noSpellCheckReplacementsLabel": "No Replacements Found", | ||
| "lookUpButtonLabel": "Look Up" |
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.
some of these files seem to be localized properly.
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.
not entirely sure how to handle the translation. @justinmc probably knows
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 believe the english is the default and it gets properly localized at a later date
This is what I followed https://github.com/flutter/flutter/tree/master/packages/flutter_localizations#adding-a-new-string-to-localizations
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.
Also I added both material and cupertino translations - is that right or do I only need one of them?
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 you're right but I always mess this up. @thkim1011 can you confirm this localization string was added correctly?
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.
The string looks like it was added properly. One thing I am concerned about is that in the material localizations, "Select all" is cased with a lowercase "a" in "all" so I'm wondering if it should be "Look up" instead with a lowercase "u".
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 it's a little different because Look Up is the name of a feature in iOS, and Select all is more of a... description? What do you think?
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.
Just saw the native iOS behavior is upper case for both "Select All" and "Look Up". Not sure about android tho.
072404e to
766e7ab
Compare
e0a2548 to
c2d9cdd
Compare
c13d248 to
7b87fe4
Compare
This PR adds framework support for the Look Up feature in iOS. https://github.com/flutter/flutter/assets/36148254/d301df79-4e23-454f-8742-2f8e39c2960c The corresponding merged engine PR can be found [here](flutter/engine#43308). This PR addresses #82907 More details are available in this [design doc.](flutter.dev/go/add-missing-features-to-selection-controls) This is the same PR as #130532, this is an attempt to fix the Google Testing issue
This PR adds framework support for the Look Up feature in iOS.
Simulator.Screen.Recording.-.iPhone.14.Pro.Max.-.2023-07-11.at.15.23.56.mp4
The corresponding merged engine PR can be found here.
This PR addresses #82907
More details are available in this design doc.
Pre-launch Checklist
///).