【发布时间】:2020-07-03 12:52:30
【问题描述】:
我希望能够设置一个可以在我的应用程序中使用的默认文本样式,然后在特定情况下覆盖该样式的一部分。 React Native 支持这个,请问 Flutter 也支持吗?或者如果没有,我怎样才能实现这样的目标?
我希望这会如何工作的示例:
style.dart:
ThemeData appTheme() {
return ThemeData(
...
textTheme: TextTheme(
headline1: TextStyle(fontSize: 26.0, fontWeight: FontWeight.bold),
...
)
)
}
body.dart:
Text('My text here', style: [TextStyle(color: myColorVariable), themeData.textTheme.headline1])
非常感谢!
【问题讨论】: