skip to Main Content

as i have mentioned on the title, i have tried many ways to use the CupertinoSliverRefreshControl to work along with the superscaffold, but never successfull.

body: CustomScrollView(
        slivers: [
          CupertinoSliverRefreshControl(
            onRefresh: () {
              print("refreshing ...");
              return ref.refresh(skillsProvider.future);
            },
            // child: EasyRefresh(
            //   child: myPagedListView(ref),
            // ),
          ),
          SliverFillRemaining(
            child: myPagedListView(ref),
          )
        ],
      ),

to resolve this problem, give me a workign example

2

Answers


  1. Chosen as BEST ANSWER

    Yes i did that. it works, but i still have some issues. `body:

    CustomScrollView(
            primary: false,
            physics: const BouncingScrollPhysics(
              parent: AlwaysScrollableScrollPhysics(),
            ),
            slivers: [
              CupertinoSliverRefreshControl(
                onRefresh: () {
                  print("refreshing ...");
                  return ref.refresh(skillsProvider.future);
                },
              ),
              SliverFillRemaining(
                fillOverscroll: true,
                child: myPagedListView(ref),
              ),
            ],
          ), 
    
    Widget myPagedListView(WidgetRef ref) {
            final pagingController =
                ref.watch(skillsProvider.notifier).pagingController;
            return PagedListView<int, Skill>(
              pagingController: pagingController,
              physics:
                  const BouncingScrollPhysics(), 
              builderDelegate: PagedChildBuilderDelegate<Skill>(
                itemBuilder: (context, item, index) {
                  return SkillCard(item);
                },
                firstPageErrorIndicatorBuilder: (context) =>
                    const CupertinoActivityIndicator(),
                firstPageProgressIndicatorBuilder: (context) =>
                    const CupertinoActivityIndicator(),
                newPageProgressIndicatorBuilder: (context) =>
                    const CupertinoActivityIndicator(),
              ),
            );
          }
    

    ` since PagedListView a scrollable, when i add the physics eventhough the refreshindicator works, I cannot scroll the myPagedListView widgets.


  2. Try adding physics

    
    body: CustomScrollView(
      physics: const BouncingScrollPhysics(
        parent: AlwaysScrollableScrollPhysics(),
      ),
      slivers: [
        CupertinoSliverRefreshControl(
          onRefresh: () async {
            print("refreshing ...");
            await Future.delayed(Duration(seconds: 2)); //your future should be have some delay 
            return Future.value();
          },
        ),
      ],
    ),
    );
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search