【问题标题】:ThemeData - deprecated title argumentThemeData - 不推荐使用的标题参数
【发布时间】:2020-08-02 08:50:14
【问题描述】:

我试图为“如何正确编码 ThemeData 的折旧 'title' 参数?”这个问题找到答案。 (我正在学习教程)。但是,我在其他主题的一些 cmets 之间找到了正确答案。我将答案留在下面以供将来参考和轻松查找。

theme: new ThemeData(
  primaryTextTheme: TextTheme(
      title: TextStyle(
color: Colors.white,
))),

How to change text color of AppBar, icon color of FAB universally using theme?

eMarine 的回答:https://stackoverflow.com/users/1584407/emarine

【问题讨论】:

    标签: flutter dart


    【解决方案1】:

    现在已弃用,此消息本身说明使用什么

    'title 是 2014 版材料设计中使用的术语。这 现代术语是headline6。 ' '此功能在 v1.13.8 之后已被弃用。'

    示例:

    ThemeData(
              textTheme: ThemeData.light().textTheme.copyWith(
                    headline6: GoogleFonts.lato(
                        color: _customColor,
                        fontWeight: FontWeight.normal),
                  ),
          ),
    

    同样,

    其他参数也已被弃用。所以,现在我们必须使用下面提到的正确的:

    display4 => headline1;
    display3 => headline2;
    display2 => headline3;
    display1 => headline4;
    headline => headline5;
    title    => headline6;
    subhead  => subtitle1;
    subtitle => subtitle2;
    body2    => bodyText1;
    body     => bodyText2;
    

    【讨论】:

      【解决方案2】:

      将“标题”替换为“标题6”:

      theme: new ThemeData(
        primaryTextTheme: TextTheme(
            headline6: TextStyle(
      color: Colors.white,
      ))),
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多