Browse Source

[sqflite] Update validate form.

merge-requests/20/head
Vitaliy Zarubin 2 years ago
parent
commit
cc675cc8f9
  1. 4
      example/lib/packages/sqflite/widgets/form_insert.dart
  2. 4
      example/lib/packages/sqflite/widgets/form_update.dart

4
example/lib/packages/sqflite/widgets/form_insert.dart

@ -80,7 +80,7 @@ class _SqfliteFormInsertState extends AppState<SqfliteFormInsert> {
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<SqfliteFormInsert> {
await widget.submit(
_nameController.text,
int.parse(_valueController.text),
double.parse(_numController.text),
double.parse(_numController.text.replaceAll(',', '.')),
);
// Clear form
_nameController.clear();

4
example/lib/packages/sqflite/widgets/form_update.dart

@ -101,7 +101,7 @@ class _SqfliteFormUpdateState extends AppState<SqfliteFormUpdate> {
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<SqfliteFormUpdate> {
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();

Loading…
Cancel
Save