dart - 如何更改 textField 下划线颜色?

我对 flutter 和 Dart 都是新手。目前,在我的一个个人项目中使用它。

在我的所有表单中,textField 的下划线都显示为蓝色。我想把它改成其他颜色。我正在使用的这段代码就像......

new TextField(
  controller: this._emailController,
  decoration: new InputDecoration(
      hintText: "Enter your email",
      labelText: "Email",
      labelStyle: new TextStyle(
          color: const Color(0xFF424242)
      )
  ),

),

无法理解如何实现这一点。

注意:我知道这里有一个类似的问题 Change TextField's Underline in Flutter .但是,那里也没有完全解决。此外,还有一个与我的链接相似的链接 Changing EditText bottom line color with appcompat v7但是,这实际上属于 Android 开发,使用的是 JAVA 而不是我用于我的 android 应用程序开发的 DART(flutter)。所以,请不要对这些链接感到困惑。

最佳答案

刚刚用过-:

decoration: InputDecoration(        
              enabledBorder: UnderlineInputBorder(      
                      borderSide: BorderSide(color: Colors.cyan),   
                      ),  
              focusedBorder: UnderlineInputBorder(
                      borderSide: BorderSide(color: Colors.cyan),
                   ),  
             ),

它对我有用:)

https://stackoverflow.com/questions/49600139/

相关文章:

json - 类型 'List' 不是类型 'List' 的子类型,其中

flutter - TextFormField 和 TextField 有什么区别?

flutter - 变量名前的下划线 "_"对 Flutter 意味着什么

asynchronous - 异步对调用者滚雪球,不能使构造函数异步

flutter - 如何在 Flutter 中将图像和文件上传到服务器?

flutter - Flutter 中 SliverList 与 ListView 的区别

dart - 如何在 flutter 中创建工具栏搜索 View

dart - Flutter - 更改 OutlineInputBorder 的边框颜色

generics - 为什么有状态的小部件在flutter中定义为两个类?

flutter - 如何将两个 ListView 放在一个列中?