@override
void initState() {
super.initState();
_controller = AnimationController(
vsync: this,
duration: Duration(milliseconds: 300),
upperBound: 0.5,
);
}
@override
void dispose() {
super.dispose();
_controller.dispose();
}
RotationTransition(
turns: Tween(begin: 0.0, end: 0.5).animate(_controller),
child: IconButton(
icon: Icon(Icons.expand_less),
onPressed: () {
setState(() {
if (_expanded) {
_controller..reverse(from: 0.5);
} else {
_controller..forward(from: 0.0);
}
_expanded = !_expanded;
});
},
),
)