Home > database >  How can I make the list view scroll 360 using flutter
How can I make the list view scroll 360 using flutter

Time:11-09

I have list view and I need it scroll 360ْ I mean when last item finish the first item start.

CodePudding user response:

Lets say you have list of items. You can do this.

 ListView.builder(builder: (context, index) {
      final actualIndex = index % items.size();
      return YourWidget(items[actualIndex]);
    },
    itemCount: 9999999999,
  );

CodePudding user response:

Consider using ListWheelScrollView with looping delegate.

ListWheelScrollView.useDelegate(
        itemExtent: 30,
        childDelegate: ListWheelChildLoopingListDelegate(
          children: List<Widget>.generate(
            10, (index) => Text('$index'),
          ),
        ),
      )
  • Related