flutter - 如果 body 为空,如何停止在 nestedScrollView 中滚动
问题描述
有时我的 body 小部件有数据,有时没有,所以当 body 为空但无法修复时,我需要在 nestedScrollView 中停止滚动
NestedScrollView(
//controller: model.scrollController,
headerSliverBuilder: (context, innerScroll) {
return [
model.isShowToolbar
? SliverAppBar(
pinned: true,
floating: false,
)
: SliverPadding(padding: const EdgeInsets.all(0.0)),
Container(
height: 200,
color: Colors.green,
)
];
},
body: ErrorWidgetView(
lottieFile: 'assets/images/post_empty.json',
title: 'No Recent Post',
showButton: false,
),
),
解决方案
NotificationListener<ScrollNotification>(
onNotification: (ScrollNotification scrollInfo){
if ( !myModel.isLoading &&scrollInfo.metrics.pixels ==
scrollInfo.metrics.maxScrollExtent) {
}
return false;
},)
用户通知监听器
推荐阅读
- eclipse-pdt - 使用 Eclipse PDT 创建新 PHP 项目时出错
- apache-kafka - Kafka Streams 超时重新平衡并从集群中退出
- r - 使用纬度和经度信息为阿富汗的地区分配位置
- python - TypeError:不能将序列乘以“浮点”类型的非整数 | 烧瓶
- c# - 在运行作业的应用程序中使用中间件的最佳方法
- typo3 - TYPO3 自定义页面类型内部链接
- tomcat - 带有 HSTS 的 HTTPS 的 Tomcat 9 配置
- python - 如何操作读取为字符串的数字
- java-8 - java 8流将特定对象从地图复制到列表
- javascript - 如何在 JavaScript 中实现嵌套的 for 循环?