I have an ElevatedButton, and I’d like it to response to the user’s touch by growing slightly in size, say around 10%
Ideally it would be an animation with a smooth change in size as you press and release the button. A kind of touch feedback, but altering the button size rather than changing colour or using ripple effects.
2
Answers
you can make this using AnimatedContainer, for changing button size you have to wrap your AnimatedContainer with AnimatedSize widget.
Here I create an animation where i exactly make this animation. take a look then implement your logic.
https://www.linkedin.com/posts/shafi-munshi_flutter-dart-flutterabranimation-activity-7190095624216743937-vxQF?utm_source=share&utm_medium=member_desktop
One way to achieve this is using a ButtonStyle. You can pass a class implementing
MaterialStateProperty<Size?>
to minimum size, which will allow you to increase the size when the button is in thepressed
state.