简体   繁体   English

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

[英]Flutter SearchDelegate: How to remove text underline and blue line (color) below text?

Regarding Flutter Search Delegate:关于 Flutter 搜索委托:

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

Or要么

to set transparent or to change color?

I don't want to change the complete Widget with new Textfields etc. because the SearchDelegate is already good or is a finished widget.我不想用新的文本字段等更改完整的小部件,因为 SearchDelegate 已经很好或者是一个完成的小部件。

在此处输入图片说明

My Code is within the SearchDelegate Widget of Flutter:我的代码在 Flutter 的 SearchDelegate 小部件中:

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

      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

    );
  }

You can add a decoration to your TextField :您可以为TextField添加装饰:

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

what about this solution for the white line: "decorationThickness: 0.0000001,"白线的这个解决方案怎么样:“decorationThickness:0.0000001,”

在此处输入图片说明

  @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
        ),
      ),
    );
  }



声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM