[英]Flutter change Textfield selected background color
你可以嘗試用Theme
包裝它,並使用SplashColor
是這樣的:
Theme(
data: ThemeData(textSelectionColor: Colors.green),
child: TextField(
autofocus: false,
decoration: InputDecoration(
filled: true,
fillColor: Colors.white,
hintText: 'Mail',
),
),
);
或主要執行此操作:
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),
),
```
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.