From a9f13ed0ef992ca20d7c5adcff77703bfb8db595 Mon Sep 17 00:00:00 2001 From: Danvick Miller Date: Mon, 23 Nov 2020 21:36:26 +0300 Subject: [PATCH] Created complete changelog for v4 --- CHANGELOG.md | 33 ++++++++++++++++++++++++++ example/lib/sources/complete_form.dart | 2 +- example/lib/sources/signup_form.dart | 4 +++- lib/src/form_builder.dart | 6 +++++ lib/src/form_builder_validators.dart | 2 -- lib/src/widgets/grouped_checkbox.dart | 4 ++-- pubspec.yaml | 4 ++-- 7 files changed, 47 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2175fe930f..bcf50ec91f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,36 @@ +## [4.0.0] - 23-Nov-2020 +**IMPROVEMENTS**: +* New fields: `FormBuilderFilePicker`, `FormBuilderSearchableDropdown`, `FormBuilderCheckboxGroup` +* Localization of validation error texts +* Added external validation. Setting `InputDecoration.errorText` which invalidates the field. +* New validators: `FormBuilderValidators.integer`, `FormBuilderValidators.equal` +* Improved programmatically changing field values. +* Add to `FormBuilderField.onReset` callback - to enable reaction to resetting by changing the UI to reflect reset +* Add option to remove disabled field values from the final form value using `skipReadOnly` field. +* Number of Chips to be selected in FilterChip can now be limited by setting `maxChips` attribute. Closes #500 +* Use localized text for OK and CANCEL button labels for ColorPicker dialog +* For default DateTimePicker format, use localized DateTime formats +* Added option for user to set own `border` for `FormBuilderSignaturePad` +* Improvements to example: break down to several pages; also show code in example app + +**FIXES**: +* RadioGroup and CheckboxGroup labels not wrapping in vertical mode. Fixes #474 +* Allow changing `enabled` and `initialValue` at runtime. Closes #515 +* Hide floating label if field is empty +* Fixed bug in DateRangePicker where user can just pick one date +* ColorPicker, DateRangePicker, DateTimePicker - set TextField readOnly to true. Prevents keyboard popup +* Fixed label overflows in RadioGroup & CheckboxGroup fields +* Renamed `updateFormAttributeValue` to `setInternalAttributeValue` to avoid confusion + +**BREAKING CHANGES**: +* Renamed `attribute` option in all fields to `name` +* Done away with `validators` attribute, use normal `validator`. Use `FormBuilderValidators.compose()` to compose multiple `FormFieldValidator`s into one +* Attribute `readOnly` replaced by `enabled` - this was done to match Flutter's `FormField` naming convention +* Renamed `FormBuilderRate` to `FormBuilderRating` +* Renamed `FormBuilderValidators.IP()` to `FormBuilderValidators.ip()` +* Removed CountryPicker field because of limited use. Replaced with SearchableDropdown with similar functionality but not only limited to countries. +* Use signature: ^3.0.0 package instead of self-maintained - comes with breaking changes. + ## [4.0.0-pre.9] - 22-Nov-2020 * Upgraded to latest `file_picker` - adds `withReadStream` option for processing large files * Fixed issue where `initialValue` working on SignaturePad diff --git a/example/lib/sources/complete_form.dart b/example/lib/sources/complete_form.dart index 7c72e1d785..2e629be70f 100644 --- a/example/lib/sources/complete_form.dart +++ b/example/lib/sources/complete_form.dart @@ -1,5 +1,4 @@ import 'package:flutter/cupertino.dart'; -//import 'package:flutter/gestures.dart'; import 'package:flutter/material.dart'; import 'package:flutter_form_builder/flutter_form_builder.dart'; import 'package:intl/intl.dart'; @@ -33,6 +32,7 @@ class CompleteFormState extends State { children: [ FormBuilder( key: _formKey, + // enabled: false, autovalidateMode: AutovalidateMode.disabled, initialValue: { 'movie_rating': 5, diff --git a/example/lib/sources/signup_form.dart b/example/lib/sources/signup_form.dart index 372a08f858..18c07d9371 100644 --- a/example/lib/sources/signup_form.dart +++ b/example/lib/sources/signup_form.dart @@ -1,4 +1,5 @@ import 'package:flutter/material.dart'; +import 'package:flutter/widgets.dart'; import 'package:flutter_form_builder/flutter_form_builder.dart'; class SignupForm extends StatefulWidget { @@ -17,7 +18,7 @@ class _SignupFormState extends State { padding: const EdgeInsets.all(8.0), child: FormBuilder( key: _formKey, - autovalidateMode: AutovalidateMode.disabled, + autovalidateMode: AutovalidateMode.onUserInteraction, child: Column( children: [ FormBuilderTextField( @@ -49,6 +50,7 @@ class _SignupFormState extends State { const SizedBox(height: 10), FormBuilderTextField( name: 'confirm_password', + autovalidateMode: AutovalidateMode.onUserInteraction, decoration: InputDecoration( labelText: 'Confirm Password', suffixIcon: (_formKey.currentState != null && diff --git a/lib/src/form_builder.dart b/lib/src/form_builder.dart index ef456df2d6..cb338fda59 100644 --- a/lib/src/form_builder.dart +++ b/lib/src/form_builder.dart @@ -96,6 +96,12 @@ class FormBuilderState extends State { Map get fields => _fields; + /* + bool get hasError => _fields.values.map((e) => e.hasError).firstWhere((element) => element == false, orElse: () => true); + + bool get isValid => _fields.values.map((e) => e.isValid).firstWhere((element) => element == false, orElse: () => true); + */ + void setInternalFieldValue(String name, dynamic value) { setState(() { _value[name] = value; diff --git a/lib/src/form_builder_validators.dart b/lib/src/form_builder_validators.dart index 28832f0153..07d3a14a40 100644 --- a/lib/src/form_builder_validators.dart +++ b/lib/src/form_builder_validators.dart @@ -49,7 +49,6 @@ class FormBuilderValidators { FormBuilderLocalizations.of(context).equalErrorText(value) : null; - // TODO(any): implement inclusive in l10n /// [FormFieldValidator] that requires the field's value to be greater than /// (or equal) to the provided number. static FormFieldValidator min( @@ -74,7 +73,6 @@ class FormBuilderValidators { }; } - // TODO(any): implement inclusive in l10n /// [FormFieldValidator] that requires the field's value to be less than /// (or equal) to the provided number. static FormFieldValidator max( diff --git a/lib/src/widgets/grouped_checkbox.dart b/lib/src/widgets/grouped_checkbox.dart index 1ee1bf6c74..4ff0346d0a 100644 --- a/lib/src/widgets/grouped_checkbox.dart +++ b/lib/src/widgets/grouped_checkbox.dart @@ -3,7 +3,7 @@ import 'package:flutter_form_builder/flutter_form_builder.dart'; class GroupedCheckbox extends StatefulWidget { /// A list of string that describes each checkbox. Each item must be distinct. - final List options; + final List> options; /// A list of string which specifies automatically checked checkboxes. /// Every element must match an item from itemList. @@ -205,7 +205,7 @@ class GroupedCheckbox extends StatefulWidget { }) : super(key: key); @override - _GroupedCheckboxState createState() => _GroupedCheckboxState(); + _GroupedCheckboxState createState() => _GroupedCheckboxState(); } class _GroupedCheckboxState extends State> { diff --git a/pubspec.yaml b/pubspec.yaml index ddae1e367f..0d5a264343 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: flutter_form_builder -description: This package helps in creation of forms in Flutter by removing the boilerplate, reuse validation, react to changes, and collect final user input. -version: 4.0.0-pre.9 +description: This package helps in creation of forms in Flutter by removing the boilerplate code, reusing validation, react to changes, and collect final user input. +version: 4.0.0 homepage: https://github.com/danvick/flutter_form_builder environment: