Issue
I tried to change the background color of ElevatedButton but it gave me an error. How can I change it?
ElevatedButton(
onPressed: null,
style: ButtonStyle(backgroundColor: Colors.red), // Error
}
Solution
Try This way
ElevatedButton(
onPressed: () {},
style: ElevatedButton.styleFrom(
primary: Colors.red,
),)
Answered By – xahid_rocks
Answer Checked By – Dawn Plyler (FlutterFixes Volunteer)