Flutter SearchDelegate:如何删除文本下方的文本下划线和蓝线(颜色)?

时间:2021-07-27 13:47:58

标签: flutter dart

关于 Flutter 搜索委托:

$out

How to remove text underline and blue line (color) below text?

我不想用新的文本字段等更改完整的小部件,因为 SearchDelegate 已经很好或者是一个完成的小部件。

enter image description here

我的代码在 Flutter 的 SearchDelegate 小部件中:

to set transparent or to change color?

2 个答案:

答案 0 :(得分:1)

您可以为您的 TextField 添加装饰:

                decoration: InputDecoration(
                    focusedBorder: UnderlineInputBorder(
                        borderSide:
                            BorderSide(color: Color(0xFFE6C58C))), // your color

答案 1 :(得分:0)

这个白线的解决方案怎么样:"decorationThickness: 0.0000001,"

enter image description here

  @override
  ThemeData appBarTheme(BuildContext context) {
    return ThemeData(
      dividerTheme: DividerThemeData(
        color: Colors.white,
      ),
      primaryIconTheme: IconThemeData(color: Colors.white),

      inputDecorationTheme: InputDecorationTheme(
        focusedBorder: UnderlineInputBorder(borderSide: BorderSide(color: Colors.red)),
      ),
      accentColor: Colors.white, // for the green line
      scaffoldBackgroundColor: Colors.white, // for the body color
      brightness: Brightness.dark, // to get white statusbar icons
      primaryColor: glovar.getColor(farbnr), // set background color of SearchBar
      textSelectionTheme: TextSelectionThemeData(
        cursorColor: Colors.white,
      ), // cursor color
      textTheme: TextTheme(
        headline6: TextStyle(
          //decoration:TextDecoration.none,
          decorationThickness: 0.0000001,
          //decorationColor: Colors.transparent, // color of text underline
        ),
      ),
    );
  }



相关问题