Skip to content

Commit 31816f6

Browse files
committed
Release v5.0.0
1 parent 9991b50 commit 31816f6

27 files changed

+316
-240
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
## [5.0.0] - 24-Mar-2020
2+
* Flutter 2.* support
3+
14
## [4.2.0] - 29-Dec-2020
25
* Added support for Slovak (sk) - @cek-cek
36

README.md

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -19,26 +19,15 @@ and collect final user input.
1919
To use this plugin, add `flutter_form_builder` as a
2020
[dependency in your pubspec.yaml file](https://flutter.io/platform-plugins/).
2121

22+
### Flutter Version Guide
23+
* Flutter 1.20 => `v4.*`
24+
* Flutter 2.* with no `null-safety` => `v5.*`
25+
* Flutter 2.* `null-safety` => `v6.*` - some dependencies (and therefore fields)* were removed to achieve null safety
26+
2227
## New Video Tutorial
2328
[![Youtube Video Tutorial](https://i.imgur.com/gBJu2Tql.png)](https://www.youtube.com/watch?v=eGwq3_0K_Sg)<br/>
2429
[Check out the video tutorial from SyntacOps on Youtube](https://www.youtube.com/watch?v=eGwq3_0K_Sg)
2530

26-
### Migrating from v3 to v4
27-
Improvements:
28-
* Internationalized default error texts for inbuilt validators - Help wanted to do even more in translating to more languages.
29-
* Ability to programmatically induce an error to a field - could be especially useful for server-side validation.
30-
* New field types including: SearchableDropdown and FilePickerField
31-
* Better composition of validators.
32-
33-
Breaking changes:
34-
* Rename `attribute` option in all fields to `name`.
35-
* `validators` attribute has been renamed to `validator` which takes Flutter's
36-
[FormFieldValidator]() object. To compose multiple `FormFieldValidator`s together, use
37-
`FormBuilderValidators.compose()` which takes a list of `FormFieldValidator` objects.
38-
* `FormBuilderValidators.requiredTrue` functionality has been replaced with `FormBuilderValidators.equal` which can be used to check equality of any `Object` or value
39-
* Due to its limited use, `FormBuilderCountryPicker` was removed from the package. Its functionality could be achieved with use of `FormBuilderSearchableDropdown` which is more extensible.
40-
* `FormBuilderCustomField` functionality is now achieved using `FormBuilderField` class which is the base class from which all fields are built in v4. Follow [these instructions](#building-your-own-custom-field) to construct your own custom form field using `FormBuilderField`.
41-
4231
### Example
4332
```dart
4433
final _formKey = GlobalKey<FormBuilderState>();

example/lib/code_page.dart

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import 'package:flutter/material.dart';
2-
import 'package:widget_with_codeview/widget_with_codeview.dart';
2+
// import 'package:widget_with_codeview/widget_with_codeview.dart';
33

44
class CodePage extends StatefulWidget {
55
final String title;
@@ -21,17 +21,15 @@ class _CodePageState extends State<CodePage> {
2121
@override
2222
Widget build(BuildContext context) {
2323
return Scaffold(
24-
appBar: AppBar(
25-
title: Text(widget.title),
26-
elevation: 0,
27-
),
28-
body: WidgetWithCodeView(
24+
appBar: AppBar(title: Text(widget.title), elevation: 0),
25+
/*body: WidgetWithCodeView(
2926
child: widget.child,
3027
sourceFilePath: widget.sourceFilePath,
3128
// 1codeLinkPrefix` is optional. When it's specified, two more buttons
3229
// (open-code-in-browser, copy-code-link) will be added in the code view.
3330
// codeLinkPrefix: 'https://github.com/danvick/flutter_form_builder/blob/version_4/example/',
34-
),
31+
),*/
32+
body: widget.child,
3533
);
3634
}
3735
}

example/lib/home_page.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ class HomePage extends StatelessWidget {
2323
builder: (context) {
2424
return CodePage(
2525
title: 'Complete Form',
26-
child: CompleteForm(),
2726
sourceFilePath: 'lib/sources/complete_form.dart',
27+
child: CompleteForm(),
2828
);
2929
},
3030
),
@@ -41,8 +41,8 @@ class HomePage extends StatelessWidget {
4141
builder: (context) {
4242
return CodePage(
4343
title: 'Signup Form',
44-
child: SignupForm(),
4544
sourceFilePath: 'lib/sources/signup_form.dart',
45+
child: SignupForm(),
4646
);
4747
},
4848
),

example/lib/sources/complete_form.dart

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -416,10 +416,6 @@ class CompleteFormState extends State<CompleteForm> {
416416
Expanded(
417417
child: MaterialButton(
418418
color: Theme.of(context).accentColor,
419-
child: const Text(
420-
'Submit',
421-
style: TextStyle(color: Colors.white),
422-
),
423419
onPressed: () {
424420
if (_formKey.currentState.saveAndValidate()) {
425421
print(_formKey.currentState.value);
@@ -428,19 +424,23 @@ class CompleteFormState extends State<CompleteForm> {
428424
print('validation failed');
429425
}
430426
},
427+
child: const Text(
428+
'Submit',
429+
style: TextStyle(color: Colors.white),
430+
),
431431
),
432432
),
433433
const SizedBox(width: 20),
434434
Expanded(
435435
child: OutlinedButton(
436+
onPressed: () {
437+
_formKey.currentState.reset();
438+
},
436439
// color: Theme.of(context).accentColor,
437440
child: Text(
438441
'Reset',
439442
style: TextStyle(color: Theme.of(context).accentColor),
440443
),
441-
onPressed: () {
442-
_formKey.currentState.reset();
443-
},
444444
),
445445
),
446446
],

example/lib/sources/signup_form.dart

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -103,10 +103,6 @@ class _SignupFormState extends State<SignupForm> {
103103
const SizedBox(height: 10),
104104
MaterialButton(
105105
color: Theme.of(context).accentColor,
106-
child: Text(
107-
'Signup',
108-
style: TextStyle(color: Colors.white),
109-
),
110106
onPressed: () {
111107
if (_formKey.currentState.saveAndValidate()) {
112108
print('Valid');
@@ -115,6 +111,10 @@ class _SignupFormState extends State<SignupForm> {
115111
}
116112
print(_formKey.currentState.value);
117113
},
114+
child: Text(
115+
'Signup',
116+
style: TextStyle(color: Colors.white),
117+
),
118118
)
119119
],
120120
),

example/pubspec.yaml

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,11 @@ dependencies:
1212
sdk: flutter
1313
flutter_form_builder:
1414
path: ../
15-
widget_with_codeview: ^1.0.5
15+
# widget_with_codeview: ^1.0.5
1616
cupertino_icons: any
1717

1818
dependency_overrides:
19-
# modal_bottom_sheet: ^0.2.1+1-dev
2019
intl: ^0.17.0
21-
flutter_typeahead: ^3.0.0-nullsafety.0
22-
# flutter_datetime_picker:
23-
# git:
24-
# url: https://github.com/espresso3389/flutter_datetime_picker
2520

2621
dev_dependencies:
2722
flutter_test:

lib/l10n/messages_all.dart

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,8 @@ MessageLookupByLibrary _findExact(String localeName) {
7070
/// User programs should call this before using [localeName] for messages.
7171
Future<bool> initializeMessages(String localeName) async {
7272
var availableLocale = Intl.verifiedLocale(
73-
localeName,
74-
(locale) => _deferredLibraries[locale] != null,
75-
onFailure: (_) => null);
73+
localeName, (locale) => _deferredLibraries[locale] != null,
74+
onFailure: (_) => null);
7675
if (availableLocale == null) {
7776
return new Future.value(false);
7877
}
@@ -92,8 +91,8 @@ bool _messagesExistFor(String locale) {
9291
}
9392

9493
MessageLookupByLibrary _findGeneratedMessagesFor(String locale) {
95-
var actualLocale = Intl.verifiedLocale(locale, _messagesExistFor,
96-
onFailure: (_) => null);
94+
var actualLocale =
95+
Intl.verifiedLocale(locale, _messagesExistFor, onFailure: (_) => null);
9796
if (actualLocale == null) return null;
9897
return _findExact(actualLocale);
9998
}

lib/l10n/messages_de.dart

Lines changed: 29 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -23,27 +23,38 @@ class MessageLookup extends MessageLookupByLibrary {
2323

2424
static m1(max) => "Der Wert muss kleiner als oder gleich ${max} sein.";
2525

26-
static m2(maxLength) => "Der Wert muss eine Länge kleiner als oder gleich ${maxLength} haben.";
26+
static m2(maxLength) =>
27+
"Der Wert muss eine Länge kleiner als oder gleich ${maxLength} haben.";
2728

2829
static m3(min) => "Der Wert muss größer als oder gleich ${min} sein.";
2930

30-
static m4(minLength) => "Der Wert muss eine Länge größer als oder gleich ${minLength} haben.";
31+
static m4(minLength) =>
32+
"Der Wert muss eine Länge größer als oder gleich ${minLength} haben.";
3133

3234
final messages = _notInlinedMessages(_notInlinedMessages);
33-
static _notInlinedMessages(_) => <String, Function> {
34-
"creditCardErrorText" : MessageLookupByLibrary.simpleMessage("Für dieses Feld ist eine gültige Kreditkartennummer erforderlich."),
35-
"dateStringErrorText" : MessageLookupByLibrary.simpleMessage("Dieses Feld erfordert ein gültiges Datum."),
36-
"emailErrorText" : MessageLookupByLibrary.simpleMessage("Für dieses Feld ist eine gültige E-Mail-Adresse erforderlich."),
37-
"equalErrorText" : m0,
38-
"integerErrorText" : MessageLookupByLibrary.simpleMessage("Der Wert muss eine integer sein."),
39-
"ipErrorText" : MessageLookupByLibrary.simpleMessage("Dieses Feld erfordert eine gültige IP-Adresse."),
40-
"matchErrorText" : MessageLookupByLibrary.simpleMessage("Der Wert stimmt nicht mit dem Muster überein."),
41-
"maxErrorText" : m1,
42-
"maxLengthErrorText" : m2,
43-
"minErrorText" : m3,
44-
"minLengthErrorText" : m4,
45-
"numericErrorText" : MessageLookupByLibrary.simpleMessage("Der Wert muss numerisch sein."),
46-
"requiredErrorText" : MessageLookupByLibrary.simpleMessage("Dieses Feld kann nicht leer sein."),
47-
"urlErrorText" : MessageLookupByLibrary.simpleMessage("Für dieses Feld ist eine gültige URL-Adresse erforderlich.")
48-
};
35+
static _notInlinedMessages(_) => <String, Function>{
36+
"creditCardErrorText": MessageLookupByLibrary.simpleMessage(
37+
"Für dieses Feld ist eine gültige Kreditkartennummer erforderlich."),
38+
"dateStringErrorText": MessageLookupByLibrary.simpleMessage(
39+
"Dieses Feld erfordert ein gültiges Datum."),
40+
"emailErrorText": MessageLookupByLibrary.simpleMessage(
41+
"Für dieses Feld ist eine gültige E-Mail-Adresse erforderlich."),
42+
"equalErrorText": m0,
43+
"integerErrorText": MessageLookupByLibrary.simpleMessage(
44+
"Der Wert muss eine integer sein."),
45+
"ipErrorText": MessageLookupByLibrary.simpleMessage(
46+
"Dieses Feld erfordert eine gültige IP-Adresse."),
47+
"matchErrorText": MessageLookupByLibrary.simpleMessage(
48+
"Der Wert stimmt nicht mit dem Muster überein."),
49+
"maxErrorText": m1,
50+
"maxLengthErrorText": m2,
51+
"minErrorText": m3,
52+
"minLengthErrorText": m4,
53+
"numericErrorText": MessageLookupByLibrary.simpleMessage(
54+
"Der Wert muss numerisch sein."),
55+
"requiredErrorText": MessageLookupByLibrary.simpleMessage(
56+
"Dieses Feld kann nicht leer sein."),
57+
"urlErrorText": MessageLookupByLibrary.simpleMessage(
58+
"Für dieses Feld ist eine gültige URL-Adresse erforderlich.")
59+
};
4960
}

lib/l10n/messages_en.dart

Lines changed: 26 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -21,25 +21,35 @@ class MessageLookup extends MessageLookupByLibrary {
2121

2222
static m1(max) => "Value must be less than or equal to ${max}";
2323

24-
static m2(maxLength) => "Value must have a length less than or equal to ${maxLength}";
24+
static m2(maxLength) =>
25+
"Value must have a length less than or equal to ${maxLength}";
2526

2627
static m3(min) => "Value must be greater than or equal to ${min}.";
2728

28-
static m4(minLength) => "Value must have a length greater than or equal to ${minLength}";
29+
static m4(minLength) =>
30+
"Value must have a length greater than or equal to ${minLength}";
2931

3032
final messages = _notInlinedMessages(_notInlinedMessages);
31-
static _notInlinedMessages(_) => <String, Function> {
32-
"creditCardErrorText" : MessageLookupByLibrary.simpleMessage("This field requires a valid credit card number."),
33-
"dateStringErrorText" : MessageLookupByLibrary.simpleMessage("This field requires a valid date string."),
34-
"emailErrorText" : MessageLookupByLibrary.simpleMessage("This field requires a valid email address."),
35-
"ipErrorText" : MessageLookupByLibrary.simpleMessage("This field requires a valid IP."),
36-
"matchErrorText" : MessageLookupByLibrary.simpleMessage("Value does not match pattern."),
37-
"maxErrorText" : m1,
38-
"maxLengthErrorText" : m2,
39-
"minErrorText" : m3,
40-
"minLengthErrorText" : m4,
41-
"numericErrorText" : MessageLookupByLibrary.simpleMessage("Value must be numeric."),
42-
"requiredErrorText" : MessageLookupByLibrary.simpleMessage("This field cannot be empty."),
43-
"urlErrorText" : MessageLookupByLibrary.simpleMessage("This field requires a valid URL address.")
44-
};
33+
static _notInlinedMessages(_) => <String, Function>{
34+
"creditCardErrorText": MessageLookupByLibrary.simpleMessage(
35+
"This field requires a valid credit card number."),
36+
"dateStringErrorText": MessageLookupByLibrary.simpleMessage(
37+
"This field requires a valid date string."),
38+
"emailErrorText": MessageLookupByLibrary.simpleMessage(
39+
"This field requires a valid email address."),
40+
"ipErrorText": MessageLookupByLibrary.simpleMessage(
41+
"This field requires a valid IP."),
42+
"matchErrorText": MessageLookupByLibrary.simpleMessage(
43+
"Value does not match pattern."),
44+
"maxErrorText": m1,
45+
"maxLengthErrorText": m2,
46+
"minErrorText": m3,
47+
"minLengthErrorText": m4,
48+
"numericErrorText":
49+
MessageLookupByLibrary.simpleMessage("Value must be numeric."),
50+
"requiredErrorText":
51+
MessageLookupByLibrary.simpleMessage("This field cannot be empty."),
52+
"urlErrorText": MessageLookupByLibrary.simpleMessage(
53+
"This field requires a valid URL address.")
54+
};
4555
}

0 commit comments

Comments
 (0)