Reputation: 6157
I want to change the labelText
and the icon
colors of my TextFormField
when it's highlighted. 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,
))
Upvotes: 1
Views: 136
Reputation: 267774
Wrap your TextFormField
in Theme
and change accentColor
Theme(
data: Theme.of(context).copyWith(accentColor: Colors.red),
child: TextFormField(...),
)
Upvotes: 1