android - 如何显示适合屏幕的 Row() 儿童尺寸?
问题描述
如何修复不同屏幕尺寸的错误我希望如果屏幕有空间,则应该安装中间文本如果屏幕没有空间,它应该 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
小部件
Expanded(
child: Text(
"Your Service Request Has Been Approved",
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontSize: 13,
color: Colors.white,
fontWeight: FontWeight.w300),
),
)
)
推荐阅读
- scipy-optimize - 在 scipy.root 中使用 LinearOperator 作为雅可比行列式
- python - 为什么我们必须在使用 boto3 客户端而不是在资源中指定属性类型?
- javascript - 了解嵌套条件(三元)运算符
- cmd - 以管理员身份执行 .BAt 文件
- excel - 达到特定值后如何在excel中重新开始计数
- javascript - 使用 PHP 或 JS 将存储的服务器时间转换为本地时间
- reactjs - 如何将类应用于不支持 className 的外部组件?
- plsql - 将 plsql 嵌套表类型与另一个常规 sql 表连接
- c++ - 从进程转储中读取内存(自动分析)
- reactjs - 将 Header 或 Title 渲染到 ant design - Timepicker 组件