我通过简单地更改此类来解决了这个问题:
import 'package:flutter/material.dart';class UserLoader extends StatefulWidget { @override _UserLoaderState createState() => new _UserLoaderState();}class _UserLoaderState extends State<UserLoader> { Widget _form; // Save the form @override Widget build(BuildContext context) { if (_form == null) { // Create the form if it does not exist _form = _createForm(context); // Build the form } return _form; // Show the form in the application } Widget _createForm(BuildContext context) { // This is the exact content of the build method in the question final _formKey = new GlobalKey<FormState>(); final _emailController = new TextEditingController(); return new Scaffold( appBar: new AppBar( title: new Text("Informations"), actions: <Widget>[ new IconButton( icon: const Icon(Icons.save), onPressed: () { // unrelated stuff happens here }) ], ), body: new Center( child: new SingleChildScrollView( child: new Form( key: _formKey, child: new Column(children: <Widget>[ new ListTile(leading: const Icon(Icons.email),title: new TextFormField( decoration: new InputDecoration( hintText: "Email", ), keyboardType: TextInputType.emailAddress, controller: _emailController, validator: _validateEmail,), ), ]))), )); } }}希望有一天能对别人有所帮助。



