如何解决当标题在第二行中断时,正文不会溢出剪辑正确
如果我有一个很长的标题,根据字符串的长度分成两行,则容器小部件内的正文文本剪切不正确
Expanded(
child: Container(
height: MediaQuery.of(context).size.height / 7.5,padding: EdgeInsets.only(right: 8),child: Column(
crossAxisAlignment: CrossAxisAlignment.start,mainAxisAlignment: MainAxisAlignment.start,children: [
Text(
'HERE SOME LONG HEADLINE,WITH 1 or 2 Lines'
maxLines: 2,overflow: TextOverflow.ellipsis,),SizedBox(
height: 3.0,Expanded(
child: Text(
'here some long body text over more lines,which is cut wrong when the headline is two lines',softWrap: true,maxLines: 5,textAlign: TextAlign.left,],
解决方法
我相信一些包裹您的 Text 小部件的小部件会限制它们的空间量,因此会进行剪裁。如果没有完整的小部件树,就无法确定是哪个。
您包含的 Container
小部件具有指定的高度。如果您删除它,您的文本小部件是否仍会剪辑?
Expanded(
child: Container(
height: MediaQuery.of(context).size.height / 7.5,// ← try removing this
padding: EdgeInsets.only(right: 8),
另外,也许这个包可能很有趣:AutoSizeText。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。