I want refresh my page without having a scrollable content, i.e. without having a ListView
et al.
When I want use RefreshIndicator
, the documentation says it needs a scrollable
widget like ListView
.
But if I want to refresh and want to use the refresh animation of RefreshIndicator
without using a ListView
, GridView
or any other scorllable widget, how can i do that?
You can simply wrap your content in a SingleChildScrollView
, which will allow you to use a RefreshIndicator
. In order to make the pull down to refresh interaction work, you will have to use AlwaysScrollableScrollPhysics
as your content will most likely not cover more space than available without a scroll view:
RefreshIndicator(
onRefresh: () async {
// Handle refresh.
},
child: SingleChildScrollView(
physics: const AlwaysScrollableScrollPhysics(),
child: /* your content */,
),
);