【发布时间】:2020-09-24 00:43:50
【问题描述】:
使用颤振,不仅在行之间放置分隔符,而且作为第一行和最后一行放置分隔符的最简单和最干净的方法是什么?
我可以通过伪造itemCount 并添加额外的行来做到这一点。
...
child: ListView.separated(
// Offset itemCount to start with separator
itemCount: sortedList.length + 2,
itemBuilder: (context, index) {
if (index == 0) {
return SizedBox(height: 0.0);
}
if (index == sortedList.length + 1) {
return SizedBox(height: 0.0);
}
return ListItem(...);
},
separatorBuilder: (context, index) {
return SizedBox(height: 10.0);
}))),
【问题讨论】: