Change highlight colour for textfield in flutter

201

Solution 1. You can change the textSelectionColor in the theme of your app:

theme: ThemeData.dark().copyWith(
  textSelectionColor: Colors.black
),

Solution 2. You can change the textSelectionColor only for a specific TextField by wrapping it with a Theme widget:

Theme(
  data: ThemeData(
    textSelectionColor: Colors.black,
  ),
  child: TextField(
  ),
),
Share:
201
Bennett567
Author by

Bennett567

I am a student mainly interested in flutter.

Updated on December 18, 2022

Comments

  • Bennett567
    Bennett567 over 1 year

    Is there any way to change the colour of a Textfield's highlight in Flutter? So this is without highlighting

    So when I highlight it does not look like this: highlighted

    Thank you!