FilledStacks / flutter-tutorials

The repo contains the source code for all the tutorials on the FilledStacks Youtube channel.
MIT License
4.75k stars 1.76k forks source link

Pagination with bottom navigation bar #91

Closed azazadev closed 4 years ago

azazadev commented 4 years ago

Hello,

Thanks for all tutorials, I'm a beginner with flutter and I'm facing issue when I'm using bottom navigation bar and paginated-realtime-firestore based on the tutorial and when navigate through different states it's calling Firebase reads two time

first call : Fixed and worked fine by applying what you have explain in Bottom Nav Bar tutorial second call : to requestMoreData from firestoreService during pagination

probably I'm wrong but it's normal that we call every time the requestMoreData even if there is no new page ?

I have only 6 entries in firestore, and the requestMoreData is called every time when I scroll up/down in my first view or when I switch between fist/second views of bottom navigation bar

PS : another request not related to this issue : It will be very appreciate if we can have in next tutorial the best away to implement a search bar on List item and pagination

Thanks

FilledStacks commented 4 years ago

Hey,

That sounds like something that would happen given the implementation. it will always try and request more data if it's at the end of the list all the time but you should add some guards to that. make sure it doesn't do the actual request and stop it before it gets there by using some boolean flags to keep track of where you are.

azazadev commented 4 years ago

I have looked on the original implementation of FirestoreService everything is there ! ( flag is already there "bool _hasMorePosts = true;" to avoid requestMoreData )

my apology !, it's proof that flutter-tutorials is rock solid !!!

Thanks again and don't forget Search Bar tutorial in wast time :)