Home > Back-end >  Flutter: Change the selected text color
Flutter: Change the selected text color

Time:07-24

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:

enter image description here

With selection:

enter image description here

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.

CodePudding user response:

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()
),
  • Related