当前位置:网站首页>还在用 ListView?使用 AnimatedList 让列表元素动起来
还在用 ListView?使用 AnimatedList 让列表元素动起来
2022-04-23 20:05:00 【岛上码农】
前言
列表是移动应用中用得最多的组件了,我们也会经常对列表元素进行增加或删除操作,最简单的方法是列表数据变动后,直接 setState 更新列表界面。这种方式存在一个缺陷就是列表元素会突然消失(删除)或出现(添加),当列表元素内容接近时,我们都没法知道操作是否成功了。而如果能够有动效展示这个消失和出现的过程,那么体验就会好很多,比如下面的这种效果,删除元素的时候,会有个逐渐消失的动画,而添加元素的时候会有渐现效果。

这里使用到的就是 AnimatedList,本篇文章的示例代码主要来自官方文档:AnimatedList 组件。需要注意的是,毕竟列表带了动画效果,对性能肯定会有影响,建议只对需要对元素进行删除、增加操作的小数据量的列表使用。
AnimatedList 介绍
AnimatedList 是 ListView 的替代,构造函数基本上和 ListView 一致。
const AnimatedList({
Key? key,
required this.itemBuilder,
this.initialItemCoun
版权声明
本文为[岛上码农]所创,转载请带上原文链接,感谢
https://blog.csdn.net/shuijian00/article/details/124362050
边栏推荐
- MySQL 进阶 锁 -- MySQL锁概述、MySQL锁的分类:全局锁(数据备份)、表级锁(表共享读锁、表独占写锁、元数据锁、意向锁)、行级锁(行锁、间隙锁、临键锁)
- MySQL数据库 - 连接查询
- IIS data conversion problem: 16bit to 24bit
- 命令-sudo
- nc基础用法4
- Golang timer
- Mysql database - single table query (II)
- uIP1. 0 actively sent problem understanding
- 山东大学软件学院项目实训-创新实训-网络安全靶场实验平台(七)
- Leetcode XOR operation
猜你喜欢

如何在BNB鏈上創建BEP-20通證

Building googlenet neural network based on pytorch for flower recognition

MySQL 进阶 锁 -- MySQL锁概述、MySQL锁的分类:全局锁(数据备份)、表级锁(表共享读锁、表独占写锁、元数据锁、意向锁)、行级锁(行锁、间隙锁、临键锁)

Decompile and get the source code of any wechat applet - just read this (latest)

Openharmony open source developer growth plan, looking for new open source forces that change the world!
![[numerical prediction case] (3) LSTM time series electricity quantity prediction, with tensorflow complete code attached](/img/73/ba9fb872aa279405204c411c18f348.png)
[numerical prediction case] (3) LSTM time series electricity quantity prediction, with tensorflow complete code attached

antd dropdown + modal + textarea导致的textarea光标不可被键盘控制问题

如何在BNB链上创建BEP-20通证

【文本分类案例】(4) RNN、LSTM 电影评价倾向分类,附TensorFlow完整代码

FFT物理意义: 1024点FFT就是1024个实数,实际进入fft的输入是1024个复数(虚部为0),输出也是1024个复数,有效的数据是前512个复数
随机推荐
LPC1768 关于延时Delay时间与不同等级的优化对比
Executor、ExecutorService、Executors、ThreadPoolExecutor、Future、Runnable、Callable
山东大学软件学院项目实训-创新实训-网络安全靶场实验平台(五)
Zero base to build profit taking away CPS platform official account
[transfer] summary of new features of js-es6 (one picture)
Compact CUDA tutorial - CUDA driver API
C语言的十六进制printf为何输出有时候输出带0xFF有时没有
Is meituan, a profit-making company with zero foundation, hungry? Coupon CPS applet (with source code)
How to select the third-party package of golang
Scrum Patterns之理解各种团队模式
Possible root causes include a too low setting for -Xss and illegal cyclic inheritance dependencies
MySQL syntax collation (5) -- functions, stored procedures and triggers
Kubernetes entry to mastery - bare metal loadbalance 80 443 port exposure precautions
uIP1.0 主动发送的问题理解
5 minutes to achieve wechat cloud applet payment function (including source code)
Mysql database - connection query
Golang timer
Electron入门教程3 ——进程通信
使用 WPAD/PAC 和 JScript在win11中进行远程代码执行
Introduction to electron Tutorial 4 - switching application topics