pichillilorenzo / flutter_inappwebview

A Flutter plugin that allows you to add an inline webview, to use a headless webview, and to open an in-app browser window.
https://inappwebview.dev
Apache License 2.0
3.3k stars 1.64k forks source link

Unable to pull to refresh (nothing happens) #1021

Closed yoannpicquenot closed 1 month ago

yoannpicquenot commented 3 years ago

Environment

Technology Version
Flutter version 2.5.3
Plugin version ^5.3.2
Android version 11
iOS version 15.0.2
Xcode version 13

Device information: Samsung S21, iPhone 6s (tested on both)

Description

pullToRefresh does not work (I am sorry I really don't know what to write except this)

Expected behavior: I expected my onRefresh function to be called on vertical drag up.

Current behavior: Nothing happens. I don't even see a loading when pulling from the top.

Steps to reproduce

return Scaffold(
      body: SafeArea(
        child: Column(
          children: [
            Expanded(
              child: InAppWebView(
                initialOptions: InAppWebViewGroupOptions(
                  crossPlatform: InAppWebViewOptions(
                    javaScriptEnabled: true,
                    useOnDownloadStart: true,
                    mediaPlaybackRequiresUserGesture: false,
                  ),
                  android: AndroidInAppWebViewOptions(
                    useHybridComposition: true,
                  ),
                  ios: IOSInAppWebViewOptions(
                    allowsInlineMediaPlayback: true,
                  ),
                ),
                initialUrlRequest: URLRequest(
                  url: Uri.parse(url),
                  headers: <String, String>{
                    'referer': 'https://app.monpetitplacement.fr',
                  },
                ),
                pullToRefreshController: PullToRefreshController(
                  options: PullToRefreshOptions(
                    color: MppColors.Primary,
                    enabled: true,
                  ),
                  onRefresh: () async {
                    if (Platform.isAndroid) {
                      await _controller.reload();
                    } else if (Platform.isIOS) {
                      await _controller.loadUrl(
                        urlRequest: URLRequest(
                          url: await _controller.getUrl(),
                        ),
                      );
                    }
                  },
                ),
                onWebViewCreated: (InAppWebViewController controller) async {
                  _controller = controller;
                  if (!Platform.isAndroid ||
                      await AndroidWebViewFeature.isFeatureSupported(
                          AndroidWebViewFeature.WEB_MESSAGE_LISTENER)) {
                    // establish flutter channel
                  }
                },
              ),
            ),
          ],
        ),
      ),
    )
github-actions[bot] commented 3 years ago

👋 @yoannpicquenot

NOTE: This comment is auto-generated.

Are you sure you have already searched for the same problem?

Some people open new issues but they didn't search for something similar or for the same issue. Please, search for it using the GitHub issue search box or on the official inappwebview.dev website, or, also, using Google, StackOverflow, etc. before posting a new one. You may already find an answer to your problem!

If this is really a new issue, then thank you for raising it. I will investigate it and get back to you as soon as possible. Please, make sure you have given me as much context as possible! Also, if you didn't already, post a code example that can replicate this issue.

In the meantime, you can already search for some possible solutions online! Because this plugin uses native WebView, you can search online for the same issue adding android WebView [MY ERROR HERE] or ios WKWebView [MY ERROR HERE] keywords.

Following these steps can save you, me, and other people a lot of time, thanks!

rafaelmaeuer commented 2 years ago

What is the URL you are loading? Is the source at web or in app assets? I experienced something similar when loading local assets.

lugael commented 1 year ago

I'm facing the same issue, I can't perform the pull action, do you have any sample code to check?

lugael commented 1 year ago

@pichillilorenzo this is code, but not working pull action

code

github-actions[bot] commented 1 month ago

This issue is stale and has been automatically closed because it has been open for more than 365 days with no activity. Please reopen a new issue if you still have it.

github-actions[bot] commented 3 weeks ago

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.