class NewTransfer extends StatelessWidget {
final TextEditingController fieldControllerAccountNumber = TextEditingController();
final TextEditingController fieldControllerValue = TextEditingController();
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Nova Transferência'),
),
body: Container(
child: Column(
children: <Widget>[
Field(
controller: this.fieldControllerAccountNumber,
label: 'Número da conta',
hint: '0000',
),
Field(
controller: this.fieldControllerValue,
label: 'Valor',
hint: '0.00',
icon: Icons.monetization_on,
),
RaisedButton(
child: Text('Confirmar'),
onPressed: () => createTransfer(context),
),
],
),
),
);
}
}
class Field extends StatelessWidget {
final TextEditingController controller;
final String label;
final String hint;
final IconData icon;
Field({
this.controller,
this.label,
this.hint,
this.icon,
});
@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.all(16),
child: TextField(
controller: this.controller,
keyboardType: TextInputType.number,
style: TextStyle(fontSize: 16),
decoration: InputDecoration(
icon: this.icon != null ? Icon(this.icon) : null,
labelText: this.label,
hintText: this.hint,
),
),
);
}
}