diff --git a/covas_mobile/lib/main.dart b/covas_mobile/lib/main.dart index 7ad9748..3c01511 100644 --- a/covas_mobile/lib/main.dart +++ b/covas_mobile/lib/main.dart @@ -113,6 +113,8 @@ class _MyHomePageState extends State { }); } + final _formKey = GlobalKey(); + @override Widget build(BuildContext context) { // This method is rerun every time setState is called, for instance as done @@ -147,6 +149,23 @@ class _MyHomePageState extends State { // horizontal). mainAxisAlignment: MainAxisAlignment.center, children: [ + Form( + key: _formKey, + child: Column( + children: [ + // Add TextFormFields and ElevatedButton here. + TextFormField( + // The validator receives the text that the user has entered. + validator: (value) { + if (value == null || value.isEmpty) { + return 'Please enter some text'; + } + return null; + }, + ), + ], + ), + ), const Text( 'You have pushed the button this many times:', ),