1

I have a TextField which looks like this at the moment:

enter image description here

As you can see the selected color is purple. But how can I change that color for that specific TextField ? I do not want to change the AppThemeData. I couldn't find anything on this ... Happy for every help!

Chris
  • 1,828
  • 6
  • 40
  • 108

1 Answers1

0

you can try and wrap it with Theme and use SplashColor to be something like this :

Theme(
  data: ThemeData(textSelectionColor: Colors.green),
  child: TextField(
    autofocus: false,
    decoration: InputDecoration(
      filled: true,
      fillColor: Colors.white,
      hintText: 'Mail',
     
    ),
  ),
);

or do this in main :

theme: ThemeData(
          accentColor: Color(0xffBA379B).withOpacity(.6),
          primaryColor: Color(0xffBA379B),
          textSelectionTheme: TextSelectionThemeData(
            selectionColor: Color(0xffBA379B).withOpacity(.5),
            cursorColor: Color(0xffBA379B).withOpacity(.6),
            selectionHandleColor: Color(0xffBA379B).withOpacity(1),
          ),
    ```
Fahmi Sawalha
  • 682
  • 6
  • 19