Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/flutter/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Flutter 如何设置输入装饰的OutlineInputBorder的样式?_Flutter - Fatal编程技术网

Flutter 如何设置输入装饰的OutlineInputBorder的样式?

Flutter 如何设置输入装饰的OutlineInputBorder的样式?,flutter,Flutter,我正在尝试设置TextFormField的边框样式。我将它与大纲输入框一起使用。默认情况下,它采用近乎黑色的颜色,聚焦时采用原色。我试图更改边框的颜色,但无效 我还尝试了在forUnderlineInputBorder中提到的解决方法,但没有任何变化 new TextFormField( decoration: new InputDecoration( labelText: "Email", contentPadding: new EdgeInsets.a

我正在尝试设置
TextFormField
的边框样式。我将它与
大纲输入框一起使用。默认情况下,它采用近乎黑色的颜色,聚焦时采用原色。我试图更改
边框的颜色,但无效

我还尝试了在for
UnderlineInputBorder
中提到的解决方法,但没有任何变化

new TextFormField(
    decoration: new InputDecoration(
        labelText: "Email",
        contentPadding: new EdgeInsets.all(12.0),
        filled: true,
        border: new OutlineInputBorder(
            borderSide: new BorderSide(width: 2.0, color: Colors.white),
        )
    ),
),

在深入挖掘之后,似乎只能通过主题数据进行配置。所以我只是添加了一个主题小部件

body: Theme(data: Theme.of(context).copyWith(
          primaryColor: Colors.white,
          accentColor: Colors.amber
      ), child: new TextFormField(
          decoration: new InputDecoration(
          labelText: "Email",
          contentPadding: new EdgeInsets.all(12.0),
      ),
),
输入(u decorator.dart#1440-1450
您只想更改边框颜色?要设置哪种颜色?边框和标签颜色。
Color _getActiveColor(ThemeData themeData) {
    if (isFocused) {
      switch (themeData.brightness) {
        case Brightness.dark:
          return themeData.accentColor;
        case Brightness.light:
          return themeData.primaryColor;
      }
    }
    return themeData.hintColor;
  }