1 | initial version |
You can remove the padding between items in a ListView by setting the padding
property of the ListView
to EdgeInsets.zero
and the itemExtent
property to the desired item height. Here's an example:
ListView.builder(
padding: EdgeInsets.zero,
itemExtent: 50,
itemCount: items.length,
itemBuilder: (context, index) {
return ListTile(
title: Text(items[index]),
);
},
);
Note that setting the itemExtent
property can improve the performance of your ListView, but it may not be suitable for dynamic or variable height items. In that case, you can use a SliverList
inside a CustomScrollView
with a SliverPadding
instead.