如何解决如何在Flutter中转换背景图片?
我希望每当加载屏幕时,背景图像都应放大然后缩小。我该如何实现inFlutter?
解决方法
添加此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;
});
}
并将其添加到您的图像小部件
new Image.asset('assets/images/background.png',width: animation.value * 250,height: animation.value * 250,),
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。