Skip to content

Commit

Permalink
fix: String of only whitespaces considered as name (#3593)
Browse files Browse the repository at this point in the history
Input string will remove leading and trailing spaces in the
list item name and then adds to the list if its validated
  • Loading branch information
Sudhanva-Nadiger authored Jan 18, 2023
1 parent 9622b7d commit 7031c05
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ class ProductListUserDialogHelper {
autofocus: true,
textInputAction: TextInputAction.done,
validator: (String? value) {
value = value?.trim();
if (value == null || value.isEmpty) {
return appLocalizations.user_list_name_error_empty;
}
Expand All @@ -47,7 +48,7 @@ class ProductListUserDialogHelper {
if (!formKey.currentState!.validate()) {
return;
}
Navigator.pop(context, textEditingController.text);
Navigator.pop(context, textEditingController.text.trim());
},
),
),
Expand All @@ -61,7 +62,7 @@ class ProductListUserDialogHelper {
if (!formKey.currentState!.validate()) {
return;
}
Navigator.pop(context, textEditingController.text);
Navigator.pop(context, textEditingController.text.trim());
},
text: appLocalizations.create,
),
Expand Down

0 comments on commit 7031c05

Please sign in to comment.