When creating a very simple scrollable list in Flutter, what are the advantages and disadvantages of saying (where widgets is List<Widget> == true
):
Option 1:
var widget = new SingleChildScrollView( child: new Column( chidren: widgets ));
Option 2:
var widget = new ListView(children: widgets);
You can wrap your ListView widget inside the Expanded widget and this will allow the ListView to take all the available as long as the Column allows.
For example: You need to only show a list of contacts on your screen and the list items are more or less similar (UI wise and category wise). Then you would use a Listview. A SingleChildScrollView can be compared to "ScrollView" in Android.
builder takes properties similar to ListView but has two special parameters known as itemCount and itemBuilder .
ListView is the most commonly used scrolling widget. It displays its children one after another in the scroll direction. In the cross axis, the children are required to fill the ListView. If non-null, the itemExtent forces the children to have the given extent in the scroll direction.
ListView:
Listview Widget shows the unlimited number of children inside it, but the main advantage of using ListView is it renders only visible items on the screen perhaps more specifically I would say ListView.Builder()
Column
The column is used when we have to draw different widgets in the list. If items increase in the column
then SingleChildScrollView
is used for scrolling purposes.
For More Reference:
https://medium.com/flutterworld/flutter-problem-listview-vs-column-singlechildscrollview-43fdde0fa355
Definitely go for option 2. ListView
have a few cool optimisations. https://youtu.be/UUfXWzp0-DU?t=33m38s
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