flutter - 在 Flutter Text Widget 中调整新的行距
问题描述
所以,目标很简单,将一堆文本包装在一个容器中。为此,我遵循了这个Flutter-wrapping text,但是创建的新行在前一行之间有太多空间。
我的 Container() 和 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 小部件提供了任何描述,我只是使用 SizeBox.shrink() 作为“空小部件”。
当前情况如何,空间太大:
应该如何:
我知道 1º 图像更大,但这不是行距更大的原因
解决方案
从这里提到。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 ),
),
],
),),
推荐阅读
- hadoop - Hadoop MapReduce 没有产生所需的输出
- swift - Swift 5 UIScrollView 添加背景图片
- html - 将加载器对齐到屏幕的中心
- git - 安装 git Windows 10 时遇到问题
- ipc - C# 中的 MemoryMappedFiles 用于 Docker 容器之间的 IPC
- php - laravel 雄辩,有多个条件问题
- adobe - After Effects 上的错误代码 72 和 Creative Cloud 桌面应用程序上的 p42
- java - 为类创建比较器有技巧吗?
- python - 使用 pytorch 添加第二个输入 LSTM 时间序列
- perl - 不要停止 perl on:{,} 中的量词大于正则表达式中的 32766