简体   繁体   English

无法在 TextFormField 中隐藏文本下划线

[英]Unable to hide text underline in TextFormField

I am trying to hide the underline of the entered text when using the TextFormField.我试图在使用 TextFormField 时隐藏输入文本的下划线。 I have read all of the suggestions, but none of them eliminate the underline!我已经阅读了所有的建议,但没有一个去掉下划线!

child: TextFormField(
  autocorrect: false, 
  inputFormatters: [ new FilteringTextInputFormatter.allow(RegExp("[a-zA-Z0-9]"))],
  textAlign: TextAlign.center,
  decoration: InputDecoration(
     hintText: "i.e. noahsclearnews",
     hintStyle: TextStyle( color: Colors.grey, fontSize: ScreenUtil().setSp(40) ),
     border: InputBorder.none,
     focusedBorder: InputBorder.none,
     enabledBorder: InputBorder.none,
     errorBorder: InputBorder.none,
     disabledBorder: InputBorder.none,
  )
)

Am I missing something?我错过了什么吗?

示例截图

That's a native underline when you are typing unknown words in your keyboard independently of the FormField, actually isn't a thing in your app but in the android keyboard.当您在键盘上独立于 FormField 输入未知单词时,这是一个原生下划线,实际上不是在您的应用程序中而是在 android 键盘中。

But you can ignore those corrections setting the keyboardType as a TextInputType.visiblePassword.但是您可以忽略将键盘类型设置为 TextInputType.visiblePassword 的那些更正。

TextFormField(
    autocorrect: false,
    keyboardType: TextInputType.visiblePassword, // Disabling word correction
    decoration: InputDecoration(
      hintText: "i.e. noahsclearnews",
    )
)

也许一个空格会起作用,在写作时给一个空格,你的下划线将被删除

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

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