0Nom4D / GuardianDock

GuardianDock is a mobile app developed with Flutter for IOS and Android that allows Destiny users to check their stats and news about the game.
0 stars 0 forks source link

Fixing pagination with Slivers #49

Closed 0Nom4D closed 9 months ago

0Nom4D commented 9 months ago

When implementing the Bungie API error handling, I tried to make the screen reload when the API is down. When doing that, I implemented my FutureBuilder as follows:

https://github.com/0Nom4D/GuardianDock/blob/389f048225024861cae9a9722ca293654d8481ac/lib/src/views/home_view.dart#L34-L39

When implementing the pagination with slivers, I tried to use the setState function. Unfortunately, this made my FutureBuilder reload on each call of setState, calling my function getManifest() and getNewsArticles() again and again.

Thus I decided to use the Infinite Scroll Pagination package that doesn't use or trigger the setState function of my parent view. Now, when the user scrolls down, the app fetches some more articles at the bottom of the screen.

0Nom4D commented 9 months ago

Closes #48