builder有什么区别

builder有什么区别

本文介绍了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


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

基本上, 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来创建,验证和提交表单吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-03 01:15