flutter_calendar_view icon indicating copy to clipboard operation
flutter_calendar_view copied to clipboard

Pagination difficulty

Open MarceloRab opened this issue 1 year ago β€’ 4 comments

Thank you for this excellent work.

I have problems with pagination. I click to change the page and if there is no data on the device, I request it from the database. It is not a problem to click on the top arrows. However, it is very cool to change by dragging the screen. However, I could not find the horizontal listen of the pageController to call a new page (new month) in the database. I ended up using => pageViewPhysics: NeverScrollableScrollPhysics().

How can I capture the horizontal movement of the page turn to make the request to the database?

MarceloRab avatar Jan 08 '25 01:01 MarceloRab

I did it, guys!. 😁

Returns a callback for the end of the pages. Either to the beginning or to the end. The user drags from the last page or the first and receives a callback for the pagination.

Please check here.

Fork:

Consider including in the package.

MarceloRab avatar Jan 09 '25 18:01 MarceloRab

Solution suggested and tested multiple times.

Pull Request - https://github.com/SimformSolutionsPvtLtd/flutter_calendar_view/pull/453

MarceloRab avatar Jan 12 '25 15:01 MarceloRab

Hi @MarceloRab,

Thank you for raising this issue and for providing a well-tested PR. We really appreciate your contribution!

However, we already have a callback onPageChange available, which can be used to listen to page change events. In your case, you could use this callback to check if the data exists and, if not, fetch it from the database.

Given that, it seems this change might not be necessary. That said, please let me know if I’m missing something or if there’s a specific use case that isn’t covered by the current approach.

If everything looks good, I’ll go ahead and close the issue and PR #453.

Thanks again!

Sahil-Simform avatar Jul 25 '25 08:07 Sahil-Simform

Only with this change can we receive a callback with the movement in the PageView. Otherwise, we will need to use the arrows to know if it has reached the end. This does not generate a good user experience.

MarceloRab avatar Nov 07 '25 22:11 MarceloRab