Home > Back-end >  How ListView can Stop at each element in Flutter
How ListView can Stop at each element in Flutter

Time:07-28

My question is very simple but I did not find a result.

In a ListView.builder (with horizontal scroll) for example if there are 5 elements the user can scroll them all at once. I would like that the user can scroll only 1 by 1.

In short I would like the animation of the list to stop at each element.

Example of my list :

Widget _list()
  {
    return ListView.builder(
        physics: const ClampingScrollPhysics(),
        scrollDirection: _horizontalDisplay? Axis.horizontal : Axis.vertical,
        itemCount: data!.length,
        itemBuilder: (context, index)
        {
          return widgetToDisplay(index);
        }
    );
  }

CodePudding user response:

That's not the function of ListView.builder. You can use cards for the same. In listview.builder, you can use cards and that will change after every scroll.

CodePudding user response:

The ListView.builder can't make it, you need to use carousel_slider package

  • Related