RefreshIndicator只适用于可滚动的或与ListView相关的小部件吗?我希望使用它与一个容器内的一个脚手架,并使用一个GestureRecognizer,在拆卸时,它刷新。
我试图在包含容器的代码中使用RefreshIndicator,但它没有工作。
发布于 2022-11-09 01:03:15
在中间添加SingleChildScrollView对我来说很好。
class 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,
),
),
);
}
}
https://stackoverflow.com/questions/74372232
复制