flutter - 颤动:我想要中心的文字
问题描述
我有一排。在这一行中,我在图标中有两个小部件,一个是文本,在这一行中,我的图标固定在左侧,我希望我的文本在这一行的中心,我的图标将固定
这是我的代码。
child: Column(
children: [
Container(
color: mPrimaryColor,
height: MediaQuery.of(context).size.height / 23,
width: MediaQuery.of(context).size.width,
child: Row(
children: [
SizedBox(
width: 15,
),
InkWell(
onTap: () {
Navigator.pop(context);
},
child: Container(
height: MediaQuery.of(context).size.height / 23,
width: 30,
child: Icon(
Icons.arrow_back_ios_rounded,
size: 20,
color: whitetext,
),
),
),
Spacer(),
Text(
// "${widget.headerName}".tr(),
"ADMINISTRATIVE CONTACT",
style: headingWhite(),
textAlign: TextAlign.center,
),
Spacer(),
],
),
),],),
解决方案
试试这个:
children: [
SizedBox(
width: 15,
),
InkWell(
onTap: () {
Navigator.pop(context);
},
child: Container(
height: MediaQuery.of(context).size.height / 23,
width: 30,
child: Icon(
Icons.arrow_back_ios_rounded,
size: 20,
color: whitetext,
),
),
),
Expanded(child: Center(child: Text(
// "${widget.headerName}".tr(),
"ADMINISTRATIVE CONTACT",
style: headingWhite(),
textAlign: TextAlign.center,
),),),
SizedBox(
width: 45,
),
],
推荐阅读
- python-3.x - 使用openCV过滤掉某种颜色的所有东西
- python - 从“systemd”服务脚本中找不到 Python 模块
- spring-integration - 如何为 spring 集成 dsl 流启用日志记录
- python - 自定义腐蚀结果与 OpenCV 腐蚀不匹配
- javascript - Posting to MongoDB, What am I doing wrong?
- ios - UITableViewCell 中的 UITextView 键盘问题
- c++ - 在 CMakeLists.txt 中包含目录的更好方法
- django - Django project-apps:你对实现一个真正的数据库方案有什么看法?
- python - 从 Python 中的较大/多行字符串中计算包含 *both* 的两个字符串的行数
- c++ - 使用函数打开文件,然后让其他函数使用该文件?