Flutter uses webview_flutter to step on the soft keyboard and cannot open it

Scenario : webview_flutter, which is used to embed flutter in webpages, found that the soft keyboard cannot pop up under android and cannot input content.

Error message:

onWindowFocusChanged hasWindowFocus true
W/cr_IMM  (22042): Activity's display ID(28) does not match context's display ID(0). Using a workaround to show soft input on the correct display...
V/InputMethodManager(22042): b/117267690: Display ID mismatch found. ViewRootImpl displayId=30 InputMethodManager displayId=28. Use the right InputMethodManager instance to avoid performance overhead.

Solution:

Add this line of code when the page is initialized

if (Platform.isAndroid) WebView.platform = SurfaceAndroidWebView();

Code example:

 

Supongo que te gusta

Origin blog.csdn.net/weixin_45308405/article/details/127754628
Recomendado
Clasificación