0

i want to add lazy loading for my app but when i put the new controller. the controller didn't work with the NestedScrollView that i've made.
my new controller:

final controller = ScrollController();

in my initstate:

controller.addListener(() {
      if (controller.position.maxScrollExtent == controller.offset) {
        getStoryUser();
      }


and i put the controller into list view but its didn't work with the NestedScrollView that i've mentioned earlier. any solution for this matter? any help will be valuable thank you.

1

1 Answer 1

0

Attach this _scrollController with your scrollview

if ((_scrollController.position.pixels >
        _scrollController.position.maxScrollExtent - 20)) {
      if (_isLoading || _loadMore || ((_media.media?.length ?? 0) < 30)) {
        return;
      }
      _pageNumber++;
      _loadMore = true;
      if (mounted) setState(() {});
        await _loadData();

      _loadMore = false;
      if (mounted) setState(() {});
    }
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.