Create a ListView Loop over a fixed list of data like a Slot Machine

Viewed 108

I have a pretty involved ListView.builder that I'd like to scroll in a loop like a slot machine would. When item 5 scrolls off the bottom of the list, it returns at the top in a loop.

Basically, instead of having my list stop in both vertical directions, I just want it to rotate around and around.

I've seen infinite_listview and roller_list. Roller list would involve extensive work for me to modify to my purposes, but has some hope. I'm wondering if there are any obvious or better solutions to just modify a ListView to get this kind of functionality.

Some code for you to look at:

   body: ListView.builder( 
    itemCount: userList.length, 
    itemBuilder: (context,index){ 
      return Text(index);} ),

With such varying screen sizes, every screen will behave differently regarding when a record goes offscreen. Perhaps the complexity of this is why there is a dearth of examples.

1 Answers

You can use the properties of ScrollController to return of the first element of the list, other solution is use the listview and the ScrollController, when the user finish the list you can re render the elements

Related