【发布时间】:2020-06-27 13:14:47
【问题描述】:
我正在尝试省略 Flutter 应用程序中的文本,但我无法设置它。
我将视图设计如下
Positioned(
bottom: 20,
left: 10,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text(
snapshot.data.results[index].title,
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.start,
style: TextStyle(
fontSize: 20.0,
fontWeight: FontWeight.w600,
color: Colors.white,
),
),
Text(
snapshot.data.results[index].release_date,
style: TextStyle(
fontSize: 18.0,
fontWeight: FontWeight.w400,
color: Colors.white,
letterSpacing: 1.2),
),
],
))
【问题讨论】:
-
我有相同的小部件,但接受的答案不起作用。你是怎么做到的?
-
如果灵活不起作用并设置文本溢出,请使用扩展小部件。如果你想每个字母都用多行。我建议
-
我最终使用了带有 mainAxisAlignment.end 的 Column 而不是 Positioned。感谢回复
标签: flutter dart flutter-layout