I have a problem. I'm working on an application with Flutter 3 and I have to know if my TextField is returning the user entries. I have on one side this function to test signIn with the predefined user. Prints are here to verify the users entries. The signIn is working well but the print are empty. This one is contained in a stateless class called "LoginPage".
void loginToFirebase() {
print(FormSection().emailField.text.trim());
print(FormSection().passwordField.text.trim());
try {
auth
.signInWithEmailAndPassword(
email: 'xxxx@xxxx.com',
password: 'motdepasse')
.then((value) {
print(value.toString());
});
} catch (e) {
print(e.toString());
}
}
On second side I have my two TextField (the email and the password have the same construction, only the controller variable is changing). This one is contained in a stateless class called "FormSection".
Container(
margin: EdgeInsets.only(left: 10),
height: 60,
width: 230,
child: Center(
child: TextField(
controller: passwordField,
textAlign: TextAlign.center,
obscureText: true,
style: GoogleFonts.comfortaa(
fontSize: 20,
color: Colors.white,
fontWeight: FontWeight.bold),
decoration: InputDecoration(
hintText: 'Mot de passe',
hintStyle: GoogleFonts.comfortaa(
color: Colors.white.withOpacity(0.5)),
border: InputBorder.none),
)),
)
When I press the ElevatedButton (my connection button), I can login all it's ok, but the Controller.text is empty.
Someone have a solution ? Thanks for the time taken to read my problem and to answer.
I'm trying to call the user text input to verify the account to compare to my database.