Repository navigation
[WIP] Text editing gestures - #84232
Closed
LongCatIsLooong wants to merge 18 commits into
Closed
LongCatIsLooong wants to merge 18 commits into
LongCatIsLooong wants to merge 18 commits into
Conversation
Contributor
Author
|
Splitting this into separate pull requests. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Requirements:
Given the assumption that we want something analogous to keyboard shortcuts, things we want to enable with the new system:
GestureRecognizer Overriding (analogous to shortcuts overriding).
SelectableText/TextField/CupertinoTextField's gesture recognizer implementation are actually similar -- the biggest difference comes from the target platform.- developers may need a way to get a hold of the
supergesture recognizer implementation in the override, so they can add things with ease (e.g., for adding aFeedback.longPress())- a gesture recognizer can be overridden multiple times: a library should be able to provide a set of predefined gestures for a custom input field built on top of
TextField. And the user should be able to further override this.GestureEvent (e.g. onTapUp) -> Intent(s) mapping.
Intent -> Action mapping.
Actions need access to the text field/EditableTextState/superimplementation of anAction.Some observations (some should probably be addressed in separate PRs):
EditableTextinstead of the text field. For instance, for a single-line text field that occupies the entire screen, it doesn't seem to make sense to change the selection when the gesture's initial pointer down event landed far away from the text area (the text area is usually going to have a height that's significantly smaller than the input decorator in this case).Initially the gesture recognizers were installed on
EditableTextbut because of the number of test failures caused by this I had to move them toTextField, etc.shouldShowSelectionToolbaris a bit confusing. We should probably infer it from the gesture's pointer device kind/button, gesture type, and the target platform, instead of having a publicly writable flag that's difficult to reason about.3
RenderEditable&EdiableTextshould not be where the gesture recognizers are installed, because they generally don't have enough margin between the glyphs and the edge of the gesture recognizers.Some potential problems with this approach:
SelectableTexthandles some gestures differently. To provide theseSelectableTextspecific defaults, we have to put aTextEditingGestureinSelectableText, making those gesture recognizers unconfigurable from outside. (Maybe we can add agestureRecognizersparameter to the text editing widgets and let it have the highest precedence)Feedbackis defined in the material library. It takes a lot of code to add aFeedbackto the default long press callback (from the widget library). So is "onTap".Pre-launch Checklist
///).If you need help, consider asking for advice on the #hackers-new channel on Discord.