如果主体为空,如何在nestedScrollView中停止滚动

时间:2020-10-04 19:34:55

标签: flutter dart flutter-sliver

有时候我的身体部件有数据,有时没有,所以当身体为空但无法修复时,我需要在nestedScrollView中停止scrollig

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,
                ),
              ),

1 个答案:

答案 0 :(得分:0)

NotificationListener<ScrollNotification>(
                  onNotification: (ScrollNotification scrollInfo){
                    if ( !myModel.isLoading  &&scrollInfo.metrics.pixels ==
                        scrollInfo.metrics.maxScrollExtent) {
                    
                    }
                    return false;
                  },)

User NotificationListener