首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >颤振中废弃textTheme的替代

颤振中废弃textTheme的替代
EN

Stack Overflow用户
提问于 2021-02-20 03:13:14
回答 3查看 3.6K关注 0票数 0

我是一个初来乍到的新手,对它的术语和特性仍然很熟悉。无论如何,当我使用textTheme,并提到任何属性,如titlebutton等,都会显示出该属性已经过时,不应该再使用了。我的假设是,textTheme只被弃用,所以我应该用什么来代替它,这样它就不会被废弃了?

EN

回答 3

Stack Overflow用户

回答已采纳

发布于 2021-02-20 03:26:16

对于title,您需要使用subtitle1代替。

您可以在TextTheme源代码中看到text _theme.dart中的不推荐列表。如果您使用的是IntelliJ,您可以通过右键单击title属性查看源代码,然后选择Go To -> 声明或Usage

这里摘录了text _theme.dart的不推荐属性

代码语言:javascript
运行
复制
@Deprecated(
  'This is the term used in the 2014 version of material design. The modern term is headline1. '
  'This feature was deprecated after v1.13.8.'
)
TextStyle? display4,
@Deprecated(
  'This is the term used in the 2014 version of material design. The modern term is headline2. '
  'This feature was deprecated after v1.13.8.'
)
TextStyle? display3,
@Deprecated(
  'This is the term used in the 2014 version of material design. The modern term is headline3. '
  'This feature was deprecated after v1.13.8.'
)
TextStyle? display2,
@Deprecated(
  'This is the term used in the 2014 version of material design. The modern term is headline4. '
  'This feature was deprecated after v1.13.8.'
)
TextStyle? display1,
@Deprecated(
  'This is the term used in the 2014 version of material design. The modern term is headline5. '
  'This feature was deprecated after v1.13.8.'
)
TextStyle? headline,
@Deprecated(
  'This is the term used in the 2014 version of material design. The modern term is headline6. '
  'This feature was deprecated after v1.13.8.'
)
TextStyle? title,
@Deprecated(
  'This is the term used in the 2014 version of material design. The modern term is subtitle1. '
  'This feature was deprecated after v1.13.8.'
)
TextStyle? subhead,
@Deprecated(
  'This is the term used in the 2014 version of material design. The modern term is subtitle2. '
  'This feature was deprecated after v1.13.8.'
)
TextStyle? subtitle,
@Deprecated(
  'This is the term used in the 2014 version of material design. The modern term is bodyText1. '
  'This feature was deprecated after v1.13.8.'
)
TextStyle? body2,
@Deprecated(
  'This is the term used in the 2014 version of material design. The modern term is bodyText2. '
  'This feature was deprecated after v1.13.8.'
)
票数 1
EN

Stack Overflow用户

发布于 2022-05-22 13:59:23

不建议使用

textTheme,不应该使用它。此属性不再使用,请改用toolbarTextStyle和titleTextStyle。这个特性在v2.4.0-0.PRE之后就被否决了。溶液

使用toolbarTextStyle

代码语言:javascript
运行
复制
  appBarTheme: AppBarTheme(
      color: Colors.white,
      elevation: 0.0,
      iconTheme: IconThemeData(color: Colors.black),
      toolbarTextStyle: Theme.of(context).textTheme.bodyText2,
      titleTextStyle: Theme.of(context).textTheme.headline6)),
票数 1
EN

Stack Overflow用户

发布于 2022-04-02 15:28:17

按照的回答,并正确阅读他或她友好共享的文档,您需要用headline6而不是subtitle1代替ישואוהבאותך标题。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/66287632

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档