我想在ListViewBuilder的左侧实现填充,但是每当我添加填充并且用户滚动列表(水平轴)时,您都可以清楚地看到填充:
代码:
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.all(2.0),
child: ListView.separated(
separatorBuilder: (context, index) => const SizedBox(width: 10,),
itemCount: 4,
scrollDirection: Axis.horizontal,
itemBuilder: (context, index) {
return Container(
height: 100,
width: 100,
color: Colors.grey,
);
},
)
);
}
ListView.seperator()上有padding属性
child: ListView.separated(
padding: const EdgeInsets.only(left: 2),