我正在尝试在Flutter中实现水平列表视图,目前功能正常,但产品之间的距离太紧密了,是否有办法在它们之间添加空间?
提前感谢。
Row(
children: <Widget>[
Expanded(
child: SizedBox(
child: FutureBuilder(
future: httpService.getProducts(),
builder: (BuildContext context, AsyncSnapshot snapshot) {
if (snapshot.data == null) {
return Container(
child: Center(
child: Text('Loading...'),
),
);
}
else if (snapshot.data.length == 0){
return Container(
child: Center(
child: Center(
child: Text('No offers'),
),
),
);
} else {
return ListView.builder(
scrollDirection: Axis.horizontal,
shrinkWrap: true,
itemCount: snapshot.data.length,
itemBuilder: (ctx, i) => (AlAinPdtItem(
title: snapshot.data[i].title,
imgUrl: snapshot.data[i].imgUrl,
price: snapshot.data[i].price,
pdt2: snapshot.data[i])),
);
}
},
)))])
],
),
),