ListView和ListView.builder有什么区别,我们可以使用Listview.builder来创建,验证和提交表单吗? [英] What is the difference between ListView and ListView.builder and can we use Listview.builder to create and validate and submit forms?

查看:99
本文介绍了ListView和ListView.builder有什么区别,我们可以使用Listview.builder来创建,验证和提交表单吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Listview.builder和Listview有什么区别?我们可以使用ListView.builder提交表单吗?

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

我现在正在使用Listview.builder创建表单.

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

推荐答案

摘自官方文档:

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

ListView:从显式列表.此构造函数适用于少量的列表视图孩子们,因为构建列表需要为每个人做工作可能显示在列表视图中而不是只是那些实际上可见的孩子.

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创建一个可滚动的线性小部件数组,是按需创建的.此构造函数适用于列表视图有大量(或无限个)子代,因为生成器是仅针对那些实际可见的孩子.

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.

基本上, builder 构造函数创建一个惰性列表.当用户向下滚动列表时,Flutter会按需"构建窗口小部件.

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

默认的ListView构造函数一次构建整个列表.

Default ListView constructor build the whole list at once.

在您的情况下,默认构造可以正常工作,因为您现在已经在Column()上放置了多少个小部件.

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

这篇关于ListView和ListView.builder有什么区别,我们可以使用Listview.builder来创建,验证和提交表单吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆