I have a RaisedButton
. I want to animate it\'s color from green to red, and vice versa, every time the user click
You can use AnimatedContainer as raiseButton child . and when color changed it will be animated!
RaisedButton(
onPressed: null,
padding: EdgeInsets.all(0),
child: AnimatedContainer(
color: pageIndex == 1 ? Color(0xFF4B4B4B) : Color(0xFFD8D8D8),
duration: Duration(milliseconds: 300),
),
)
and its just a container so it can have child like text..