How can I change the background color of Elevated Button in Flutter from function?
You can style ElevatedButton by using the styleFrom static method or the ButtonStyle class. The first one is more convenient than the second one. Using styleFrom to style an ElevatedButton: ElevatedButton( child: Text(‘Button’), onPressed: () {}, style: ElevatedButton.styleFrom({ Color backgroundColor, // set the background color Color foregroundColor, Color disabledForegroundColor, Color shadowColor, double elevation, TextStyle textStyle, … Read more