【问题标题】:Flutter SearchDelegate: How to remove text underline and blue line (color) below text?Flutter SearchDelegate:如何去除文本下方的文本下划线和蓝线(颜色)?
【发布时间】:2021-10-03 08:26:19
【问题描述】:

关于 Flutter 搜索代理:

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

或者

to set transparent or to change color?

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

我的代码在 Flutter 的 SearchDelegate Widget 中:

  @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

    );
  }

【问题讨论】:

标签: flutter dart


【解决方案1】:

你可以给你的TextField添加一个装饰:

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

【讨论】:

  • 帮助了蓝线。非常感谢您。对于下面的白线一种解决方法
【解决方案2】:

白线的这个解决方案怎么样:“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
        ),
      ),
    );
  }



【讨论】:

    猜你喜欢
    • 2022-11-30
    • 1970-01-01
    • 2020-07-17
    • 2021-09-06
    • 2019-02-13
    • 2023-01-22
    • 2021-02-09
    • 1970-01-01
    • 2018-10-17
    相关资源
    最近更新 更多