jwasher
jwasher

Reputation: 429

How do I change text selection handle color for iOS in Flutter?

I'm using the following theme code:

ThemeData.dark().copyWith(
  accentColor: Colors.green,
  textSelectionColor: Colors.green.withOpacity(0.5),
  textSelectionHandleColor: Colors.green,
);

And that works for android, but for iOS it is not changing the color of the text selection handle color to green (it is still the default blue). How can I change that color for iOS?

enter image description here

Upvotes: 5

Views: 3572

Answers (2)

jwasher
jwasher

Reputation: 429

I was able to change the color using Themes. You need to set cupertinoOverrideTheme like this

CupertinoThemeData(
  primaryColor: Colors.green,
)

Upvotes: 13

magicleon94
magicleon94

Reputation: 5192

it seems that this is a known issue.

It would appear that TextField on iOS ignores the MaterialTheme values for this.

Another piece of information which suggests that this is not possible in iOS is looking at the CupertinoThemeData documentation, which clearly does not consider a textSelectionHandleColor.

Upvotes: 1

Related Questions