flutter_hook_form 2.0.7
flutter_hook_form: ^2.0.7 copied to clipboard
A Flutter package that provides a hook to manage form fields.
2.0.6 #
- π§ Upgrade dart SDK to ^3.8.0
2.0.2 #
Improvements #
- β»οΈ Update initialization business logic to avoid loosing initial value state on rebuild.
2.0.0 #
Breaking changes #
- π₯
FormProvider
has been renamed toHookedFormProvider
- π₯
FormFieldScheme
andHookedFieldId
have been merged intoHookField
- π₯
FormSchema
now declare afields
property to setup form fiels instead of usingsuper
constructor - π₯
builder
syntax has changed onHookedFormField
allowing to declare anonymous parameters.
Improvements #
- π Fix
PatternValidator
for failing on empty strings. Now fails only on non-empty values.
New Features #
- β¨
FormController
can now be initialized- Generated
FormSchema
declare a static to initialized eachHookField
withInitialValue
method has been added toHookField
to initialized a hook field with a given value.
- Generated
1.1.1 #
Improvements #
- β¨ Enhanced
FormFieldsController
with improved validation and error handling:- Added optional
notify
andclearErrors
parameters tovalidate()
method for more control - Added
setError()
method withnotify
parameter to control rebuilds - Introduced
clearForcedErrors()
method to manage form errors independently - Added new state tracking properties:
hasBeenInteracted
- Detects if any field has been interacted with by userhasChanged
- Checks if any field value differs from its initial value
- Added optional
Fix #
- π Update form generator to correctly identify closing brackets for generic types in annotations.
1.1.0 #
New Features #
-
β¨ Introduced
HookedFieldId<F, T>
with generic type parameters for improved type safety:- The form schema type
F
is now included in the field ID - This enables better type inference when using form fields
- No need to specify form schema type in most widget usages
- The form schema type
-
π Added reactive form capabilities:
- Form controller now properly notifies listeners when field values change
- Added
registerFieldChange
method to track field modifications - Added methods to check if fields are dirty:
isDirty
,areAnyDirty
,areAllDirty
-
β¨ Introduced
HookedFormField
andHookedTextFormField
:- Updated to use the new
fieldHook
parameter instead offieldKey
- Better type inference from field hooks
- Added support for tracking field changes
- Updated to use the new
Improvements #
-
π Comprehensive documentation updates:
- Added examples for custom form fields
- Improved explanation of form initialization
- Added section on writing custom form fields
- Updated code examples to use the latest API
-
π Fixed validation issues:
- Resolved bug where forced errors took precedence over validation errors
- Improved error clearing during validation
- Better handling of field rebuilds after validation
Breaking Changes #
- π Renamed parameter from
fieldKey
tofieldHook
in form field widgets- Update your code to use
fieldHook: MySchema.field
instead offieldKey: MySchema.field
- This change better reflects the purpose of the parameter
- Update your code to use
1.0.0 #
Breaking Changes #
-
β οΈ Validator usage has been updated to support internationalization:
- Validators are now declared in a list instead of being chained in a function.
- Validators now return
errorCode
instead of error messages - Error messages are handled through the
FormErrorMessages
class - Custom validators need to extend
Validator<T>
and provide anerrorCode
- See the documentation for migration details
-
β¨ Add code generation support for form schemas
-
π Add built-in internationalization support
-
π οΈ Improve code organization and maintainability
0.0.4 #
- Add comprehensive documentation
- Update exports
- Add example for package demonstration
0.0.3 #
- Downgrade mime package to 1.0.6
0.0.2 #
- Add test suite and improve comments
0.0.1 #
- Init project