Home > database >  I am trying to make the username same as the value of the textfeild , but its not showing , the user
I am trying to make the username same as the value of the textfeild , but its not showing , the user

Time:11-08

I am trying to make the username same as the value of the textfield, but it's not showing the username.

TextFormField(
                decoration: InputDecoration(
                    hintText: "Enter your UserName", labelText: "UserName"),
                onChanged: (value) {
                  value = username;
                  setState(() {});
                },
              )

CodePudding user response:

username = value; you assign username to value!

CodePudding user response:

Adding onto @mehdi31075, but just put it inside the setstate.

TextFormField(
 decoration: InputDecoration(
 hintText: "Enter your UserName", labelText: "UserName"),
 onChanged: (value) {        
    setState(() {
       username=value;
   });
 },
)
  • Related