Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

!!!! help scrollbar error #210

Closed
jackTang11 opened this issue Dec 5, 2019 · 5 comments
Closed

!!!! help scrollbar error #210

jackTang11 opened this issue Dec 5, 2019 · 5 comments

Comments

@jackTang11
Copy link

WechatIMG20074
the webview scrollbar error?

@pichillilorenzo
Copy link
Owner

Can you give me some more info? Provide me also the URL, thanks!

@jackTang11
Copy link
Author

image

https://flutter.dev/ Sometimes it happens

body: Container(
        child: Column(
          children: <Widget>[
            getProgressView(),
            Expanded(
              child: Container(
                decoration: BoxDecoration(border: Border.all(color: Colors.transparent)),
                child: InAppWebView(
                  initialUrl: url,
                  initialHeaders: {},
                  initialOptions: InAppWebViewWidgetOptions(
                      inAppWebViewOptions: InAppWebViewOptions(
                    debuggingEnabled: true,
                  )),
                  onWebViewCreated: (InAppWebViewController controller) {
                    webView = controller;
                  },
                  onLoadStart: (InAppWebViewController controller, String url) {
                    setState(() {
                      this.url = url;
                    });
                  },
                  onLoadStop:
                      (InAppWebViewController controller, String url) async {
                    setState(() {
                      this.url = url;
                    });

                    controller.getTitle().then((s) {
                      setState(() {
                        title = s;
                        print(title);
                      });
                    });
                  },
                  onProgressChanged:
                      (InAppWebViewController controller, int progress) {
                    setState(() {
                      this.progress = progress / 100;
                    });
                  },
                ),
              ),
            ),
          ],
        ),
      ),

@jackTang11
Copy link
Author

Can you give me some more info? Provide me also the URL, thanks!

image

@pichillilorenzo
Copy link
Owner

After some debugging, I discovered that this happens on iOS during the rendering if the WebView is not inside at least a SafeArea widget or in the iOS safe area. I don't know why this happens but I think it is something related to native view constraints on iOS.

In your case, you can just replace the first Container widget with SafeArea widget:

body: SafeArea(
        child: Column(
          children: <Widget>[
            getProgressView(),
            Expanded(
              child: Container(
                decoration: BoxDecoration(border: Border.all(color: Colors.transparent)),
                child: InAppWebView(
                  initialUrl: url,
                  initialHeaders: {},
                  initialOptions: InAppWebViewWidgetOptions(
                      inAppWebViewOptions: InAppWebViewOptions(
                    debuggingEnabled: true,
                  )),
                  onWebViewCreated: (InAppWebViewController controller) {
                    webView = controller;
                  },
                  onLoadStart: (InAppWebViewController controller, String url) {
                    setState(() {
                      this.url = url;
                    });
                  },
                  onLoadStop:
                      (InAppWebViewController controller, String url) async {
                    setState(() {
                      this.url = url;
                    });

                    controller.getTitle().then((s) {
                      setState(() {
                        title = s;
                        print(title);
                      });
                    });
                  },
                  onProgressChanged:
                      (InAppWebViewController controller, int progress) {
                    setState(() {
                      this.progress = progress / 100;
                    });
                  },
                ),
              ),
            ),
          ],
        ),
      ),

Copy link

This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug and a minimal reproduction of the issue.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 12, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants