From cc675cc8f9f7f86bf76d97e1d8fc815602e146f1 Mon Sep 17 00:00:00 2001 From: Vitaliy Zarubin Date: Thu, 20 Jul 2023 14:55:20 +0300 Subject: [PATCH] [sqflite] Update validate form. --- example/lib/packages/sqflite/widgets/form_insert.dart | 4 ++-- example/lib/packages/sqflite/widgets/form_update.dart | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/example/lib/packages/sqflite/widgets/form_insert.dart b/example/lib/packages/sqflite/widgets/form_insert.dart index c6ae478..0406fc3 100644 --- a/example/lib/packages/sqflite/widgets/form_insert.dart +++ b/example/lib/packages/sqflite/widgets/form_insert.dart @@ -80,7 +80,7 @@ class _SqfliteFormInsertState extends AppState { if (value == null || value.isEmpty) { return l10n.sqfliteTitleValidateRequired; } - if (double.tryParse(value) == null) { + if (double.tryParse(value.replaceAll(',', '.')) == null) { return l10n.sqfliteTitleValidateType('double'); } return null; @@ -98,7 +98,7 @@ class _SqfliteFormInsertState extends AppState { await widget.submit( _nameController.text, int.parse(_valueController.text), - double.parse(_numController.text), + double.parse(_numController.text.replaceAll(',', '.')), ); // Clear form _nameController.clear(); diff --git a/example/lib/packages/sqflite/widgets/form_update.dart b/example/lib/packages/sqflite/widgets/form_update.dart index 4e5af7e..17f4b01 100644 --- a/example/lib/packages/sqflite/widgets/form_update.dart +++ b/example/lib/packages/sqflite/widgets/form_update.dart @@ -101,7 +101,7 @@ class _SqfliteFormUpdateState extends AppState { if (value == null || value.isEmpty) { return l10n.sqfliteTitleValidateRequired; } - if (double.tryParse(value) == null) { + if (double.tryParse(value.replaceAll(',', '.')) == null) { return l10n.sqfliteTitleValidateType('double'); } return null; @@ -118,7 +118,7 @@ class _SqfliteFormUpdateState extends AppState { int.parse(_idController.text), _nameController.text, int.parse(_valueController.text), - double.parse(_numController.text), + double.parse(_numController.text.replaceAll(',', '.')), )) { // Clear focus FocusScope.of(context).unfocus();