Flutter使用webview_flutter 踩坑 软键盘打不开

场景:flutter嵌入网页用的webview_flutter 发现在android下软键盘无法弹出,不能输入内容。

报错信息:

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.

解决方法:

在页面初始化的时候加上这一行代码

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

代码示例:

猜你喜欢

转载自blog.csdn.net/weixin_45308405/article/details/127754628