Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .fvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"flutter": "stable",
"flavors": {
"stable": "stable",
"beta": "beta"
}
}
13 changes: 10 additions & 3 deletions .github/workflows/base.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,17 @@ jobs:
with:
paths: "**/*.md"

- name: Get Flutter version by FVM
uses: kuhnroyal/flutter-fvm-config-action@v2
id: fvm-config-action
with:
path: '.fvmrc'
flavor: 'stable'

- uses: subosito/flutter-action@v2
with:
channel: 'stable'
# use the build-in cache from Subosito
flutter-version: ${{ steps.fvm-config-action.outputs.FLUTTER_VERSION }}
channel: ${{ steps.fvm-config-action.outputs.FLUTTER_CHANNEL }}
cache: true

- name: Install dependencies
Expand All @@ -52,7 +59,7 @@ jobs:
run: dart analyze

- name: Run tests
run: flutter test
run: flutter test --coverage

- name: Check publish warnings
run: dart pub publish --dry-run
Expand Down
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
# The .vscode folder contains launch configuration and tasks you configure in
# VS Code which you may wish to be included in version control, so this line
# is commented out by default.
#.vscode/
.vscode/

# Flutter/Dart/Pub related
**/doc/api/
Expand Down Expand Up @@ -76,4 +76,5 @@ pubspec.lock
!**/ios/**/default.perspectivev3

# L10n files
**/intl
**/intl
coverage/lcov.info
45 changes: 27 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,29 +8,32 @@ Also included is the `l10n` / `i18n` of error text messages to multiple language
[![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/flutter-form-builder-ecosystem/form_builder_validators/base.yaml?branch=main&logo=github&style=for-the-badge)](https://github.com/flutter-form-builder-ecosystem/form_builder_validators/actions/workflows/base.yaml)
[![Codecov](https://img.shields.io/codecov/c/github/flutter-form-builder-ecosystem/form_builder_validators?logo=codecov&style=for-the-badge)](https://codecov.io/gh/flutter-form-builder-ecosystem/form_builder_validators/)
[![CodeFactor Grade](https://img.shields.io/codefactor/grade/github/flutter-form-builder-ecosystem/form_builder_validators?logo=codefactor&style=for-the-badge)](https://www.codefactor.io/repository/github/flutter-form-builder-ecosystem/form_builder_validators)

---

> ## Migrating from version 7 to 8
>
> To migrate from v7 to v8, remove `context` as a parameter to validator functions. For example, `FormBuilderValidators.required(context)` becomes `FormBuilderValidators.required()` without `context` passed in.
## Call for Maintainers

> We are looking for maintainers to contribute to the development and maintenance of Flutter Form Builder Ecosystem. Is very important to keep the project alive and growing, so we need your help to keep it up to date and with new features. You can contribute in many ways, we describe some of them in [Support](#support) section.

## Contents

- [Features](#features)
- [Validators](#validators)
- [Supported languages](#supported-languages)
- [Supported languages](#supported-languages)
- [Use](#use)
- [Setup](#setup)
- [Basic use](#basic-use)
- [Specific uses](#specific-uses)
- [Composing multiple validators](#composing-multiple-validators)
- [Modify the default error message in a specific language](#modify-the-default-error-message-in-a-specific-language)
- [Setup](#setup)
- [Basic use](#basic-use)
- [Specific uses](#specific-uses)
- [Composing multiple validators](#composing-multiple-validators)
- [Modify the default error message in a specific language](#modify-the-default-error-message-in-a-specific-language)
- [Migrations](#migrations)
- [v7 to v8](#v7-to-v8)
- [Support](#support)
- [Contribute](#contribute)
- [Add new supported language](#add-new-supported-language)
- [Add new validator](#add-new-validator)
- [Questions and answers](#questions-and-answers)
- [Donations](#donations)
- [Contribute](#contribute)
- [Add new supported language](#add-new-supported-language)
- [Add new validator](#add-new-validator)
- [Questions and answers](#questions-and-answers)
- [Donations](#donations)
- [Roadmap](#roadmap)
- [Ecosystem](#ecosystem)
- [Thanks to](#thanks-to)
Expand All @@ -46,7 +49,7 @@ Also included is the `l10n` / `i18n` of error text messages to multiple language
This package comes with several most common `FormFieldValidator`s such as required, numeric, mail,
URL, min, max, minLength, maxLength, minWordsCount, maxWordsCount, IP, credit card, etc., with default `errorText` messages.

Available built-in helper validators:
### Helper validators

- `FormBuilderValidators.compose()` - runs each validator against the value provided.
- `FormBuilderValidators.conditional()` - conditionally runs a validator against the value provided.
Expand All @@ -57,7 +60,7 @@ Available built-in helper validators:
- `FormBuilderValidators.skipWhen()` - runs the validator and skips the validation when a certain condition is met.
- `FormBuilderValidators.defaultValue()` - runs the validator using the default value when the provided value is null.

Available built-in type validators include:
### Type validators

- `FormBuilderValidators.equal()` - requires the field's value to be equal to the provided object.
- `FormBuilderValidators.integer()` - requires the field's value to be an integer.
Expand Down Expand Up @@ -92,7 +95,7 @@ Available built-in type validators include:
- `FormBuilderValidators.unique()` - requires the field's to be unique in the provided list.
- `FormBuilderValidators.singleLine()` - requires the field's string to be a single line of text.

Available built-in use-case validators include:
### Use-case validators

- `FormBuilderValidators.creditCard()` - requires the field's value to be a valid credit card number.
- `FormBuilderValidators.creditCardExpirationDate()` - requires the field's value to be a valid credit card expiration date and can check if not expired yet.
Expand All @@ -116,7 +119,7 @@ Available built-in use-case validators include:
- `FormBuilderValidators.bic()` - requires the field's to be an valid BIC.
- `FormBuilderValidators.isbn()` - requires the field's to be an valid ISBN.

Available extension methods used for chaining validators:
## Extension methods used for chaining validators

- `FormBuilderValidator.and()` - Combines the current validator with another validator using logical AND.
- `FormBuilderValidator.or()` - Combines the current validator with another validator using logical OR.
Expand Down Expand Up @@ -256,6 +259,12 @@ TextFormField(

see [override_form_builder_localizations_en](example/lib/override_form_builder_localizations_en.dart) for more detail.

## Migrations

### v7 to v8

Remove `context` as a parameter to validator functions. For example, `FormBuilderValidators.required(context)` becomes `FormBuilderValidators.required()` without `context` passed in.

## Support

### Contribute
Expand Down
1 change: 1 addition & 0 deletions lib/form_builder_validators.dart
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,4 @@ export 'localization/intl/messages_uk.dart';
export 'localization/intl/messages_zh.dart';
export 'localization/l10n.dart';
export 'src/form_builder_validators.dart';
export 'src/form_field_validator_extensions.dart';
4 changes: 2 additions & 2 deletions lib/src/form_builder_validators.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import 'package:flutter/material.dart';
import '../form_builder_validators.dart';
import 'package:flutter/widgets.dart';

import '../form_builder_validators.dart';
import 'utils/helpers.dart';
import 'utils/validators.dart';

Expand Down
1 change: 1 addition & 0 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ dependencies:
intl: ^0.19.0

dev_dependencies:
faker_dart: ^0.2.2
flutter_lints: ^4.0.0
flutter_test:
sdk: flutter
Expand Down
Loading