Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Limit items per page and know when is fetching more documents #3

Closed
d-apps opened this issue May 10, 2020 · 5 comments
Closed

Limit items per page and know when is fetching more documents #3

d-apps opened this issue May 10, 2020 · 5 comments

Comments

@d-apps
Copy link

d-apps commented May 10, 2020

Can we control the limit of items per page? if so, how?

How to know when is fetching more documents, like a bool variable, to show some CircularProgressIndicator with "loading more data" to the user?

@vedartm
Copy link
Owner

vedartm commented May 10, 2020

There is an attribute itemsPerPage to set number of items in one page. You can use it like this

      PaginateFirestore(
        itemBuilder: (context, documentSnapshot) => ListTile(
          leading: CircleAvatar(child: Icon(Icons.person)),
          title: Text(documentSnapshot.data['name']),
          subtitle: Text(documentSnapshot.documentID),
        ),
        // orderBy is compulsary to enable pagination
        query: Firestore.instance.collection('users').orderBy('name'),
        itemsPerPage: 10
      ),

@vedartm
Copy link
Owner

vedartm commented May 10, 2020

I am closing the issue now. If you face any related issue, feel free to reopen it. Thanks for using the package, hope it solved your use case.

@waletoyo1
Copy link

waletoyo1 commented Jun 16, 2021

When "itemsPerPage" attribute is used, can the firestore "limit" method be used together? Thanks.

@vedartm
Copy link
Owner

vedartm commented Jun 17, 2021

itemsPerPage internally uses firestore's limit method anyways @waletoyo1

@waletoyo1
Copy link

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants