如何解决在 Flutter Text Widget 中调整新行间距
所以,目标很简单,将一堆文本包装在一个容器中。 为此,我遵循了此 Flutter- wrapping text ,但创建的新行前一行之间有太多空间。
我的带有 Text() 的 Container() 代码:
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),),],)
小说明:如果对父小部件有任何描述,我只使用 SizeBox.shrink() 作为“空小部件”。
目前情况如何,空间太大:
应该如何:
我知道 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 ),),],
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。