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

Unable to hide text underline in TextFormField

我试图在使用 TextFormField 时隐藏输入文本的下划线。 我已经阅读了所有的建议,但是其中 none 个删除了下划线!

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,
  )
)

我是不是漏掉了什么?

也许 space 会起作用,在写作时输入 space,您的下划线将被删除

当您独立于 FormField 在键盘中输入未知单词时,这是本机下划线,实际上不是您的应用程序中的东西,而是 android 键盘中的东西。

但是您可以忽略将 keyboardType 设置为 TextInputType.visiblePassword 的那些更正。

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