显示错误消息时颤振输入字段折叠
Posted
技术标签:
【中文标题】显示错误消息时颤振输入字段折叠【英文标题】:Flutter input field collapsed when showing error message 【发布时间】:2021-11-24 03:36:48 【问题描述】:我是在手机屏幕的同一行中添加2个输入字段,输入字段在显示错误时折叠。
Row(
children: <Widget>[
Expanded(
flex: 2,
child: TextFormField(
autovalidateMode: AutovalidateMode
.onUserInteraction,
keyboardType: TextInputType.number,
controller: controller.plz,
validator: ValidationBuilder(
localeName: localeLanguage)
.digits()
.minLength(5)
.required()
.build(),
decoration: inputdecoration(),
)),
SizedBox(width: 10.0),
Expanded(
flex: 3,
child: TextFormField(
autovalidateMode: AutovalidateMode
.onUserInteraction,
validator: ValidationBuilder(
localeName: localeLanguage)
.required()
.build(),
controller: controller.place,
decoration: inputdecoration(),
))
],
),
输入装饰( errorMaxLines: 3, 帮助文本:'', 内容填充: 新 EdgeInsets.symmetric(垂直:10.0,水平:10.0), 填充颜色:AsianmastaColors.white, 填充:真实, 边框:大纲输入边框( borderSide: BorderSide(color: Colors.grey, width: 1.0)))
//显示错误后 new
【问题讨论】:
【参考方案1】:很难阅读代码。首先更新您的问题,在代码块上添加代码。您会在文本键盘上方找到 符号。
【讨论】:
【参考方案2】:给 Row crossAxisAlignment.start 它会起作用
Row(
crossAxisAlignment: CrossAxisAlignment.start
children: <Widget>[
Expanded(
flex: 2,
child: TextFormField(
autovalidateMode: AutovalidateMode
.onUserInteraction,
keyboardType: TextInputType.number,
controller: controller.plz,
validator: ValidationBuilder(
localeName: localeLanguage)
.digits()
.minLength(5)
.required()
.build(),
decoration: inputdecoration(),
)),
SizedBox(width: 10.0),
Expanded(
flex: 3,
child: TextFormField(
autovalidateMode: AutovalidateMode
.onUserInteraction,
validator: ValidationBuilder(
localeName: localeLanguage)
.required()
.build(),
controller: controller.place,
decoration: inputdecoration(),
))
],
),
【讨论】:
感谢兄弟的作品非常感谢 欢迎的兄弟,如果对你有帮助,请接受以上是关于显示错误消息时颤振输入字段折叠的主要内容,如果未能解决你的问题,请参考以下文章