简体   繁体   中英

Flutter: Change the selected text color

I change the selectionColor to white, but my text is white. How can I turn my selected text color to another like background text or the color on where the text is.

Without selection:

在此处输入图像描述

With selection:

在此处输入图像描述

I would like the color to be where the text is but I don't know if it's possible :/.

thanks!

Edit: here a simple code-snippet for text selection theme

textSelectionTheme: TextSelectionThemeData(
    cursorColor: Colors.white,
    selectionColor: Colors.white,
),

I can't put more code-snippet because I want to text selected everywhere I can.

This isn't possible as of now. You can follow this issue for more details.. Though if you wish to change color of selection you can do the following

https://github.com/flutter/flutter/issues/99231

ThemeData(
      textSelectionTheme: const TextSelectionThemeData(
        selectionColor: Colors.blue,
      )
child: SelectableText()
),

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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