Flutter webview_flutter插件弹起键盘或输入框卡死问题解决(卡顿、闪屏)

安卓端使用混合webview
根据官方介绍

The WebView is relying on Platform Views to embed the Android’s webview within the Flutter app. By default a Virtual Display based platform view backend is used, this implementation has multiple keyboard. When keyboard input is required we recommend using the Hybrid Composition based platform views implementation. Note that on Android versions prior to Android 10 Hybrid Composition has some performance drawbacks.

WebView依靠 Platform Views将Android的Webview嵌入Flutter应用程序中。默认情况下,使用基于虚拟显示的平台视图后端,此实现具有多个 键盘。当需要键盘输入时,我们建议使用基于混合组合的平台视图实现。请注意,在Android 10 Hybrid Composition之前的Android版本上,存在一些 性能缺陷。

在webview前加上

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

参考

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值