Fix: On the Web, cannot support multiline inputting when registering customized TextInputControl#139446
Fix: On the Web, cannot support multiline inputting when registering customized TextInputControl#139446Satsrag wants to merge 4 commits intoflutter:masterfrom
Conversation
* added forceMultiline to none input type
|
It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption to this rule, contact Hixie or stuartmorgan on the #hackers channel in Chat (don't just cc them here, they won't see it! Use Discord!). If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix? Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. |
| if (TextInput._instance._currentControl != _PlatformTextInputControl.instance) { | ||
| json['inputType'] = TextInputType.none.toJson(); | ||
| json['inputType'] = TextInputType.noneWithOptions( | ||
| forceMultiline: configuration.inputType == TextInputType.multiline, |
There was a problem hiding this comment.
From what I understand we should still continue to send TextInputType.none in both the multi-line case and the single-line case of custom text input controls because that prevents the keyboard from being shown. Won't this make the keyboard show again?
There was a problem hiding this comment.
Maybe the forceMultiline flag can be processed by the web embedder to decide whether to use textarea or input.
There was a problem hiding this comment.
@Renzo-Olivares Yes, this won't show the keyboard again. This still sends TextInputType.none to the engine. And also, send forceMultiline stated in TextInputType.none.
There was a problem hiding this comment.
I have updated the PR in the web engine to handle forceMultiline . But have not reviewed it yet.
| /// Optimize for none information. | ||
| /// | ||
| /// Requests a none keyboard with additional settings. | ||
| /// The [forceMultiline] parameter is optional. |
There was a problem hiding this comment.
Consider adding a comment about how forceMultiline only applies in a web context.
There was a problem hiding this comment.
Also we should probably explain why someone might use this i.e. the custom text input control use-case.
| /// | ||
| /// This flag is only used for the [none] input type, otherwise `null`. | ||
| /// Use `const TextInputType.noneWithOptions(forceMultiline: true)` to set this. | ||
| final bool? forceMultiline; |
There was a problem hiding this comment.
| @@ -182,7 +197,7 @@ class TextInputType { | |||
| static const TextInputType streetAddress = TextInputType._(9); | |||
|
|
|||
| /// Prevent the OS from showing the on-screen virtual keyboard. | |||
There was a problem hiding this comment.
Consider adding a comment similar to how TextInputType number has in this file.
/// Additional options, such as decimal point and/or positive/negative
/// signs, can be requested using [TextInputType.numberWithOptions].
| const TextInputType._(this.index) | ||
| : signed = null, | ||
| decimal = null; | ||
| decimal = null, |
There was a problem hiding this comment.
On looking at the _configurationToJson change, this doesn't have to change the public interface at all I think?
There was a problem hiding this comment.
I agree with you. I will try it on _configurationToJson and just change the JSON that is sent to the engine.
There was a problem hiding this comment.
I open a new PR. Just added forceMultiline flag to JSON. @Renzo-Olivares @LongCatIsLooong please have a review.
|
replace with #140356. |
For #125875 and flutter/engine#45522 According to [this discussion](#139446 (comment)), Just added `forceMultiline` to JSON on `_configurationToJson`. @LongCatIsLooong @Renzo-Olivares
For #125875 and flutter/engine#45522
According to this discussion, I have added
forceMultilinetoTextInputType.none.When we customize
TextInputControl,_PlatformTextInputControlwill sendTextInputType.nonewithforceMultilineflag to the engine.