flutter ElevatedButton background color code example
Example 1: elevated button flutter color
ElevatedButton(
style: ButtonStyle(
backgroundColor: MaterialStateProperty.resolveWith<Color>(
(Set<MaterialState> states) {
if (states.contains(MaterialState.pressed))
return Colors.green;
return null; // Use the component's default.
},
),
),
)
Example 2: elevated Button Theme background color in flutter
style: ElevatedButton.styleFrom(
primary: Colors.purple,
),