Dev94
Dev94

Reputation: 877

Listview not scrolling with swipe gesture on listview Flutter

I am using ListView with RawScrollbar, and it is working fine. I can scroll the listview with scroll bar drag.

I want to scroll listview in both ways either through scrollbar drag or listview swipe gesture. But currently I am unable to scroll listview with swipe gesture.

RawScrollbar(
          thumbColor: Colors.grey[200],
          isAlwaysShown: true,
          controller: controller,
          thickness: 17,
          radius: const Radius.circular(20),
          child: ListView.separated(
                 scrollDirection: Axis.horizontal,
                 shrinkWrap: true,
                 controller: controller,
                 padding: EdgeInsets.only(left: 5, right: 5, bottom: 20),
                 itemBuilder: (context, index) {
                     return Container();
                      
                 },       
               ),
          );

This is my code. Anyone help me please with this little issue.

Thanks in advance

Upvotes: 0

Views: 325

Answers (1)

Sergio Clemente
Sergio Clemente

Reputation: 888

try add scrollbarOrientation on rawscrollbar. For scroll Direction vertial, orientation is left or right . For scroll Direction horizontal, orientation is top or bottom.

And remember that RawScrollbar controller is the same that ListView controller.

RawScrollbar(
          thumbColor: Colors.grey[200],
          scrollbarOrientation: ScrollbarOrientation.bottom,
          isAlwaysShown: true,
          controller: controller,
          thickness: 17,
          radius: const Radius.circular(20),
          child: ListView.separated(
                 scrollDirection: Axis.horizontal,
                 shrinkWrap: true,
                 controller: controller,
                 padding: EdgeInsets.only(left: 5, right: 5, bottom: 20),
                 itemBuilder: (context, index) {
                     return Container();
                      
                 },       
               ),
          );

Upvotes: 1

Related Questions