flutter Container 过渡动画
double mWidth = 100.0;
double mHeight = 100.0;
...
// 使用 AnimatedContainer 替换 Container
AnimatedContainer(
duration: Duration(seconds: 1),
width: mWidth,
height: mHeight,
color: Colors.red,
child: Text('改变我的属性会触发过渡动画'),
),
FlatButton(
child: Text('开始动画'),
onPressed: () {
setState(() {
mWidth = 200.0;
mHeight = 200.0;
});
},
)
...