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;
});
},
)