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 primary, // set the background color Color onPrimary, Color onSurface, Color shadowColor, double elevation, TextStyle textStyle, … Read more