How to stop scrolling in nestedScrollView if body is empty

630 views Asked by At

Sometimes my body widget have data and sometimes not so i need to stop scrollig in nestedScrollView when body is empty but unable to fix it

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

There are 1 answers

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

User NotificationListener