eve*_*een 9 flutter flutter-animation
我想在没有可滚动内容的情况下刷新我的页面,即没有ListView等。
当我想使用时RefreshIndicator,文档说它需要一个scrollable像ListView.
但是,如果我想刷新,并希望使用的刷新动画RefreshIndicator不使用ListView,GridView或任何其他scorllable小部件,我该怎么办呢?
您可以简单地将内容包装在 a 中SingleChildScrollView,这将允许您使用RefreshIndicator. 为了使下拉刷新交互工作,您必须使用,AlwaysScrollableScrollPhysics因为您的内容很可能不会比没有滚动视图的可用空间覆盖更多空间:
RefreshIndicator(
onRefresh: () async {
// Handle refresh.
},
child: SingleChildScrollView(
physics: const AlwaysScrollableScrollPhysics(),
child: /* your content */,
),
);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2721 次 |
| 最近记录: |