Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
2.2k views
in Technique[技术] by (71.8m points)

flutter - What is the difference between ListView and ListView.builder and can we use Listview.builder to create and validate and submit forms?

What is the difference between Listview.builder and Listview? Can we use ListView.builder to submit forms?

I am using the Listview.builder now to create forms.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

From official docs:

https://api.flutter.dev/flutter/widgets/ListView/ListView.html

ListView: Creates a scrollable, linear array of widgets from an explicit List. This constructor is appropriate for list views with a small number of children because constructing the List requires doing work for every child that could possibly be displayed in the list view instead of just those children that are actually visible.


https://api.flutter.dev/flutter/widgets/ListView/ListView.builder.html

ListView.builder Creates a scrollable, linear array of widgets that are created on demand. This constructor is appropriate for list views with a large (or infinite) number of children because the builder is called only for those children that are actually visible.

Basically, builder constructor create a lazy list. When user is scrolling down the list, Flutter builds widgets "on demand".

Default ListView constructor build the whole list at once.

In your case, default construct works fine, because you already now how many widgets should put on Column().


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share

2.1m questions

2.1m answers

63 comments

56.5k users

...