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.
Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss
Asked: 2022-06-15 11:00:00 +0000
Seen: 11 times
Last updated: Nov 18 '21
How can one generate a list by using a portion of another list?
How can Swagger V3 use Schema Annotation to transform a List of Long to look like a List of String?
How can I modify the width of the column filter in an R shiny datatable?
How can dote be eliminated from the menu items in HTML?
How can an EditForm validate a list object in MudBlazor?
How do you update a dataframe within a for loop in R after passing a list?
How can resetting a list be avoided during a loop?
What is the LINQ query to retrieve the employee with the second highest salary?