【发布时间】:2019-03-18 06:04:03
【问题描述】:
我以前用Android开发app,现在用Flutter,但是想找和android:includeFontPadding和android:lineSpacingExtra一样的Text属性?
【问题讨论】:
标签: flutter
我以前用Android开发app,现在用Flutter,但是想找和android:includeFontPadding和android:lineSpacingExtra一样的Text属性?
【问题讨论】:
标签: flutter
您似乎正在寻找 TextStyle 类的 height 属性。
这是一个例子:
Text(
"Some lines of text",
style: TextStyle(
fontSize: 14.0,
height: 1.5 //You can set your custom height here
)
)
【讨论】:
您可以设置 2 个属性
Text("Hello World", style: TextStyle(
height: 1.2 // the height between text, default is null
letterSpacing: 1.0 // the white space between letter, default is 0.0
));
【讨论】:
height: null 和 height: 1.0 的行为不同。默认是height: null 而不是height: 1.0。
height 取决于文本的fontFamily。对于 OpenSans 和 Lato,它似乎是 120%(相当于 Flutter 中的 height: 1.2)。更多详情this Flutter github issue