I would like the colour of a text field to remain active even if it is no longer in focus.
Here you can see the problem. If i unselect the TextFormField, the color of the icon and the underline changes.
I hope you can help me. Thank you!
CodePudding user response:
Include InputDecoration border color and icons color
TextFormField(
keyboardType: TextInputType.number,
decoration: const InputDecoration(
prefix: Icon(
Icons.abc,
color: Colors.blue,
),
suffixIcon: Icon(
Icons.ac_unit,
color: Colors.blue,
),
suffixIconColor: Colors.blue,
enabledBorder: UnderlineInputBorder(
borderSide: BorderSide(color: Colors.blue),
),
focusedBorder: UnderlineInputBorder(
borderSide: BorderSide(color: Colors.blue),
),
border: UnderlineInputBorder(
borderSide: BorderSide(color: Colors.blue),
)),
style: TextStyle(
color: Colors.purple,
),
),
More about InputDecoration
CodePudding user response:
enabledBorder: UnderlineInputBorder(
borderSide: BorderSide(color: Colors.red),
),
focusedBorder: UnderlineInputBorder(
borderSide: BorderSide(color: Colors.red),
),
border: UnderlineInputBorder(
borderSide: BorderSide(color: Colors.red),
)),
Just add this in your decoration