Skip to content
Closed
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
18 changes: 14 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,25 @@
## Unreleased
## 0.3.0

* Validation modes are now yours to write. `ValidationMode` is a class, and `ValidationMode.custom(name, fn)` turns a one-line rule into a mode the package treats like its own.
Validation modes are now yours to write. The four modes stay as they were; what is new is that a rule none of them states no longer needs a workaround.

* `ValidationMode` is a class, and `ValidationMode.custom(name, fn)` turns a one-line rule into a mode the package treats like its own.
* The rule gets a `ValidationContext`: which event is happening (`valueChanged`, `unfocus` or `dependencyChanged`) and whether the user has ever left the field after editing it.
* It never sees the status, the errors or the value, so a rule cannot switch itself off while the user is fixing a mistake.
* An untouched field still validates nothing, whatever the rule says; `validate()` still ignores the mode; sync still runs before async.
* Set it on the form and it reaches every field and subform; set it on one field and that field keeps it.
* Modes are compared by name, so a mode built in `build()` is not a mode change; a built-in name throws.
* The docs have a page for it with a live demo, and the README and the skill cover it too.
* New built-in mode `ValidationMode.afterFirstUnfocus`: quiet while the user types, validates when the field is first left, and from then on validates every edit, so an error disappears the moment the value is fixed.
* Breaking: an exhaustive `switch` over `ValidationMode` needs a default case, and `ValidationMode.values` is gone, because with custom modes there is no finite list.
* The deprecated `stream` extension stays until 0.4.0; it was announced for removal in 0.3.0, but this release already asks for one change in a `switch`, and that is enough.
* The mode pickers in the docs demos are pills that wrap, so every mode name is readable on a phone.

Breaking changes, both small:

* An exhaustive `switch` over `ValidationMode` needs a default case now.
* `ValidationMode.values` is gone, because with custom modes there is no finite list.

Still here:

* The deprecated `stream` extension stays until 0.4.0. It was announced for removal in 0.3.0, but this release already asks for one change, and that is enough.

## 0.2.4

Expand Down
2 changes: 1 addition & 1 deletion example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ packages:
path: ".."
relative: true
source: path
version: "0.2.4"
version: "0.3.0"
analyzer:
dependency: transitive
description:
Expand Down
2 changes: 1 addition & 1 deletion example/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: advanced_forms_example
description: Gallery app for advanced_forms — one screen per documented form pattern.
publish_to: "none"
version: 0.2.4
version: 0.3.0

environment:
sdk: ">=3.3.0 <4.0.0"
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: advanced_forms
description: Flutter form validation and state management — typed controllers for text, checkbox, dropdown and multi-select fields, async and cross-field validators, and subforms.
version: 0.2.4
version: 0.3.0
homepage: https://github.com/leancodepl/advanced_forms
repository: https://github.com/leancodepl/advanced_forms
issue_tracker: https://github.com/leancodepl/advanced_forms/issues
Expand Down
Loading