Flutter: How to scroll listview on next and previous button click?
We all know how to access specific index in Listview. But, We often see that the movies list is displayed horizontally in applications like Netflix, Hotstar. And Items can go back and forth at the click of a button. I want to show you how we can do this.

We will also check how to count the ListView items that are on the screen.
And for this we have to use scrollable_positioned_list dependency.
scrollable_positioned_list contains builder method or separated method. And in this example we’ll use separated method to build the list of widgets.
Before we proceed further, we should know about the itemScrollController and itemPositionsListener.
ItemScrollController: Controller for jumping or scrolling to an item.
ItemPositionsListener: Create a [ScrollablePositionedList] whose items are provided by [itemBuilder] and separators provided by [separatorBuilder].
Use Dependency:
scrollable_positioned_list: ^0.2.3
Example: Generate the list of sixteen items and will see or count the onScreen items of list and will tap on next button icon to move next item on screen and will tap on previous button icon to move previous item back to the screen.
So lets start :)
Code Snippet:
OutPut:

That’s all Thank You :)