如何更改在 Text 或 TextFormField 或 .. 在 Flutter 中选择文本时出现的气泡颜色?
这是相同的问题,但针对本机代码。
您可以使用textSelectionHandleColor属性。
Theme(
data: Theme.of(context).copyWith(
textSelectionHandleColor: Colors.green,
),
child: TextField(),
);
Run Code Online (Sandbox Code Playgroud)
根据this flutter documentation,textSelectionHandleColor已弃用。您应该像下面的代码一样selectionHandleColor在TextSelectionThemeData小部件内使用。
theme: ThemeData(
textSelectionTheme: TextSelectionThemeData(
cursorColor: Colors.red,
selectionColor: Colors.green,
selectionHandleColor: Colors.black,
),
)
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2102 次 |
| 最近记录: |