flutter - 如何将 HelperText 居中对齐?
问题描述
TextFormField 有一个 hintText 和一个 HelperText ,但我似乎可以找到一种方法将 helperText 居中对齐,这是我的代码:
child: Container(
child: TextFormField(
textAlign: TextAlign.center,
style: TextStyle(fontSize: 21),
decoration: InputDecoration(
hintText: "hint text",
focusedBorder: UnderlineInputBorder(
borderSide: BorderSide(color: primaryColor)),
helperText: "THIS IS THE HELPER TEXT TO BE ALIGNED ",
helperStyle:
TextStyle(color: oASDC, fontSize: 15),
),
onChanged: (value) {
setState(() {.......});
},
),
),
有没有办法将帮助文本居中对齐?
解决方案
据我了解,的位置helperText
就像是的位置errorText
,
根据这些问题,似乎没有解决办法。
但是,如果您只需要 text ,您可以轻松地在Text
下面添加小部件TextFormField
像这样:
Container(
child: Column(
children: [
TextFormField(
textAlign: TextAlign.center,
style: TextStyle(fontSize: 21),
decoration: InputDecoration(
hintText: "hint text",
focusedBorder: UnderlineInputBorder(borderSide: BorderSide(color: primaryColor),),
// helperText: "THIS IS THE HELPER TEXT TO BE ALIGNED ",
helperStyle: TextStyle(color: oASDC, fontSize: 15),
),
onChanged: (value) {
// setState(() {.......});
},
),
Text(
'THIS IS THE HELPER TEXT TO BE ALIGNED',
textAlign: TextAlign.center,
),
],
),
),
推荐阅读
- javascript - Angular:使用指令禁用材质按钮不起作用
- python - 如何将pdf文件添加到django响应
- rest - RESTful api 应该如何处理元组查询字符串参数?
- javascript - 如何使用地图()?
- flutter - 调用 Geocoder.local.findAddressesFromCoordinates 时出现 PlatformException
- laravel - 我想发出验证错误消息
- visual-studio-code - 如何在 vs 代码中使用外部终端?
- excel - 如何获取特定单元格的值而不是整个范围
- javascript - 在 Typescript 中为 node-json2html 创建/修复声明文件
- java - 春季批处理中的OptimisticLockingFailureException