Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

how to remove error text below my textfield in flutter

hey i am trying to remove the error this condition is working for me to remove the error but it does not change border color border color still remain same means border color remain red so how to change the border color to normal color

TextField(
                controller: userName,
                onChanged: (value){},
                decoration: InputDecoration(
                  hintText: "Email",
                  errorText: valid == true ? "" : "Not Good",
                  errorStyle: TextStyle(fontSize: valid == true ? 0 : 12),
                  prefixIcon: const Icon(Icons.email),
                  border: OutlineInputBorder(
                    borderRadius: BorderRadius.circular(10),
                    borderSide: BorderSide(color: valid == true ? Colors.black : Colors.red)
                  ),
                ),
              ),

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

did you use errorBorder

TextField(
  onChanged: (value) {},
  decoration: InputDecoration(
    errorBorder: const OutlineInputBorder(
      borderSide: BorderSide(color: Colors.red, width: 0.0),
    ),
    hintText: "Email",
    errorText: valid == true ? "email" : "Not Good",
    errorStyle: TextStyle(fontSize: valid == true ? 0 : 12),
    prefixIcon: const Icon(Icons.email),
    border: OutlineInputBorder(
        borderRadius: BorderRadius.circular(10),
        borderSide:
            BorderSide(color: valid == true ? Colors.black : Colors.blue)),
  ),
);
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading