'How to scroll horizontal listview by both direction left to right and right left in flutter

ListView.builder(
                    itemCount: smartAccessoriesList.length,
                    shrinkWrap: true,
                    scrollDirection: Axis.horizontal,
                    itemBuilder: (context, index) {
                      return SmartAccessories(
                        title: smartAccessoriesList[index].title,
                        imgPath: smartAccessoriesList[index].imgPath,
                        onPress: () {},
                      );
                    },
                  ),



Solution 1:[1]

We can achieve bidirectional scroll with SingleChildScrollView.

Try this

  SingleChildScrollView(
    scrollDirection:
    child: ListView.builder(
      itemCount: smartAccessoriesList.length,
      shrinkWrap: true,
      scrollDirection: Axis.horizontal,
      itemBuilder: (context, index) {
        return SmartAccessories(
          title: smartAccessoriesList[index].title,
          imgPath: smartAccessoriesList[index].imgPath,
          onPress: () {},
        );
        ;
      },
    ),
  );

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 nagendra nag