Flutter:列内文本的文本溢出不起作用
Flutter: Text overflow for a Text inside a Column not working
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(showing.title, style: browseTitle, overflow: TextOverflow.ellipsis,),
Text(showing.dates, style: browseInfo),
SizedBox(
height: 20,
),
Text('Posted by: ' + showing.email, style: browseInfo),
],
),
此代码生成以下内容:
但问题是我放在文本中的textoverflow似乎没有应用,文本一直溢出。我该如何解决这个问题,使文本不会溢出并变成省略号?
签出这项工作完美
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SizedBox(
width: MediaQuery.of(context).size.width,
child: Text(
showing.title,
style: browseTitle,
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
),
Text(showing.dates, style: browseInfo),
SizedBox(height: 20),
Text('Posted by: ' + showing.email, style: browseInfo),
],
),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(showing.title, style: browseTitle, overflow: TextOverflow.ellipsis,),
Text(showing.dates, style: browseInfo),
SizedBox(
height: 20,
),
Text('Posted by: ' + showing.email, style: browseInfo),
],
),
此代码生成以下内容:
但问题是我放在文本中的textoverflow似乎没有应用,文本一直溢出。我该如何解决这个问题,使文本不会溢出并变成省略号?
签出这项工作完美
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SizedBox(
width: MediaQuery.of(context).size.width,
child: Text(
showing.title,
style: browseTitle,
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
),
Text(showing.dates, style: browseInfo),
SizedBox(height: 20),
Text('Posted by: ' + showing.email, style: browseInfo),
],
),