flutter - 带有 2 个子图标和(扩展)文本(长)的行,它们之间有空格
问题描述
我有一排有 2 个孩子的一排图标(位置)和文本
Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Icon(
Icons.location_on,
color: Colors.white,
),
Expanded(
child: Text(
"Kyla Olsen Ap #651-8679 Sodales Av.Tamuning PA 10855 (492) 709-6392", // a long address
textAlign: TextAlign.center,
style: TextStyle(
color: Colors.white,
fontSize: 16,
fontWeight: FontWeight.bold),
),
),
],
),
这在图标和文本之间有一些空间。如果我对齐文本开始,则它没有空格,但第二行也从开始,我希望文本居中
我希望位置 iocn 和文本没有任何空间,例如电话号码或电子邮件地址。
解决方案
快速修复,将您的扩展小部件更改为将文本包装为灵活小部件,如下所示:
Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Icon(
Icons.location_on,
color: Colors.white,
),
Flexible(
child: Text(
"Kyla Olsen Ap #651-8679 Sodales Av.Tamuning PA 10855 (492) 709-6392", // a long address
textAlign: TextAlign.center,
style: TextStyle(
color: Colors.white,
fontSize: 16,
fontWeight: FontWeight.bold),
),
),
],
),
推荐阅读
- c - 如何获取线并将它们存储到数组中
- android - 找不到类'android.view.autofill.AutofillManager
- android - 使用 Firebase 作为后端的支付集成
- python - Python regex 查找仅包含空格的字符串
- ruby-on-rails - 没有路线匹配 [GET] "/static_pages/home"
- xml - 如何使用 Saxon 在 VSTS (Azure DevOps) 中对 XML 文件执行 XSLT?
- eclipse - Eclipse Oxygen - e4xmi 编辑器不再可用
- javascript - 从 DevEx UploadController 代码调用 JavaScript 后无响应
- java - 是否有低级 Swift 类在 AWS S3 中上传文件
- html - 具有多个选取框标签的动画