I want to create a rounded elevated button that changes color when pressed. So far I've used ButtonStyle() to change the color, using the code:
style: ButtonStyle(
backgroundColor: MaterialStateProperty.resolveWith((Set<MaterialState> states) {
if (states.contains(MaterialState.pressed)) {
return Colors.black;}
return Colors.red;}))
This changes the color from red to black when touched. But I cant find a way to resize the button and create a rounded edges. I know how to do it with ElevatedButton.styleForm(), but with styleForm() I dont know how to make it change color when touched. Is there any other way I can do it with styleForm, or fuse both styles in one code?