flutter-form-builder-ecosystem / form_builder_validators

Form Builder Validators is set of validators for FormFields. It provides common validators and a way to reuse multiple validators
https://pub.dev/packages/form_builder_validators
BSD 3-Clause "New" or "Revised" License
52 stars 98 forks source link

[username_validator]: Unable to input numbers when allowSpecialChar is false #114

Closed yaliv closed 4 months ago

yaliv commented 4 months ago

Is there an existing issue for this?

Package/Plugin version

11.0.0

Platforms

Flutter doctor

Flutter doctor ```bash [✓] Flutter (Channel stable, 3.22.2, on Garuda Linux 6.9.8-zen1-1-zen, locale id_ID.UTF-8) • Flutter version 3.22.2 on channel stable at /mnt/Lab/FLUTTER/SDK • Upstream repository https://github.com/flutter/flutter.git • Framework revision 761747bfc5 (5 minggu yang lalu), 2024-06-05 22:15:13 +0200 • Engine revision edd8546116 • Dart version 3.4.3 • DevTools version 2.34.3 [✓] Android toolchain - develop for Android devices (Android SDK version 33.0.1) • Android SDK at /mnt/Lab/ANDROID/SDK • Platform android-33, build-tools 33.0.1 • ANDROID_SDK_ROOT = /mnt/Lab/ANDROID/SDK • Java binary at: /mnt/Lab/ANDROID/Studio/jbr/bin/java • Java version OpenJDK Runtime Environment (build 11.0.15+0-b2043.56-8887301) • All Android licenses accepted. [✓] Chrome - develop for the web • CHROME_EXECUTABLE = opera [✓] Linux toolchain - develop for Linux desktop • clang version 18.1.8 • cmake version 3.30.0 • ninja version 1.12.1 • pkg-config version 2.1.1 [✓] Android Studio (version 2022.1) • Android Studio at /mnt/Lab/ANDROID/Studio • Flutter plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/6351-dart • Java version OpenJDK Runtime Environment (build 11.0.15+0-b2043.56-8887301) [✓] Connected device (2 available) • Linux (desktop) • linux • linux-x64 • Garuda Linux 6.9.8-zen1-1-zen • Chrome (web) • chrome • web-javascript • 111.0.5168.61 [✓] Network resources • All expected network resources are available. • No issues found! ```

Minimal code example

Code sample ```dart FormBuilderValidators.username( minLength: 4, maxLength: 15, allowNumbers: true, allowSpecialChar: false, ); ```

Current Behavior

When I input this string:
abc1

I got error:
Username cannot contain special characters.

Expected Behavior

The validation should pass.

Steps To Reproduce

  1. Create a text field with username validator.
  2. Run flutter run -d linux.
  3. Input "abc1" to the text field.
  4. Trigger form validation.
  5. See error "Username cannot contain special characters."

Aditional information

Screenshot of the error:

2024-07-13_22-04