The argument type ‘MaterialColor’ can’t be assigned to the parameter type ‘MaterialStateProperty

After reading the documentation I found the way to set the color.

  theme: ThemeData(
    ...
    elevatedButtonTheme: ElevatedButtonThemeData(
        style: ButtonStyle(backgroundColor: MaterialStateProperty.all<Color>(Colors.red))), // Here Im having the error
    ...
    ),
  ),

Leave a Comment