gpt4 book ai didi

flutter - ListView和ListView.builder有什么区别,我们可以使用Listview.builder来创建、验证和提交表单吗?

转载 作者:行者123 更新时间:2023-12-02 18:12:24 36 4
gpt4 key购买 nike

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

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

最佳答案

来自官方文档:

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.

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

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

就您而言,默认构造工作正常,因为您现在已经知道应该在 Column() 上放置多少个小部件。

关于flutter - ListView和ListView.builder有什么区别,我们可以使用Listview.builder来创建、验证和提交表单吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56272328/

36 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com