有没有办法减少 TextFormField 小部件中实际输入和错误文本之间的间距?就目前而言,表单上显示的错误文本几乎使表单的大小增加了一倍,我希望无论是否有错误文本都保持表单区域的大小相同。从下面的图片中,您可以看到它进行了多少更改,并且输入和错误消息之间有相当多的空间可以使用reduce。
这是其中一个表单域的示例
Padding(
padding: EdgeInsets.only(
top: 5.0, bottom: 5.0, left: 25.0, right: 25.0),
child: TextFormField(
focusNode: myFocusNodeName,
controller: signupNameController,
keyboardType: TextInputType.text,
textCapitalization: TextCapitalization.words,
style: TextStyle(
fontFamily: "WorkSansSemiBold",
fontSize: 16.0,
color: Colors.black),
decoration: InputDecoration(
border: InputBorder.none,
icon: Icon(
FontAwesomeIcons.user,
color: Colors.black,
),
errorText: signupLastNameErrorText,
hintText: "Last Name",
hintStyle: TextStyle(
fontFamily: "WorkSansSemiBold", fontSize: 16.0),
),
validator: (value) =>
value.isEmpty ? 'Last Name can\'t be empty' : null,
onSaved: (value) => _lastname = value,
),
),
Run Code Online (Sandbox Code Playgroud)