TextStyle(fontSize: 16)
有没有办法将 fontSize 设置为大于正常大小而不是硬编码大小?对于网络:
font-size: larger
您可以使用主题的默认文本大小:
Text('Hi There', style: Theme.of(context).textTheme.titleLarge)
有不同的
textTheme
属性,例如:
NAME SIZE WEIGHT SPACING
headline1 96.0 light -1.5
headline2 60.0 light -0.5
headline3 48.0 regular 0.0
headline4 34.0 regular 0.25
headline5 24.0 regular 0.0
headline6 20.0 medium 0.15
subtitle1 16.0 regular 0.15
subtitle2 14.0 medium 0.1
body1 16.0 regular 0.5 (bodyText1)
body2 14.0 regular 0.25(bodyText2)
button 14.0 medium 1.25
caption 12.0 regular 0.4
overline 10.0 regular 1.5
如果您的
textTheme
中未应用 ThemeData
,则将应用默认值。
希望对您有帮助。