当前位置:网站首页>还在用 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
边栏推荐
- Shanda Wangan shooting range experimental platform project - personal record (V)
- MySQL syntax collation (3)
- Deep learning -- Summary of Feature Engineering
- Mysql database - connection query
- [transfer] summary of new features of js-es6 (one picture)
- Main differences between go and PHP
- The most detailed network counting experiment in history (2) -- rip experiment of layer 3 switch
- IIS数据转换问题16bit转24bit
- No, some people can't do the National Day avatar applet (you can open the traffic master and earn pocket money)
- Why is the hexadecimal printf output of C language sometimes with 0xff and sometimes not
猜你喜欢
Compact CUDA tutorial - CUDA driver API
LeetCode异或运算
命令-sudo
Leetcode XOR operation
【文本分类案例】(4) RNN、LSTM 电影评价倾向分类,附TensorFlow完整代码
Distinction between pointer array and array pointer
The most detailed network counting experiment in history (2) -- rip experiment of layer 3 switch
ESP8266-入门第一篇
Shanda Wangan shooting range experimental platform project - personal record (IV)
Grafana shares links with variable parameters
随机推荐
Project training of Software College of Shandong University - Innovation Training - network security shooting range experimental platform (V)
Introduction to electron tutorial 3 - process communication
山大网安靶场实验平台项目—个人记录(四)
How to use go code to compile Pb generated by proto file with protoc Compiler Go file
Video understanding
Unity general steps for creating a hyper realistic 3D scene
图书管理数据库系统设计
Leetcode XOR operation
对普通bean进行Autowired字段注入
Shanda Wangan shooting range experimental platform project - personal record (IV)
2021-2022-2 ACM training team weekly Programming Competition (8) problem solution
Zero cost, zero foundation, build profitable film and television applet
5 minutes to achieve wechat cloud applet payment function (including source code)
nc基础用法3
Use test of FFT and IFFT library functions of TI DSP
Efficient serial port cyclic buffer receiving processing idea and code 2
渤海期货这家公司怎么样。期货开户办理安全?
山东大学软件学院项目实训-创新实训-网络安全靶场实验平台(五)
Scrum Patterns之理解各种团队模式
Kubernetes入门到精通-在 Kubernetes 上安装 OpenELB