EdsonBueno / infinite_scroll_pagination

Flutter package to help you lazily load and display pages of items as the user scrolls down your screen.
https://pub.dev/packages/infinite_scroll_pagination
MIT License
623 stars 211 forks source link

Add option to delay first page request until explicitly asked using the controller #124

Closed tomasweigenast closed 2 years ago

tomasweigenast commented 3 years ago

Add an option, for example, on the PagedListView which adds the ability to "wait" until a method is called then the first page is requested.

PagedListView<String, dynamic>(
   pagingController: pagingController,
   delayFirstPage: true,
   builderDelegate: PagedChildBuilderDelegate(
       itemBuilder: (context, item, index) => Container(),
  ),
),

Then, using the PagingController, we can use:

pagingController.requestFirstPage();

Why is this useful? In search bars for example, we don't want the CircularProgressIndicator to appear unless the user starts writing something in the TextField

NamanShergill commented 3 years ago

You could just use Visibility() to hide the widget until something is searched in the search bar.

EdsonBueno commented 2 years ago

Hi @TomasWeg , In that case you'd be better off not inserting your PagedListView in the widget tree until you actually want to show something. An alternative would be @NamanShergill 's suggestion.

Thank you so much for opening the issue! I'm closing it for now, but feel free to continue the discussion.