aagarwal1012 / Liquid-Pull-To-Refresh

🔁 A custom refresh indicator for flutter.
https://pub.dev/packages/liquid_pull_to_refresh
MIT License
1.24k stars 92 forks source link

[Feature Request] Add support for NestedScrollViews #40

Closed ThinkDigitalSoftware closed 4 years ago

ThinkDigitalSoftware commented 4 years ago

Is your feature request related to a problem? Please describe. A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] I'm trying to add a pull to refresh with a NestedScrollView, but this widget doesn't extend ScrollView, so it doesn't work Describe the solution you'd like A clear and concise description of what you want to happen. A widget that works with NestedScrollViews Describe alternatives you've considered A clear and concise description of any alternative solutions or features you've considered.

2020-02-03 17 02 35

AadumKhor commented 4 years ago

Hi @ThinkDigitalSoftware ! Thanks for suggesting this.

There are several open issues regarding NestedScrollView and its use with RefreshIndicator for example :- https://github.com/flutter/flutter/issues/34727#issue-458143763 https://github.com/flutter/flutter/issues/17518#issuecomment-600738109

You can also verify them yourself by wrapping the built in RefreshIndicator around a NestedScrollView. It does not work.

Our work around for this is relatively simple. Wrap your inner ScrollView with the LiquidPullToRefresh to make it work.

Here is how I made it work.

  1. Copy this code to your build method - https://flutter-widget.live/widgets/NestedScrollView
  2. Wrap the inner ScrollView , in this case CustomScrollView with LiquidPullToRefresh

This works because we already have the package built for cases of OverScrollNotification for direct child widgets. When you apply it over the NestedScrollView it somehow does not seem to handle the OverScrollNotification in the way we expect. Since it is a prevailing issue there is not much to say about it.

You can refer to another example here - https://github.com/flutter/flutter/issues/26409#issue-398156841

nestedscroll_issue#40

I hope this helps.

AadumKhor commented 4 years ago

Closing this issue since no further information is given.