在 Flutter Text Widget 中调整新行间距
Adjust new line spacing in Flutter Text Widget
因此,objective 非常简单,将一堆文本包装在一个容器中。
为此,我遵循了 ,但是创建的新行 在前一行 .
之间有太多 space
我的 Container() with Text() 代码:
description == ""
? SizedBox.shrink()
: Container(
padding: const EdgeInsets.symmetric(horizontal: 10.0),
//width: MediaQuery.of(context).size.width * 0.8,
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
children: [
new Text(
description,
textAlign: TextAlign.left,
style: TextStyle(fontSize: 18),
),
],
),
)
小提示:如果对 Parent widget 有任何描述,我只是使用 SizeBox.shrink() 作为“empety widget”。
现在怎么样,太多了 space:
应该如何:
我知道 1º 图像更大,但这不是行距更大的原因
引用自here。您可以通过更改样式中的 height
属性 来调整行距。 1.0 对我来说似乎不错,但您可以尝试将其设置为 0.8、0.7.
Container(
padding: const EdgeInsets.symmetric(horizontal: 10.0),
//width: MediaQuery.of(context).size.width * 0.8,
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
children: [
new Text(
'You have pushed the button this many times: You have pushed the button this many times: You have pushed the button this many times: You have pushed the button this many times: You have pushed the button this many times: You have pushed the button this many times: You have pushed the button this many times:',
textAlign: TextAlign.left,
style: TextStyle(fontSize: 18, height: 1.0 ),
),
],
),),
因此,objective 非常简单,将一堆文本包装在一个容器中。
为此,我遵循了
我的 Container() with Text() 代码:
description == ""
? SizedBox.shrink()
: Container(
padding: const EdgeInsets.symmetric(horizontal: 10.0),
//width: MediaQuery.of(context).size.width * 0.8,
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
children: [
new Text(
description,
textAlign: TextAlign.left,
style: TextStyle(fontSize: 18),
),
],
),
)
小提示:如果对 Parent widget 有任何描述,我只是使用 SizeBox.shrink() 作为“empety widget”。
现在怎么样,太多了 space:
应该如何:
我知道 1º 图像更大,但这不是行距更大的原因
引用自here。您可以通过更改样式中的 height
属性 来调整行距。 1.0 对我来说似乎不错,但您可以尝试将其设置为 0.8、0.7.
Container(
padding: const EdgeInsets.symmetric(horizontal: 10.0),
//width: MediaQuery.of(context).size.width * 0.8,
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
children: [
new Text(
'You have pushed the button this many times: You have pushed the button this many times: You have pushed the button this many times: You have pushed the button this many times: You have pushed the button this many times: You have pushed the button this many times: You have pushed the button this many times:',
textAlign: TextAlign.left,
style: TextStyle(fontSize: 18, height: 1.0 ),
),
],
),),