-
Notifications
You must be signed in to change notification settings - Fork 9.7k
[webview_flutter] Support Flutter TextInput
s
#1852
Conversation
Adds logic to `InputAwareWebView#clearFocus` to reset input creation back to the container view's thread whenever the WebView is unfocused. Fixes issue where Flutter UIs could no longer receive InputConnections because WebView was causing all connections to happen on WebView's IME thread.
* longer has focus. | ||
* | ||
* <p>The logic in {@link #checkInputConnectionProxy} forces input creation to happen on Webview's | ||
* thread for all connections. We undo it here so usres will be able to go back to typing in |
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.
nit typo: users
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.
Done.
new Runnable() { | ||
@Override | ||
public void run() { | ||
containerView.onWindowFocusChanged(true); |
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 do you think about only do this if we've set the ThreadedInputConnectionProxyAdapterView as the input target?
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.
Makes sense. done.
new Runnable() { | ||
@Override | ||
public void run() { | ||
containerView.onWindowFocusChanged(true); |
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.
[nit, can definitely happen in a different PR]
We're repeating this magic sequence in more than one place, this specific call site isn't document so someone stepping into this code will probably be confused. Would probably be useful to extract these steps to a common method.
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'll clean it up in #1853.
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
[webview_flutter] Support Flutter `TextInput`s Adds logic to `InputAwareWebView#clearFocus` to reset input creation back to the container view's thread whenever the WebView is unfocused. Fixes issue where Flutter UIs could no longer receive InputConnections because WebView was causing all connections to happen on WebView's IME thread.
Description
Adds logic to
InputAwareWebView#clearFocus
to reset input creationback to the container view's thread whenever the WebView is unfocused.
Fixes issue where Flutter UIs could no longer receive InputConnections
because WebView was causing all connections to happen on WebView's IME
thread.
Manually tested using mklim/plugins@928c790.
Related Issues
flutter/flutter#19718
Checklist
Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes (
[x]
). This will ensure a smooth and quick review process.///
).flutter analyze
) does not report any problems on my PR.Breaking Change
Does your PR require plugin users to manually update their apps to accommodate your change?