I tried to find an answer for the question "how to correctly code the depreciated 'title' argument of ThemeData?" (I am following a tutorial). However I found the correct answer bewteen some comments in other topic. I leave the answer below for future references and an easy finding.
theme: new ThemeData(
primaryTextTheme: TextTheme(
title: TextStyle(
color: Colors.white,
))),
How to change text color of AppBar, icon color of FAB universally using theme?
Answer by eMarine: https://stackoverflow.com/users/1584407/emarine
That is now deprecated, this giving message which itself says what to use
'
title
is the term used in the 2014 version of material design. The modern term isheadline6
. ' 'This feature was deprecated after v1.13.8.'
Example:
ThemeData(
textTheme: ThemeData.light().textTheme.copyWith(
headline6: GoogleFonts.lato(
color: _customColor,
fontWeight: FontWeight.normal),
),
),
Similarly,
Other parameters are also been deprecated. So, now we have to use the right ones which are mentioned below:
display4 => headline1;
display3 => headline2;
display2 => headline3;
display1 => headline4;
headline => headline5;
title => headline6;
subhead => subtitle1;
subtitle => subtitle2;
body2 => bodyText1;
body => bodyText2;
Replace 'title' for 'headline6':
theme: new ThemeData(
primaryTextTheme: TextTheme(
headline6: TextStyle(
color: Colors.white,
))),
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With