From 99aaaedf928d29c39c63c9dab7f4a0e14fe5adaf Mon Sep 17 00:00:00 2001 From: vjrj <vjrj@comunes.org> Date: Sun, 9 Apr 2023 13:42:24 +0200 Subject: [PATCH] Fix for #14 --- lib/ui/widgets/first_screen/pay_form.dart | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/ui/widgets/first_screen/pay_form.dart b/lib/ui/widgets/first_screen/pay_form.dart index 1512436e..09b33766 100644 --- a/lib/ui/widgets/first_screen/pay_form.dart +++ b/lib/ui/widgets/first_screen/pay_form.dart @@ -26,9 +26,6 @@ class _PayFormState extends State<PayForm> { final GlobalKey<FormState> _formKey = GlobalKey<FormState>(); final TextEditingController _commentController = TextEditingController(); -// static final RegExp _englishRegExp = RegExp('^[\u0000-\u007F]*\$'); - // static final RegExp _englishRegExp = RegExp(r'^[a-zA-Z0-9\s.,;:!?()\-]*$'); - @override Widget build(BuildContext context) { return BlocBuilder<PaymentCubit, PaymentState>( @@ -127,9 +124,12 @@ class _PayFormState extends State<PayForm> { } bool _commentValidate() { - final bool? val = _formKey.currentState?.validate(); + final String currentComment = _commentController.value.text; + final bool val = (currentComment != null && + basicEnglishCharsRegExp.hasMatch(currentComment)) || + currentComment.isEmpty; logger('Validating comment: $val'); - return val ?? false; + return val; } bool _weHaveBalance(BuildContext context, double amount) => -- GitLab