[英]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: () {}, ); }, ),
We can achieve bidirectional scroll with SingleChildScrollView
.我们可以通过
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: () {},
);
;
},
),
);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.