I have a ListView with, say, PostItems being generated with ListView.builder.

Each PostItem MAY have comments on it. So each PostItem has a nested ListView.builder to show comments for that PostItem.

User can add a Comment to the nested ListView. However, UX would like to scroll to that newly added Comment in the nested ListView. Nested Listview shrinkwrap is true, with NeverScrollable Physics. When nested Comment listview expandeds with new Comment, it's off screen and I want to scroll down to it.

ListView.builder -> PostItem -> Nested ListView.builder

However, my assumption is that I need to make the parent ListView scroll down but how do I know where to scroll to when it's the Nested listview that has grown in height.

I can't share code due to the project but any theological thoughts or ideas would be a great help!

Thanks


Solution 1: Benjamin

I can see that, based on your description, we can access the index of that particular ListView. Thus, I would suggest you to use this package to achieve what you want:

scroll_to_index