首页 > 解决方案 > Flutter 中 RecyclerView 的替代方案是什么?

问题描述

什么是颤振中回收视图的替代方法我尝试使用此代码但是如何在颤动中使用列表视图小部件进行动画处理

这是有效的吗?

 ListView(
 children: <Widget>[
ListTile(
  leading: Icon(Icons.map),
  title: Text('Map'),
),
ListTile(
  leading: Icon(Icons.photo_album),
  title: Text('Album'),
),
ListTile(
  leading: Icon(Icons.phone),
  title: Text('Phone'),
  ),
 ],
);

标签: flutterflutter-layoutflutter-animation

解决方案


ListView

通常这应该与少数孩子一起使用,因为 List 也会在列表中构造不可见的元素,并且大量元素可能会导致效率低下。

ListView.builder()

列表项是惰性构建的,这意味着仅构建特定数量的列表项,当用户向前滚动时,较早的列表项将被销毁。

更多信息在这里


推荐阅读