简体   繁体   English

如何更改 Flutter 中 iOS 的文本选择句柄颜色?

[英]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).这适用于 android,但对于 iOS,它不会将文本选择句柄颜色的颜色更改为绿色(它仍然是默认的蓝色)。 How can I change that color for iOS?如何更改 iOS 的颜色?

在此处输入图像描述

I was able to change the color using Themes.我能够使用主题更改颜色。 You need to set cupertinoOverrideTheme like this你需要像这样设置 cupertinoOverrideTheme

CupertinoThemeData(
  primaryColor: Colors.green,
)

it seems that this is a known issue .看来这是一个已知问题

It would appear that TextField on iOS ignores the MaterialTheme values for this. iOS 上的TextField似乎为此忽略了MaterialTheme值。

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 .另一条信息表明这在 iOS 中是不可能的,正在查看CupertinoThemeData 文档,该文档显然不考虑textSelectionHandleColor

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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