'Flutter upgrade to 2.5.3 causing deprecated issue
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. •
Please help me with a proposed fix for buttonColor. Thanks.
Solution 1:[1]
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.
Solution 2:[2]
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.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Dani3le_ |
| Solution 2 | Harish |

