如何在flutter中使用动画将容器缓慢展开到一定高度?
How to use animation for slowly expanding the container to certain height in flutter?
我在列表视图中有容器,只要其中一个容器在屏幕上显示超过 75%,容器的高度就会从 100 增加到 150。
但是如何用动画让容器在3秒内从100扩展到150呢?
我是 flutter 的新手,请帮助我。
使用 AnimatedContainer
AnimatedContainer(
duration: Duration(seconds: 3),
height: expand?150:100,
)
Ref: https://api.flutter.dev/flutter/widgets/AnimatedContainer-class.html
我在列表视图中有容器,只要其中一个容器在屏幕上显示超过 75%,容器的高度就会从 100 增加到 150。
但是如何用动画让容器在3秒内从100扩展到150呢?
我是 flutter 的新手,请帮助我。
使用 AnimatedContainer
AnimatedContainer(
duration: Duration(seconds: 3),
height: expand?150:100,
)
Ref: https://api.flutter.dev/flutter/widgets/AnimatedContainer-class.html