How to change backgroud color when in focus, not in focus or the field is empty in flutter

75 views Asked by At

I want to make a text form field so that the color of the field changes when I press the text form field, Changes color when text form field is empty and changes color when the content is there. Same as to the border of the text form field. how can I do this? Kindly refer me to an example if possible.

1

There are 1 answers

0
Zaza.codes On BEST ANSWER

You can use the onTap parameter of the TextFormField by calling setState to update the colors, before this assign the Form Field color and border configuration to variables and use set State to update the color and configuration once the TextFormField is tapped