xuelongqy / flutter_easy_refresh

A flutter widget that provides pull-down refresh and pull-up load.
https://xuelongqy.github.io/flutter_easy_refresh/
MIT License
3.88k stars 633 forks source link

Add Android-like scroll physics #660

Closed Pwuts closed 1 year ago

Pwuts commented 1 year ago

The current _ERScrollPhysics is based on BouncingScrollPhysics, which is iOS-like behavior. For Android however, it is a bit strange, and I have not been able to figure out how to implement Android-like scroll behavior that works with this library.

Could you please add Android-like scroll physics as well?

xuelongqy commented 1 year ago

Use BouncingScrollPhysics because that's how EasyRefresh works. It is necessary to control the scrolling of the list and display the indicator. In the next version, you can set maxOverOffset and triggerOffset to the same value to limit the maximum overscroll offset.

Pwuts commented 1 year ago

I noticed that the physics for bouncing back after overscroll are also applied to the indicator in drag mode, so I think I understand what you mean. I'm looking forward to the new features you're mentioning!

xuelongqy commented 1 year ago

v3.2.0 add maxOverOffse

xuelongqy commented 1 year ago

Boundary scrolling behavior can use ScrollBehavior, or set EasyRefresh.defaultScrollBehaviorBuilder. I think this should be what you need, EasyRefresh will remove the boundary scrolling behavior by default, because it will affect the indicator style.

Pwuts commented 1 year ago

I tried using those, but could not figure out how, as they aren't mentioned in the documentation. There are examples, but they are pretty complex, as is the library's source, so unfortunately I could not figure it out from those either.

xuelongqy commented 1 year ago

I tried using those, but could not figure out how, as they aren't mentioned in the documentation. There are examples, but they are pretty complex, as is the library's source, so unfortunately I could not figure it out from those either.

You need to implement ScrollBehavior.buildOverscrollIndicator.

xuelongqy commented 1 year ago

If the issue has not been resolved, please reopen.