Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

ListView remove space between ListTile

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.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

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.

>Solution :

Just add dense true

ListTile(
    dense: true,
    contentPadding: EdgeInsets.symmetric(horizontal: 0.0, vertical: 0.0),
    visualDensity: VisualDensity(horizontal: 0, vertical: -4),
)
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading