The problem is that there seems to be no way to set one particular ListView element based on input from another widget.

I have an application that has

  1. Horizontal ListView with Flatbuttons (a lot of them like English alphabets), so all elements are not on screen at the same time. Finite number to not over complicate it.
  2. PageView that has an equal number of pages as the ListView

When one of the FlatButtons in ListView is clicked, it animates the PageView to the page that has the same index as the pressed FlatButton in ListView, this works because there is a method animateToPage which takes the input of the index to go to. But

One the other hand, if the PageView is scrolled independently of ListView items to another page, there seems to be no way to animate ListView to highlight the FlatButton or bring it to focus or just on the screen if it was not in the visible area of the screen, corresponding to the page on display by scrolling PageView.

Jumpto or animateto are not much help as they work on different arithmetic which seems unrelated to index of the page.

I am looking for something that can realize the Widget like below: PageView scrolls to page 5 and ListView automatically navigated to element with same index, bringing it on screen too if it was scrolled away.

enter image description here

Any suggestions would be helpful.


Solution 1: Crazzygamerr

Use a FocusNode, it can be used to focus a certain widget. But, I'm not sure if you can use it to scroll a ListView.

Try using a scroll controller for the ListView.