Flutter InAppWebView does not allow non english content in textfield

Issue

I’m having a weird issue with the Flutter InAppWebView plugin version 4.0.0+4 here https://pub.dev/packages/flutter_inappwebview where I try to load the simple contact us form into the plugin and realize that I can’t enter the content into html input text field if I use non English keyboard, in my case I use Vietnamese keyboard. If I switch the keyboard to English one then its working. I double checked the contact us form and made sure its working 100% on Chrome browser outside of the Flutter app using even non English keyboard. I don’t use any special code or settings for the plugin, just same as the one mentioned in the pub.dev. I’m using Flutter channel stable v. 1.22.6

This is my code in case you need it:


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;
                        });
                      },
                    ),
                  ),
                ],
              ),
            );
          },
        ));
  }
}

Thanks.

Solution

Ok, after spending a couple days fixing the issue, I had to give up on this one. Its definitely a bug from the plugin, found someone had the similar issue here https://github.com/pichillilorenzo/flutter_inappwebview/issues/560. I then tried another plugin called WebView https://pub.dev/packages/webview_flutter and it worked perfectly.

Answered By – Thanh Pham

Answer Checked By – Robin (FlutterFixes Admin)

Leave a Reply

Your email address will not be published. Required fields are marked *