这是我的第一个颤振问题,我试图让动画在堆栈中的背景图像上方播放。如果我删除图像,那么我可以看到动画正在播放,但是其中的图像没有动画播放,并且在图像放入之前我可以看到它一瞬间,所以我猜测动画在图像后面。
return Stack(
alignment: Alignment.center,
children: <Widget>[
Positioned.fill(child: new Image.asset(
colors[_Element.image],
width: size.width,
height: size.height,
fit: BoxFit.fill),),
Positioned.fill(child: Container(
child: AnimatedBuilder(
animation: CurvedAnimation(parent: _controller, curve: Curves.fastOutSlowIn),
builder: (context, child){
return Stack(
alignment: Alignment.center,
children: <Widget>[
_buildContainer(150 * _controller.value),
_buildContainer(200 * _controller.value),
_buildContainer(250 * _controller.value),
_buildContainer(300 * _controller.value),
_buildContainer(350 * _controller.value),
],
);
},
),
),),
Widget _buildContainer(double radius) {
return Container(
width: radius,
height: radius,
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Colors.blue.withOpacity(1 - _controller.value),
),
);
}
感谢您的时间