how to detect middle or three quarters of scroll position on ListView on Flutter to lazy loading data?

481 views Asked by At

how to detect middle or three-quarters of scroll position on ListView? I want to get data after reach to middle or three-quarters of the scroll position. How to do it?

Currently, I get data on the end of listView.

_scrollController.addListener(scrollListener);

  void scrollListener(){
    if (_scrollController.position.pixels == _scrollController.position.maxScrollExtent) {
      getMoreData();
    }
  }
1

There are 1 answers

3
Talaal_M On BEST ANSWER

I think this would work..

_scrollController.addListener(scrollListener);

  void scrollListener(){
    if (_scrollController.position.pixels == _scrollController.position.maxScrollExtent * 0.75) {
      getMoreData();
    }
  }