[英]How can I transform background image in Flutter?
I want that whenever I load my screen , the background image should zoom in and then zoom out.我希望每当我加载屏幕时,背景图像都应该放大然后缩小。 How can I achieve that inFlutter?
我如何才能实现 inFlutter?
Add this Initstate code that you need to animate page添加您需要为页面设置动画的 Initstate 代码
void initState() {
super.initState();
animationController = new AnimationController(
vsync: this, duration: new Duration(seconds: 3));
animation =
new CurvedAnimation(parent: animationController, curve: Curves.easeOut);
animation.addListener(() => this.setState(() {}));
animationController.forward();
setState(() {
_visible = !_visible;
});
}
And add it this one to your image widget并将其添加到您的图像小部件中
new Image.asset('assets/images/background.png',
width: animation.value * 250,
height: animation.value * 250,
),
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.