class _MaintenanceState extends State<Maintenance> {
Function below is supposed to initialise the animation
@override
void initState() {
super.initState();
_animate();
}
var loginWidth = 0.0;
Curve _curve = Curves.fastOutSlowIn;
_animate() {
setState(() {
loginWidth == 0.0 ? loginWidth = 130 : loginWidth = 0.0;
});
}
I tried placing the width of the animated container in the
initState
but it still doesn't animate.
AnimatedContainer(
duration: Duration(seconds: 1),
width: loginWidth,
height: 60.0,
decoration: BoxDecoration(
color: Colors.green[600],
borderRadius: BorderRadius.circular(20.0),
),
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Row(
children: [
Text("Add
Project"),
)),
Spacer(),
Image(
image: AssetImage(
"assets/images/add_icon.png",
),
),
],
),
),
),
Any suggestions would be much appreciated
question from:
https://stackoverflow.com/questions/65643022/how-do-i-animate-a-container-when-the-page-is-initializing 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…