Skip to content

Commit d1defab

Browse files
committed
Purge removed fields from documentation
Remove migration guide from v3 to v4
1 parent a46f995 commit d1defab

File tree

1 file changed

+0
-135
lines changed

1 file changed

+0
-135
lines changed

README.md

Lines changed: 0 additions & 135 deletions
Original file line numberDiff line numberDiff line change
@@ -19,22 +19,6 @@ 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-
### Migrating from v3 to v4
23-
Improvements:
24-
* Internationalized default error texts for inbuilt validators - Help wanted to do even more in translating to more languages.
25-
* Ability to programmatically induce an error to a field - could be especially useful for server-side validation.
26-
* New field types including: SearchableDropdown and FilePickerField
27-
* Better composition of validators.
28-
29-
Breaking changes:
30-
* Rename `attribute` option in all fields to `name`.
31-
* `validators` attribute has been renamed to `validator` which takes Flutter's
32-
[FormFieldValidator]() object. To compose multiple `FormFieldValidator`s together, use
33-
`FormBuilderValidators.compose()` which takes a list of `FormFieldValidator` objects.
34-
* `FormBuilderValidators.requiredTrue` functionality has been replaced with `FormBuilderValidators.equal` which can be used to check equality of any `Object` or value
35-
* Due to its limited use, `FormBuilderCountryPicker` was removed from the package. Its functionality could be achieved with use of `FormBuilderSearchableDropdown` which is more extensible.
36-
* `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`.
37-
3822
### Example
3923
```dart
4024
final _formKey = GlobalKey<FormBuilderState>();
@@ -84,65 +68,6 @@ Widget build(BuildContext context) {
8468
value: 'Test 4', child: Text('Test 4')),
8569
],
8670
),
87-
FormBuilderColorPickerField(
88-
name: 'color_picker',
89-
// initialValue: Colors.yellow,
90-
colorPickerType: ColorPickerType.MaterialPicker,
91-
decoration: InputDecoration(labelText: 'Pick Color'),
92-
),
93-
FormBuilderChipsInput(
94-
decoration: InputDecoration(labelText: 'Chips'),
95-
name: 'chips_test',
96-
onChanged: _onChanged,
97-
initialValue: [
98-
Contact('Andrew', '[email protected]',
99-
'https://d2gg9evh47fn9z.cloudfront.net/800px_COLOURBOX4057996.jpg'),
100-
],
101-
maxChips: 5,
102-
findSuggestions: (String query) {
103-
if (query.isNotEmpty) {
104-
var lowercaseQuery = query.toLowerCase();
105-
return contacts.where((profile) {
106-
return profile.name
107-
.toLowerCase()
108-
.contains(query.toLowerCase()) ||
109-
profile.email
110-
.toLowerCase()
111-
.contains(query.toLowerCase());
112-
}).toList(growable: false)
113-
..sort((a, b) => a.name
114-
.toLowerCase()
115-
.indexOf(lowercaseQuery)
116-
.compareTo(b.name
117-
.toLowerCase()
118-
.indexOf(lowercaseQuery)));
119-
} else {
120-
return const <Contact>[];
121-
}
122-
},
123-
chipBuilder: (context, state, profile) {
124-
return InputChip(
125-
key: ObjectKey(profile),
126-
label: Text(profile.name),
127-
avatar: CircleAvatar(
128-
backgroundImage: NetworkImage(profile.imageUrl),
129-
),
130-
onDeleted: () => state.deleteChip(profile),
131-
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
132-
);
133-
},
134-
suggestionBuilder: (context, state, profile) {
135-
return ListTile(
136-
key: ObjectKey(profile),
137-
leading: CircleAvatar(
138-
backgroundImage: NetworkImage(profile.imageUrl),
139-
),
140-
title: Text(profile.name),
141-
subtitle: Text(profile.email),
142-
onTap: () => state.selectSuggestion(profile),
143-
);
144-
},
145-
),
14671
FormBuilderDateTimePicker(
14772
name: 'date',
14873
// onChanged: _onChanged,
@@ -239,66 +164,6 @@ Widget build(BuildContext context) {
239164
))
240165
.toList(),
241166
),
242-
FormBuilderTypeAhead(
243-
decoration: InputDecoration(
244-
labelText: 'Country',
245-
),
246-
name: 'country',
247-
onChanged: _onChanged,
248-
itemBuilder: (context, country) {
249-
return ListTile(
250-
title: Text(country),
251-
);
252-
},
253-
controller: TextEditingController(text: ''),
254-
initialValue: 'Uganda',
255-
suggestionsCallback: (query) {
256-
if (query.isNotEmpty) {
257-
var lowercaseQuery = query.toLowerCase();
258-
return allCountries.where((country) {
259-
return country.toLowerCase().contains(lowercaseQuery);
260-
}).toList(growable: false)
261-
..sort((a, b) => a
262-
.toLowerCase()
263-
.indexOf(lowercaseQuery)
264-
.compareTo(
265-
b.toLowerCase().indexOf(lowercaseQuery)));
266-
} else {
267-
return allCountries;
268-
}
269-
},
270-
),
271-
FormBuilderRadioList(
272-
decoration:
273-
InputDecoration(labelText: 'My chosen language'),
274-
name: 'best_language',
275-
onChanged: _onChanged,
276-
validator: FormBuilderValidators.compose(
277-
[FormBuilderValidators.required(context)]),
278-
options: ['Dart', 'Kotlin', 'Java', 'Swift', 'Objective-C']
279-
.map((lang) => FormBuilderFieldOption(
280-
value: lang,
281-
child: Text('$lang'),
282-
))
283-
.toList(growable: false),
284-
),
285-
FormBuilderTouchSpin(
286-
decoration: InputDecoration(labelText: 'Stepper'),
287-
name: 'stepper',
288-
initialValue: 10,
289-
step: 1,
290-
iconSize: 48.0,
291-
addIcon: Icon(Icons.arrow_right),
292-
subtractIcon: Icon(Icons.arrow_left),
293-
),
294-
FormBuilderRating(
295-
decoration: InputDecoration(labelText: 'Rate this form'),
296-
name: 'rate',
297-
iconSize: 32.0,
298-
initialValue: 1.0,
299-
max: 5.0,
300-
onChanged: _onChanged,
301-
),
302167
],
303168
),
304169
),

0 commit comments

Comments
 (0)