Mar*_*ira 3 text text-widget flutter flutter-layout
所以,目标很简单,将一堆文本包装在一个容器中。\n为此,我遵循了Flutter 包装文本,但是创建的新行与前一行之间的空间太大。
\n我的 Container() 和 Text() 代码:
\n description == ""\n ? SizedBox.shrink()\n : Container(\n padding: const EdgeInsets.symmetric(horizontal: 10.0),\n //width: MediaQuery.of(context).size.width * 0.8,\n child: Column(\n mainAxisAlignment: MainAxisAlignment.start,\n children: [\n new Text(\n description,\n textAlign: TextAlign.left,\n style: TextStyle(fontSize: 18),\n ),\n ],\n ),\n )\nRun Code Online (Sandbox Code Playgroud)\n小提示:如果对父小部件有任何描述,我只是使用 SizeBox.shrink() 作为“空小部件”。
\n当前情况如何,空间太大:
\n\n应该如何:
\n\n我知道 1\xc2\xba 图像更大,但这不是行间距更大的原因
\n正如从这里提到的。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 ),
),
],
),),
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
5293 次 |
| 最近记录: |