[英]TextFormField, change icon and text colors
I want to change the labelText
and the icon
colors of my TextFormField
when it's highlighted.我想在突出显示时更改我的
TextFormField
的labelText
和icon
颜色。 This is my code:这是我的代码:
TextFormField(
enabled: enable,
controller: textEditingController,
obscureText: obscureText,
validator: validate,
keyboardType: keyboardType,
decoration: InputDecoration(
focusedBorder: UnderlineInputBorder(
borderSide:
BorderSide(color: Colors.yellow),
),
border: UnderlineInputBorder(),
enabledBorder: _checkBorder(),
labelText: labelText,
prefixIcon: Padding(
padding: EdgeInsets.all(distanceIconFromEdges),
child: icon,
),
hintText: hintText,
))
Wrap your TextFormField
in Theme
and change accentColor
将您的
TextFormField
包裹在Theme
并更改accentColor
Theme(
data: Theme.of(context).copyWith(accentColor: Colors.red),
child: TextFormField(...),
)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.