Flutter : How to remove space between row in Listview
21,038
The spaces that you are getting between cards is from getRow() method.
Just update your
new Padding(padding: new EdgeInsets.all(10.0),
to
new Padding(padding: new EdgeInsets.all(1.0),
and see the change.
If you don't want any spaces in between, you can directly return Card();
Author by
Mohit Suthar
I don't want to love my Job, I love my work on Android. Bad habit on Kotlin I forgetting to JAVA
Updated on July 09, 2022Comments
-
Mohit Suthar almost 2 years
I am just doing some demos of flutter, I love to do it, In listview, I cant find out that how to remove space between rows
my code is pretty simple, This one is Widget which I return to my layout
Widget _getWidget(BuildContext context) { return new Material( child: new Container( padding: EdgeInsets.only(top: 20.0), color: Colors.blueGrey[500], child: new Column( crossAxisAlignment: CrossAxisAlignment.start, children: <Widget>[ _getHeader(context), new Expanded(child: getListView()) ], ), ), );
}
This one is Listview
ListView getListView() => new ListView.builder( itemCount: widgets.length, itemBuilder: (BuildContext context, int position) { return getRow(position); });
This one is row which i use card view
Widget getRow(int i) { return new Padding(padding: new EdgeInsets.all(10.0), child: new Card( child: new Column( children: <Widget>[ new ListTile( title: new Text( "Name : ${widgets[i].username}" ), subtitle: new Text( "Decription : You may go now!!" ), ), new ButtonTheme.bar( child: new ButtonBar( children: <Widget>[ new FlatButton( child: const Text('Accept'), onPressed: () { /* ... */ }, ), new FlatButton( child: const Text('Reject'), onPressed: () { /* ... */ }, ), ], ), ), ], ), ) ); }
Help Me.