how to make scrollController work with AnimatedList, so to scroll to new added item

Viewed 32

I searched all questions and googled, but it seems both does not work together, my goal is if animatedList added an Item in the middle, scrollController should scroll to it automatically, I think this should be a normal action, but there is only a github issue, does anyone have any idea, plz share with me thanks!

with my current code the effect will be, screen scroll to the bottom, and then scroll back...I have no idea why there are twice scroll actions:

  Future scrollToIndex(int index,) async {
    Timer(
      Duration(milliseconds: 1100),
          () {
            scrollController.animateTo(
              // index * _height,    //not working
              // scrollController.position.maxScrollExtent + 3000,   //not working
              2000,  //not working
              duration: Duration(seconds: 2),
              curve: Curves.ease,
            );
      },
    );
  }
0 Answers
Related