Я просто создаю форму во Флаттере. Я не могу установить верхнее поле для кнопки.
class _MyHomePageState extends State<MyHomePage> {
String firstname;
String lastname;
final scaffoldKey = new GlobalKey<ScaffoldState>();
final formKey = new GlobalKey<FormState>();
@override
Widget build(BuildContext context) {
return new Scaffold(
key: scaffoldKey,
appBar: new AppBar(
title: new Text('Validating forms'),
),
body: new Padding(
padding: const EdgeInsets.all(16.0),
child: new Form(
key: formKey,
child: new Column(
children: [
new TextFormField(
decoration: new InputDecoration(labelText: 'First Name'),
validator: (val) =>
val.length == 0 ?"Enter FirstName" : null,
onSaved: (val) => firstname = val,
),
new TextFormField(
decoration: new InputDecoration(labelText: 'Password'),
validator: (val) =>
val.length ==0 ? 'Enter LastName' : null,
onSaved: (val) => lastname = val,
obscureText: true,
),
new RaisedButton(
onPressed: _submit,
child: new Text('Login'),
),
],
),
),
),
);
}