jajpa / paging_library

A Flutter package for paginating a list view
MIT License
37 stars 7 forks source link

Allow the pageBuilder to provide the amount of total items #2

Open hacker1024 opened 5 years ago

hacker1024 commented 5 years ago

This should be possible so the loading widget isn't shown at the end of the list.

hacker1024 commented 5 years ago

At the moment, the following workaround is an option:

int _totalItems;

...

Pagination<Data>(
  pageBuilder: (currentSize) async {
    if (currentSize == _totalItems) return const [];
    final data = await getData(currentSize);
    _totalItems = data.totalItems;
    return data;
  },
  itemBuilder: ...
);