我有一个 TextField
目前看起来像这样:
如您所见,所选颜色为紫色。但是我怎样才能改变那个特定 TextField
的颜色?我不想想要更改AppThemeData
。我找不到任何关于此的信息......很高兴为每一个帮助!
答案 0 :(得分:0)
你可以尝试用 Theme
包裹它,然后使用 SplashColor
像这样:
Theme(
data: ThemeData(textSelectionColor: Colors.green),
child: TextField(
autofocus: false,
decoration: InputDecoration(
filled: true,
fillColor: Colors.white,
hintText: 'Mail',
),
),
);
或在 main 中执行此操作:
theme: ThemeData(
accentColor: Color(0xffBA379B).withOpacity(.6),
primaryColor: Color(0xffBA379B),
textSelectionTheme: TextSelectionThemeData(
selectionColor: Color(0xffBA379B).withOpacity(.5),
cursorColor: Color(0xffBA379B).withOpacity(.6),
selectionHandleColor: Color(0xffBA379B).withOpacity(1),
),
```