【发布时间】:2020-10-27 09:25:27
【问题描述】:
如何修复不同屏幕尺寸的错误 如果屏幕有空间,我希望应该安装中间文本 如果屏幕没有空间,它应该 TextOverflow.ellipsis
这是我的代码
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Container(
margin: EdgeInsets.only(left: 10),
child: Icon(
MdiIcons.alertCircle,
color: Colors.white,
size: 16,
),
),
Container(
child: Text(
"Your Service Request Has Been Approved",
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontSize: 13,
color: Colors.white,
fontWeight: FontWeight.w300),
),
),
Spacer(),
Container(
margin: EdgeInsets.only(right: 10),
child: Icon(
MdiIcons.close,
color: Colors.white,
size: 16,
),
),
],
),
【问题讨论】:
-
用 Expanded 包裹内部容器并移除您给定的高度。展开的小部件将使容器占据可用的全部空间。
标签: android ios flutter flutter-layout