From 105f3f0229adc8b14e8d87fcec827a7368ed3f1e Mon Sep 17 00:00:00 2001 From: Valentin CZERYBA Date: Thu, 1 Sep 2022 22:32:35 +0200 Subject: [PATCH] test form --- covas_mobile/lib/main.dart | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) 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:', ),