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
632 stars 214 forks source link

Keyword search doesn't refresh the list #149

Closed sunny0092 closed 2 years ago

sunny0092 commented 2 years ago

I'm having trouble searching keyword show item list The steps performed are faulty. Step 1: Have not entered the keyword, the api will return a list of 10 items, the addPageRequestListener function will be called. Step 2: Enter keyword => "iphone", api will return a list of 10 items, addPageRequestListener function will be called. Step 3 Enter keyword => "iphone 123", the api will return an empty list, addPageRequestListener function will be called, Step 4 I call again like step 1, delete all keywords and from then on addPageRequestListener will not work, unless exiting again.

 return CustomSearchBarWidget(
        isPrimary: false,
        filter: filter,
        keywordCallBack: (search) {
          this.search = search;
          paging.refresh();
        },
        filterCallBack: () {
          context
              .pushRoute(HomeFilterPageRoute(isShowCatalog: true))
              .then((value) {
            bloc?.add(HomeGetFilterEvent());
            paging.refresh();
          });
        });
  paging.addPageRequestListener((pageKey) {
      this.pageKey = pageKey;
      bloc?.add(HomeProductsFetchEvent(search: search, page: page));
    });