title: Flutter - TextField rebuilds widget on focus
body: <p>The effect is that you can't open the keyboard. I did some digging around this issue elsewhere, and most issues are when the widget is stateful (but mine is not).The following is the <code>LoginWidget</code>. I'm using the provider package, which I suspect might be doing something underneath the covers. Can anyone spot something I don't see? :</p>
  
  <pre><code>class LoginPage extends StatelessWidget {
    @override
    Widget build(BuildContext context) {
      String email, password;
      final GlobalKey&lt;FormState&gt; formKey = GlobalKey&lt;FormState&gt;();
      return ChangeNotifierProvider&lt;LoginModel&gt;(
          builder: (context) =&gt; LoginModel(ViewState.Idle),
          child: Consumer&lt;LoginModel&gt;(
              builder: (context, model, child) =&gt; Scaffold(
                    appBar: AppBar(
                      title: Text("Sign in"),
                    ),
                    body: Form(
                        key: formKey,
                        child: Column(
                          mainAxisAlignment: MainAxisAlignment.center,
                          children: &lt;Widget&gt;[
                            TextFormField(
                              validator: (input) {
                                if (input.isEmpty) {
                                  return "Email required";
                                }
                              },
                              onSaved: (input) =&gt; email = input,
                              decoration: InputDecoration(labelText: 'Email'),
                            ),
                            TextFormField(
                              validator: (input) {
                                if (input.isEmpty) {
                                  return "Password required";
                                }
                              },
                              onSaved: (input) =&gt; password = input,
                              decoration: InputDecoration(labelText: 'Password'),
                              obscureText: true,
                            ),
                            model.state == ViewState.Loading
                                ? CircularProgressIndicator()
                                : RaisedButton(
                                    onPressed: () async {
                                      if (formKey.currentState.validate()) {
                                        formKey.currentState.save();
                                        bool success =
                                            await model.login(email, password);
                                        if (success) {
  //                                  Navigator.pushNamed(context, '/');
                                          Navigator.pushReplacement(
                                            context,
                                            MaterialPageRoute(
                                                builder: (context) =&gt; HomePage()),
                                          );
                                        }
                                      }
                                    },
                                    child: Text('Sign in'),
                                  ),
                            if (model.state == ViewState.Error)
                              Center(child: Text(model.apiErrorMessage))
                          ],
                        )),
                  )));
    }
  }
  </code></pre>