CupertinoSLiverRefresh 不适用于 SuperScaffold

问题描述 投票:0回答:1

正如我在标题中提到的,我尝试了很多方法来使用 CupertinoSliverRefreshControl 与超级支架一起工作,但从未成功。

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

要解决这个问题,请给我一个有效的例子

flutter pull-to-refresh
1个回答
0
投票

尝试添加

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();
      },
    ),
  ],
),
);
© www.soinside.com 2019 - 2024. All rights reserved.