我已经尽了一切努力试图改变文本字段的边框 colored颜色 ,但它似乎被忽略了.

我已经try 过侧边框(甚至宽度也被忽略),hintStyle,只将特定的主题应用到这个小部件,它们似乎都被忽略了.

child: new Theme(
      data: ThemeData(
      primaryColor: Colors.white,
      accentColor: Colors.white,
      hintColor: Colors.white //This is Ignored,
      inputDecorationTheme: InputDecorationTheme(
               border: OutlineInputBorder(
               borderSide: BorderSide(color: Colors.white) //This is Ignored
                    ),
                  ),
              ),
      child: new TextField(
             style: TextStyle(color: Colors.white, decorationColor: Colors.white),
             cursorColor: Colors.white,
             decoration: InputDecoration(
             border: new OutlineInputBorder(
             //borderRadius: const BorderRadius.all(Radius.circular(30.0)),
             borderSide: BorderSide(color: Colors.white, width: 0.0) //This is Ignored,
                      ),
                      hintText: "Search people",
                    ),
                  ),
                  //new Divider(color: Colors.white, height: 20),

          )

我想把那条发际线改成黑色边框,改一下 colored颜色 和宽度.

Image of what it currently is

推荐答案

使用enabledBorderfocusedBorder(当文本字段聚焦时)

InputDecoration(
              enabledBorder: OutlineInputBorder(
                  borderSide: BorderSide(
                      color: Colors.red, width: 5.0),
                  ),
              focusedBorder: OutlineInputBorder(
                  borderSide: BorderSide(
                      color: Colors.blue, width: 3.0),
                  ),
              hintText: "Search people",
            ),

Dart相关问答推荐

Dart 中的const关键字放置有什么不同?

如何在Flutter中制作视频缩略图?

Asset图像作为Card背景,Flutter 中顶部有文本

结合freezed和hive

如何使用文本小部件设置多行文本?

如何在 Flutter Web 中使用 Skia/CanvasKit?

FInal和top-level lazy初始化

属性 'docs' 不能无条件访问,因为接收到的可能是 'null' Flutter

如何在Flatter dart中使用相同的元素初始化列表?

未定义命名参数child.在 Center() 构造函数中

Expansion Panel底部溢出

Dart - 如何在每次测试之后或之前运行函数?

Dart - 将自纪元以来的毫秒数(UNIX 时间戳)转换为人类可读的时间

dart中是否有类似struct struct 的东西?

导出两个具有相同类名的库

如何在dart中生成随机字符串?

Dart 中的 List.shuffle()?

getter 和 setter 如何改变 Dart 中的属性?

如何在 Dart 中将 double 转换为 int?

Dart 中的const和final关键字有什么区别?