简体   繁体   English

如何删除 TextFormField 中错误文本上方的边距?

[英]How do I remove margin above error text in TextFormField?

Could anyone help me?有人可以帮助我吗? I am struggling to remove margin in TextFormField.我正在努力删除 TextFormField 中的边距。

单击此处查看屏幕截图

Below is the code.下面是代码。

class TextFieldItemTemp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return TextFormField(
      decoration: InputDecoration(
        isDense: true,
        errorText: 'This field is required',
        contentPadding: EdgeInsets.zero,
        filled: true,
        fillColor: Colors.white,
        errorBorder: UnderlineInputBorder(
          borderSide: BorderSide(color: Colors.red, width: 3.0),
        ),
        border: UnderlineInputBorder(
          borderSide: BorderSide(color: Colors.red, width: 3.0),
        ),
      ),
    );
  }
}

您可以将errorStyle: TextStyle(height: 0.7),InputDecoration

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM