Repository: flutter-form-builder-ecosystem/form_builder_validators

Issue:
Form Builder Validator URLs: Make url validator case insensitive
### Is there an existing issue for this?

- [X] I have searched the existing issues

### Package/Plugin version

^9.0.0-dev.1

### Platforms

- [ ] Android
- [ ] iOS
- [ ] Linux
- [ ] MacOS
- [X] Web
- [ ] Windows

### Flutter doctor

<details>
  <summary>Flutter doctor</summary>

<!-- Paste the output below inside ``` and ``` -->
```bash
Doctor summary (to see all details, run flutter doctor -v):
  [✓] Flutter (Channel stable, 3.13.8, on macOS 13.5 22G74 darwin-arm64, locale en-KE)
  [✓] Android toolchain - develop for Android devices (Android SDK version 33.0.2)
  [!] Xcode - develop for iOS and macOS (Xcode 15.0.1)
      ✗ Unable to get list of installed Simulator runtimes.
  [✓] Chrome - develop for the web
  [!] Android Studio (version unknown)
      ✗ Unable to determine Android Studio version.
  [✓] Android Studio (version 2022.1)
  [✓] VS Code (version 1.71.2)
  [✓] Connected device (2 available)
      ! Error: Browsing on the local area network for Mboya’s iPhone. Ensure the device is unlocked and attached with a cable or associated with
      the same local area network as this Mac.
      The device must be opted into Developer Mode to connect wirelessly. (code -27)
  [✓] Network resources
```

</details>


### Minimal code example

<details>
  <summary>Code sample</summary>

<!-- Paste the output below inside ``` and ``` -->

```dart
  /// Inside a formbuildertextfield
  validator: FormBuilderValidators.compose([
   FormBuilderValidators.url()
  ]),
```

</details>


### Current Behavior

Upon entering a capital letter on the top level domain, the validator fails showing that the URL is invalid. 
For example: 
HTTPS://WWW.GOOGLE.COM - invalid link
https://www.google.com - valid link
https://WWW.GOOGLE.com - valid link
HTTPS://WWW.GOOGLE.COM - invalid link

### Expected Behavior

I believe the URL should be case insensitive. Any part of it having a capital letter should not invalidate the URL
While this is my exact case I'm not sure if it's valid for everyone. If given the go-ahead I could modify the REGEX pattern to include capital letters for the top level domain.

### Steps To Reproduce

1. Create a formbuildertextfield
2. add a formbuildervalidators.url as the textfield's validator
3. Run the project and try to type a url with a capital letter for the top level domain e.g. https://google.Com instead of https://google.com

### Aditional information

_No response_


Discussion: I would like to take this issue if it's fine.
@bjarn-hau yes, of course. Take a look on https://github.com/flutter-form-builder-ecosystem/.github/blob/0489089d2b364b14f41c3d5cd3ebd6f98a937a59/CONTRIBUTING.md
Thanks for that
Awesome would you mind assigning me on the issue?

Fix patch:
diff --git a/lib/src/utils/validators.dart b/lib/src/utils/validators.dart
index d389ea3b..df335883 100644
--- a/lib/src/utils/validators.dart
+++ b/lib/src/utils/validators.dart
@@ -10,6 +10,8 @@ RegExp _ipv6 =
 RegExp _creditCard = RegExp(
     r'^(?:4[0-9]{12}(?:[0-9]{3})?|5[1-5][0-9]{14}|6(?:011|5[0-9][0-9])[0-9]{12}|3[47][0-9]{13}|3(?:0[0-5]|[68][0-9])[0-9]{11}|(?:2131|1800|35\d{3})\d{11})$');
 
+int _maxUrlLength = 2083;
+
 /// check if the string [str] is an email
 bool isEmail(String str) {
   return _email.hasMatch(str.toLowerCase());
@@ -32,7 +34,7 @@ bool isURL(String? str,
     List<String> hostBlacklist = const []}) {
   if (str == null ||
       str.isEmpty ||
-      str.length > 2083 ||
+      str.length > _maxUrlLength ||
       str.startsWith('mailto:')) {
     return false;
   }
@@ -43,7 +45,7 @@ bool isURL(String? str,
   // check protocol
   var split = str.split('://');
   if (split.length > 1) {
-    protocol = shift(split);
+    protocol = shift(split)!.toLowerCase();
     if (!protocols.contains(protocol)) {
       return false;
     }
@@ -94,7 +96,7 @@ bool isURL(String? str,
   // check hostname
   hostname = split.join('@');
   split = hostname.split(':');
-  host = shift(split)!;
+  host = shift(split)!.toLowerCase();
   if (split.isNotEmpty) {
     portStr = split.join(':');
     try {


Test patch:
diff --git a/test/form_builder_validators_test.dart b/test/form_builder_validators_test.dart
index 207142d3..9f6fca32 100644
--- a/test/form_builder_validators_test.dart
+++ b/test/form_builder_validators_test.dart
@@ -412,6 +412,11 @@ void main() {
             expect(validator('www.google.com'), isNull);
             expect(validator('google.com'), isNull);
             expect(validator('http://google.com'), isNull);
+            expect(validator('HTTPS://GOOGLE.COM'), isNull);
+            expect(validator('GOOGLE.com'), isNull);
+            expect(validator('GOOGLE.COM'), isNull);
+            expect(validator('google.com/search?q=TEST'), isNull);
+            expect(validator('google.com/search#MY_AWESOME_THING'), isNull);
             // Fail
             expect(validator('.com'), isNotNull);
             // Advanced overrides