我在这里https://pub.dev/packages/flutter_inappwebview的 Flutter InAppWebView 插件版本 4.0.0+4 遇到了一个奇怪的问题,我尝试将简单的联系我们表单加载到插件中并意识到我不能如果我使用非英文键盘,则将内容输入到 html 输入文本字段中,在我的情况下,我使用越南语键盘。如果我将键盘切换到英文键盘,那么它就可以工作了。我仔细检查了联系我们表格,并确保它在 Flutter 应用程序之外的 Chrome 浏览器上 100% 工作,甚至使用非英文键盘。我没有为插件使用任何特殊的代码或设置,就像 pub.dev 中提到的一样。我正在使用 Flutter channel stable v. 1.22.6
如果您需要,这是我的代码:
class WebViewerWidget extends StatefulWidget {
final Map<String, String> metaData;
WebViewerWidget({this.metaData});
@override
_WebViewerWidgetState createState() => _WebViewerWidgetState();
}
class _WebViewerWidgetState extends State<WebViewerWidget> {
@override
void initState() {
super.initState();
}
@override
Widget build(BuildContext context) {
InAppWebViewController _webviewCtrl;
double progressIndicator = 0;
return Scaffold(
backgroundColor: ColorPalette.white,
appBar: PreferredSize(
child: TopNavWidget(
title: widget.metaData['title'] ?? '',
),
preferredSize: Size.fromHeight(50.0),
),
body: Builder(
builder: (BuildContext context) {
return Container(
child: Column(
children: [
Container(
child: progressIndicator < 1
? LinearProgressIndicator(
value: progressIndicator,
backgroundColor: Colors.black12,
valueColor:
AlwaysStoppedAnimation<Color>(Colors.blue),
)
: Container()),
Expanded(
child: InAppWebView(
initialUrl: widget.metaData['url'] ?? 'about:blank',
initialOptions: InAppWebViewGroupOptions(
crossPlatform: InAppWebViewOptions(
debuggingEnabled: true,
javaScriptEnabled: true,
useShouldInterceptAjaxRequest: true,
useShouldInterceptFetchRequest: true,
),
ios: IOSInAppWebViewOptions(),
android: AndroidInAppWebViewOptions(),
),
onWebViewCreated:
(InAppWebViewController webviewController) {
_webviewCtrl = webviewController;
},
onProgressChanged:
(InAppWebViewController controller, int progress) {
setState(() {
progressIndicator = progress / 100;
});
},
),
),
],
),
);
},
));
}
}
谢谢。