Merge pull request #7 from Cyanose/feature/add-entry-on-enter-when-gram-field-foccused

add Entry on product or grams field submitted
This commit is contained in:
Doman 2023-08-03 21:03:04 +02:00 committed by GitHub
commit 67b1811a89
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -132,6 +132,8 @@ class _AddEntryScreen extends State<AddEntryScreen> {
FilteringTextInputFormatter.allow(RegExp(r'^(\d+)?[\.,]?\d{0,2}')), FilteringTextInputFormatter.allow(RegExp(r'^(\d+)?[\.,]?\d{0,2}')),
], ],
controller: gramsController, controller: gramsController,
onFieldSubmitted: (_) => _addEntry(),
autofocus: true,
), ),
TextFormField( TextFormField(
decoration: const InputDecoration( decoration: const InputDecoration(
@ -139,6 +141,7 @@ class _AddEntryScreen extends State<AddEntryScreen> {
), ),
controller: productNameController, controller: productNameController,
onChanged: (_) => _getProducts(), onChanged: (_) => _getProducts(),
onFieldSubmitted: (_) => _addEntry(),
), ),
TextButton( TextButton(
onPressed: () { onPressed: () {