flutter refreshindicator not working code example
Example: refresh indicator not working flutter
By design, RefreshIndicator works with ListView.
RefreshIndicator(
onRefresh: _onRefresh,
child: ListView(
padding: EdgeInsets.all(8.0),
physics: const BouncingScrollPhysics(
parent: AlwaysScrollableScrollPhysics(),
),
children: _listData.map((i) {
return ListTile(
title: Text("Item $i"),
);
}).toList(),
)
);
Using AlwaysScrollableScrollPhysics() will ensure that the scroll view is always
scrollable and, therefore, can trigger the RefreshIndicator.
Right now I think Create the scroll physics with
BouncingScrollPhysics(parent: AlwaysScrollableScrollPhysics) and not just
AlwaysScrollableScrollPhysics() scroll physics. Because BouncingScrollPhysics
works for short lists for bounce. Now AlwaysScrollableScrollPhysics is required
to be included for the expected behaviour.