Refresh indicator without scrollview

后端 未结 8 1035
失恋的感觉
失恋的感觉 2020-12-14 15:52

I know with a ListView or SingleChildScrollView RefreshIndicator just works natively but I want to use a RefreshIndicator

8条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-14 16:44

    In ListView.builder use physics: AlwaysScrollableScrollPhysics()

    Example:

    RefreshIndicator(
       onRefresh: () => _onRefresh(),
       child: Center(
                child: ListView.builder(
                         physics: AlwaysScrollableScrollPhysics(),
                          controller: _scrollController,
                          itemCount: 4,
                          addAutomaticKeepAlives: true,
                          itemBuilder: (BuildContext context, int position) {
                                return Text("Hello $position");
                              }
                  ),
          ),
    )
    

提交回复
热议问题