繁体   English   中英

如何更改Flutter中Textfield的图标cursor?

[英]How to change icon cursor of Textfield in Flutter?

如何更改 Flutter 中Textfield的图标Flutter

更改图标光标

(此图片是Android上的屏幕截图)

我想更改 cursor 的图标或更改颜色。

textSelectionHandleColor已弃用,不应使用。 请改用TextSelectionThemeData.selectionHandleColor

Widget build(BuildContext context) {
    return MaterialApp(
      theme: ThemeData(
          ...
          textSelectionTheme: TextSelectionThemeData(selectionHandleColor: Colors.black),
          ...
    );
}
TextField(
  cursorColor: Colors.pink,
)

您的意思是处理程序选择器,而不是cursor ,对吗?

你可以使用textSelectionHandleColor在应用程序的根目录中使用 textSelectionHandleColor 应用该更改。

我认为单个TextField不可能

Widget build(BuildContext context) {
    return MaterialApp(
      theme: ThemeData(
          textSelectionColor: Colors.yellow,
          textSelectionHandleColor: Colors.red)
    );
}
ThemeData(
  textSelectionTheme: TextSelectionThemeData(
    cursorColor: pink,
    selectionHandleColor: pink,
    selectionColor: pink
  )
);

暂无
暂无

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

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