Flutter upgrade to 2.5.3 causing deprecated issue

1.3k views Asked by At

I have been been able to upgrade my code from flutter 1.2.0 to 2.5.3. Still I am getting some deprecated warnings as mentioned below:

info • 'buttonColor' is deprecated and shouldn't be used. No longer used by the framework, please remove any reference to it. This feature was deprecated after v2.3.0-0.2.pre. •

enter image description here

Please help me with a proposed fix for buttonColor. Thanks.

2

There are 2 answers

0
Dani3le_ On BEST ANSWER

Instead of buttonColor you could use ButtonTheme.

ThemeData(
    appBarTheme: appBarTheme,
    scaffoldBackgroundColor: scaffoldBackgroundColor,
    primarySwatch: primarySwatch,
    textTheme: textTheme,
    buttonTheme: ButtonThemeData(buttonColor: AppColor.appBlueColor)
)

Read more on ThemeData class.

0
Harish On

https://docs.flutter.dev/release/breaking-changes/buttons

Here's an detailed explanation from official docs.

If you still have doubts feel free to ask.