Created
March 22, 2020 19:14
-
-
Save guilhermelirio/3782f87cecc4eaff305584f7ffbd3781 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
import 'package:minhas_prescricoes/screens/utils.dart'; | |
import 'package:minhas_prescricoes/widgets/input_precricao.dart'; | |
class CadPrecricao extends StatefulWidget { | |
@override | |
_CadPrecricaoState createState() => _CadPrecricaoState(); | |
} | |
class _CadPrecricaoState extends State<CadPrecricao> { | |
final _formKey = GlobalKey<FormState>(); | |
String nomePaciente, nomeMedico; | |
@override | |
Widget build(BuildContext context) { | |
return Scaffold( | |
appBar: AppBar( | |
title: Text('Criar Prescrição'), | |
centerTitle: true, | |
), | |
body: Container( | |
decoration: bg, | |
child: Form( | |
key: _formKey, | |
child: ListView( | |
children: [ | |
Input( | |
label: 'Nome do Paciente', | |
nomeVariavel: nomePaciente, | |
formkey: _formKey, | |
), | |
Padding( | |
padding: const EdgeInsets.symmetric(vertical: 16.0), | |
child: RaisedButton( | |
onPressed: () { | |
// Validate returns true if the form is valid, or false | |
// otherwise. | |
if (_formKey.currentState.validate()) { | |
_formKey.currentState.save(); | |
print("Nome Paciente: ${nomePaciente}"); | |
// If the form is valid, display a Snackbar. | |
Scaffold.of(context).showSnackBar( | |
SnackBar(content: Text('Processing Data'))); | |
} | |
}, | |
child: Text('Cadastrar'), | |
), | |
) | |
], | |
), | |
), | |
), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment