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

Add native pull to refresh #395

Closed
rizrmd opened this issue Jun 13, 2020 · 18 comments
Closed

Add native pull to refresh #395

rizrmd opened this issue Jun 13, 2020 · 18 comments
Labels
enhancement New feature or request

Comments

@rizrmd
Copy link

rizrmd commented Jun 13, 2020

I am trying several method to add pull to refresh feature, it finally works but have awkward gesture, or terrible performance. If only I can hook into native overscroll event then it will be great.

@pichillilorenzo pichillilorenzo added the enhancement New feature or request label Jun 14, 2020
@ycv005
Copy link
Contributor

ycv005 commented Aug 7, 2020

Waiting for this feature. Thanks in advance.

@Manuito83
Copy link
Contributor

Hi. Is there a workaround? I can see the InAppWebView triggers the overscroll glow, but adding it as a child to a RefreshIndicator does not detect the overscroll condition.

@jaisonklemer
Copy link

Hi, Has anyone managed to solve this problem in any other way?

@Kimhak-Loem
Copy link

This makes me headache. Is there anybody found any solutions or trick for this? I've been searching for this over the internet, yet I couldn't find any solutions. I've also posted a question in stackoverflow: https://stackoverflow.com/questions/63376374/pull-to-refresh-webview-in-flutter, but no response.

@breebee
Copy link

breebee commented Sep 23, 2020

Hey, its actually pretty simple if you use the pull_to_refresh package. All you have to do is look at the bottom of their demo code and replace the listview builder with your inappwebview scaffold.

child: ListView.builder(), -> child: Scaffold(),

and dont forget to add your webView.reload(); for the pull.

Package @ https://pub.dev/packages/pull_to_refresh

@breebee
Copy link

breebee commented Sep 23, 2020

#EDIT
Sorry I didnt understand the issue was with scrolling in the webview. I replicated the issue, then , because I have a tabview controller, I used

gestureRecognizers: <Factory>[
new Factory(
() => new EagerGestureRecognizer(),
),
].toSet(),

this resolved the issue, and if it wasnt this then its due to using Expanded children.

@breebee
Copy link

breebee commented Sep 23, 2020

Actually this is the probably the correct answer in your case ->

child:  Scaffold(
                 body: SafeArea(
                     child: Column(children: <Widget>[
                       Container(
                         padding: EdgeInsets.all(3.0),
                         child: Icon(Icons.keyboard_arrow_down),
                       ),
                       Expanded(
                         child: Container(
                           child: InAppWebView(

@makeshyft-tom-g
Copy link

Hi, Is there a confirmed solution for pulldown to refresh that does not interfere with the scrolling of the wbview?

@pichillilorenzo
Copy link
Owner

I'm working on it! In the next release (probably today), I will add a native pull-to-refresh feature

@ycv005
Copy link
Contributor

ycv005 commented Mar 4, 2021

@pichillilorenzo ,I had also try this with help of some other plugin, but then scrolling issue comes into it. Please consider the same, no scrolling issue happens.

@pichillilorenzo
Copy link
Owner

As said, it will be implemented natively and not using any flutter plugin.
Natively means that I will use native controller/layout of that platform.
That’s because, as you know, terrible performance using flutter on this feature.
You will have the same performance as you would have using native code, but you will not have the same control details as you will have with a flutter plugin or your custom dart code, because, well, it is done on the native side with native widgets.
For sure there will be options to customise the pull-to-refresh native widget, such as the color, but you will not have the same options as, for example, using the pull_to_refresh flutter plugin.

@pichillilorenzo
Copy link
Owner

pichillilorenzo commented Mar 5, 2021

After some work, on Android, it seems it is working perfectly, but on iOS, using the UIRefreshControl native refresh controller causes some issues (not always) when the user tries to pull to refresh.
I will try to not use the UIRefreshControl native controller and implement something that resolves these issues on iOS.

@ycv005
Copy link
Contributor

ycv005 commented Mar 5, 2021

Ok, great. @pichillilorenzo

So, will you make it available for Android(we will able to test it) and later on for iOS.

@pichillilorenzo
Copy link
Owner

Pull to refresh feature added in the new release 5.1.0.

An example can be found in the README.md file, under the section InAppWebView class, using the PullToRefreshController and PullToRefreshOptions classes

@pichillilorenzo
Copy link
Owner

I have just found a bug that, if you are not using Hybrid Composition on Android, the keyboard won't show up when you focus a text field inside the WebView.
I tried to resolve that but it seems impossible, due to problems related to Android Platform Views with Hybrid Composition enabled.
So, to use PullToRefreshController on Android, Hybrid Composition MUST be enabled.
I will release a new version with this new requirement

@ycv005
Copy link
Contributor

ycv005 commented Mar 6, 2021

@pichillilorenzo Make test or assertion for this.

@pichillilorenzo
Copy link
Owner

pichillilorenzo commented Mar 6, 2021

Added an if statement that checks if Hybrid Composition is enabled when PullToRefreshController is used on Android.
If it is not enabled, it will throw an Exception.

@tstarasinic
Copy link

Is there a way to custom style PullToRefreshController, I would like to use CupertinoActivityIndicator() style, so basically just smaller indicator like it is now ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

9 participants