From 484321556910b1ecae46d0c96f833050355347cc Mon Sep 17 00:00:00 2001 From: Cyanose Date: Thu, 3 Aug 2023 12:19:02 +0200 Subject: [PATCH 1/2] add Entry on grams field submitted add Entry on product field submitted as well --- lib/screens/add_entry.dart | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/screens/add_entry.dart b/lib/screens/add_entry.dart index 47e68a1..dfff97e 100644 --- a/lib/screens/add_entry.dart +++ b/lib/screens/add_entry.dart @@ -132,6 +132,7 @@ class _AddEntryScreen extends State { FilteringTextInputFormatter.allow(RegExp(r'^(\d+)?[\.,]?\d{0,2}')), ], controller: gramsController, + onFieldSubmitted: (_) => _addEntry(), ), TextFormField( decoration: const InputDecoration( @@ -139,6 +140,7 @@ class _AddEntryScreen extends State { ), controller: productNameController, onChanged: (_) => _getProducts(), + onFieldSubmitted: (_) => _addEntry(), ), TextButton( onPressed: () { From 66404b3aff5e72e55181d4857313918ba3a3716f Mon Sep 17 00:00:00 2001 From: Cyanose Date: Thu, 3 Aug 2023 13:19:58 +0200 Subject: [PATCH 2/2] add autofocus on gram input field --- lib/screens/add_entry.dart | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/screens/add_entry.dart b/lib/screens/add_entry.dart index dfff97e..8a78dd3 100644 --- a/lib/screens/add_entry.dart +++ b/lib/screens/add_entry.dart @@ -133,6 +133,7 @@ class _AddEntryScreen extends State { ], controller: gramsController, onFieldSubmitted: (_) => _addEntry(), + autofocus: true, ), TextFormField( decoration: const InputDecoration(