I just added a ListView as a child of Scaffold > Stack
and it appears to have SafeArea at the top. Column does not have this problem. Is there any way for me to remove it?
Container( color: Colors.grey[100], child: ListView( children: <Widget>[ Image( image: snapshot.data.hero, height: 300.0, fit: BoxFit.cover, ), ], ), ),
ListView
Column
bottom : This property is of type bool. It is true by default and setting it to false would disable SafeArea from adding padding to the bottom of the screen. top : This property is also of type bool and setting it to false would avoid padding at top of the screen.
Solution: Use visualDensity property instead within the ListTile .
In Flutter, ListView is a scrollable list of widgets arranged linearly. It displays its children one after another in the scroll direction i.e, vertical or horizontal. There are different types of ListViews : ListView. ListView.
ListView is a very important widget in a flutter. It is used to create the list of children But when we want to create a list recursively without writing code again and again then ListView. builder is used instead of ListView. ListView. builder creates a scrollable, linear array of widgets.
From the ListView
documentation:
By default, ListView will automatically pad the list's scrollable extremities to avoid partial obstructions indicated by MediaQuery's padding. To avoid this behavior, override with a zero padding property.
So the fix is:
ListView( padding: EdgeInsets.zero, ... );
Found this solution as well
MediaQuery.removePadding( context: context, removeTop: true, child: ListView(...), )
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With