Reputation: 4111
'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.
Below is the code causing the issue:
What should I change instead of buttonColor. I tried with primary but could not find any reference in the official doc.
Thaks.
Upvotes: 0
Views: 529
Reputation: 14885
Try below code hope its help to you.
Refer Button Changes here
Refer ButtonTheme
Refer ButtonThemeData
TextButton(
child: Text('Ok',
style: TextStyle(
color: Theme.of(context).buttonTheme.colorScheme?.primary,
fontWeight: FontWeight.bold,
)),
onPressed: () {
print('Button Pressed');
},
),
Upvotes: 0
Reputation: 3632
Yes, there has been couple of breaking changes on buttons that you can see here --> https://docs.flutter.dev/release/breaking-changes/buttons
In your case, the themeData
reference has changed, you can see a detailed information, if you check the ThemeData class.
You will be needing to use buttonTheme
that is a ButtonThemeData it like the following:
Theme.of(context).buttonTheme.colorScheme?.primary
Upvotes: 0
Reputation: 3720
You can use TextTheme
In your material app theme
textTheme: TextTheme(
button: TextStyle(
fontSize: 18.0,
color: "Your color",
fontWeight: FontWeight.bold
)
In your code
Text(
style: Theme.of(context).textTheme.button
)
Upvotes: 0