aagarwal1012 / Liquid-Pull-To-Refresh

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

Programmatically Trigger Pull-To-Refresh #76

Open RaiN3772 opened 7 months ago

RaiN3772 commented 7 months ago

Is your feature request related to a problem? Please describe. Currently, the Liquid Pull To Refresh package only supports refresh triggered by user's pull-down gesture. This limitation becomes apparent in scenarios where an app might need to programmatically initiate the refresh process, similar to how one might want to trigger a refresh when a user navigates back to a page using the phone's back button. This limitation can be frustrating in user experiences that benefit from seamless refresh capabilities, such as in social media applications like Facebook, Instagram, and Reddit, where content freshness is crucial.

Describe the solution you'd like I would like the package to include a feature that allows developers to programmatically trigger the pull-to-refresh action. This could be implemented as a method in the LiquidPullToRefresh widget's controller, which, when called, initiates the pull-to-refresh animation and the attached refresh callback programmatically. This method would enable developers to control the refresh behavior based on application logic, such as pressing the back button or other user actions that do not involve the pull-down gesture.

Describe alternatives you've considered An alternative solution could be to manually trigger the refresh logic tied to the pull-to-refresh action, but this approach lacks the visual feedback and consistency provided by the pull-to-refresh animation. It also requires additional implementation effort to replicate the animation effects, making the overall solution less seamless and integrated.

Additional context The ability to programmatically trigger pull-to-refresh actions would significantly enhance the flexibility and usability of the Liquid Pull To Refresh package. It aligns with user expectations set by major social media platforms and improves the user experience by ensuring that content can be refreshed in a way that is both intuitive and consistent with the rest of the application's design. Adding this feature would make the package more versatile and valuable to developers looking to implement sophisticated and user-friendly refresh behaviors in their Flutter applications.