flutter - Flutter:AnimatedList动画曲线
问题描述
如何在我的 AnimatedList 的动画中添加曲线(例如 Curves.easeIn)?
AnimatedList(
key: _animList,
initialItemCount: _myList.length,
itemBuilder: (context, index, animation) {
return SlideTransition(
position: animation.drive(Tween(begin: Offset(1, 0), end: Offset(0, 0))), <-- curve?
child: Container(color: Colors.red, height: 100, width: 100)
);
}
)
解决方案
您应该在Tween上调用链方法。chain方法采用CurveTween和CurveTween采用曲线
试试这个
AnimatedList(
key: _animList,
initialItemCount: _myList.length,
itemBuilder: (context, index, animation) {
return SlideTransition(
position: animation.drive(
Tween(begin: Offset(1, 0), end: Offset(0, 0))
.chain(CurveTween(curve: Curves.bounceIn))),
child: Container(color: Colors.red, height: 100, width: 100));
});
推荐阅读
- c# - 为什么 MSDN 建议添加和删除链表节点以修改其值?
- logstash - Logstash - 多个 grok 模式不能一起工作
- json - 如何在 Flutter 的轮播(滑块)中显示 JSON 文件中的图像
- python - 如何正确地将多图像输入输入到 tensorflow keras 中的多输入 cnn 模型
- node.js - 成功完成后 AWS Lambda 函数超时
- javascript - 在 Next.js 中 - 此站点无法提供安全连接
- filter - 带有数组类型列的 Kendo Grid Server 端过滤
- jquery - 边界半径对更改类没有影响
- python - 在添加新数据之前删除上个月
- sql - 数据透视表和分组依据