简体   繁体   English

如何更改 Flutter 中的文本指示器颜色?

[英]How to change text indicator color in Flutter?

在此处输入图像描述

I want to change the part that's Blue in color我想改变蓝色的部分

Note selectionColor: Colors.grey Only works for the highlighted part and not the cursor.注意selectionColor: Colors.grey仅适用于高亮部分,不适用于 cursor。

None of the below work以下均无效

                textSelectionTheme: TextSelectionThemeData(
                  selectionColor: Colors.grey,
                  cursorColor: Colors.grey,
                  selectionHandleColor: Colors.grey,
                ),
                selectedRowColor: Colors.grey,
                primaryColor: Colors.grey,
                primaryColorDark: Colors.grey,
                primaryColorLight: Colors.grey,
                splashColor:Colors.grey,
                shadowColor: Colors.grey,
                accentColor: Colors.grey,
                focusColor: Colors.grey,
                hoverColor: Colors.grey,
                indicatorColor: Colors.grey,
                highlightColor: Colors.grey,
              ),

cursorColor: Main.sThemeBackgroundColor only works on the cursor when the text isn't selected cursorColor: Main.sThemeBackgroundColor仅在未选择文本时适用于 cursor

I have been breaking my head over this for the past 3 hours and there seems to be nothing on the inte.net.在过去的 3 个小时里,我一直在为这个问题苦思冥想,而互联网上似乎什么也没有。 Any idea how to change this?知道如何改变这个吗?

If you want to change the color of cursor indicator than use this attribute in your theme如果你想改变 cursor 指示器的颜色而不是在你的主题中使用这个属性

ThemeData(
        textSelectionHandleColor: Colors.green
      )

在此处输入图像描述

If you want to change the cursor color simple use this attribute如果你想改变 cursor 颜色简单使用这个属性

ThemeData(
        cursorColor: Colors.black
      )

在此处输入图像描述

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

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