I am trying to remove empty space between ListTile in a ListView
The list i am trying to delete space from
What i tried so far : Remove padding of ListView Remove padding of ListTile Remove any space from the ListTile content.
I know it is probably that i dont understand where that free space come from. Any idea ?
Widget buildWidget() {
List<ListItem> listData = createListData();
return ListView.builder(
padding: const EdgeInsets.all(0),
itemCount: listData.length,
itemBuilder: (context, index) {
final item = listData[index];
return ListTile(
contentPadding: const EdgeInsets.all(0),
title: item.buildTitle(context),
);
}
);
}
EDIT Solved : ListTile force padding. So even if the answer work if you're force to use a ListTile. Basicly using a Container instead of ListTile make it work without that strange fix.
CodePudding user response:
Just add dense true
ListTile(
dense: true,
contentPadding: EdgeInsets.symmetric(horizontal: 0.0, vertical: 0.0),
visualDensity: VisualDensity(horizontal: 0, vertical: -4),
)