简体   繁体   中英

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

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();
                      
                 },       
               ),
          );

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM