I know with a ListView
or SingleChildScrollView
RefreshIndicator
just works natively but I want to use a RefreshIndicator
on a page that doesn't scroll. Is this even possible and if so, how?
I know with a ListView
or SingleChildScrollView
RefreshIndicator
just works natively but I want to use a RefreshIndicator
on a page that doesn't scroll. Is this even possible and if so, how?
You must do the following:
SingleChildScrollView
with the property physics
set to AlwaysScrollableScrollPhysics()
.MediaQuery.of(context).size.height
.The complete example:
classs MyWidget extends StatelessWidget {
@override
Widget build(BuildContext context) {
return RefreshIndicator(
onRefresh: () {},
child: SingleChildScrollView(
physics: AlwaysScrollableScrollPhysics(),
child: Container(
child: Center(
child: Text('Hello World'),
),
height: MediaQuery.of(context).size.height,
),
),
);
}
}