How to add padding top of the ListView.builder in Flutter?
Just wrap your ListView
to Container
Widget and Container
widget it self has property to set padding/margin by use EdgeInsets.only(top:50) // or whatever you want
For more info about EdgeInsets click Here.
If you want to add padding to the inner content that scrolls up and down with the items, you can just add padding
to the ListView
itself.
If you wrap the ListView in a Padding
or Container
, it will create a gap between the edge where the content disappears and the widget above.
...
ListView.builder(
padding: EdgeInsets.only(top: 10),
itemCount: cards.length,
itemBuilder: (context, index) {
return MyCard(
title: cards[index].title,
);
},
)
...