Skip to content

Commit a07cc0e

Browse files
committed
Renamed attribute to name
1 parent 265013e commit a07cc0e

27 files changed

+117
-119
lines changed

example/lib/sources/complete_form.dart

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ class CompleteFormState extends State<CompleteForm> {
4747
child: Column(
4848
children: <Widget>[
4949
FormBuilderFilterChip(
50-
attribute: 'filter_chip',
50+
name: 'filter_chip',
5151
decoration: InputDecoration(
5252
labelText: 'Select many options',
5353
),
@@ -65,7 +65,7 @@ class CompleteFormState extends State<CompleteForm> {
6565
],
6666
),
6767
FormBuilderChoiceChip(
68-
attribute: 'choice_chip',
68+
name: 'choice_chip',
6969
decoration: InputDecoration(
7070
labelText: 'Select an option',
7171
),
@@ -83,14 +83,14 @@ class CompleteFormState extends State<CompleteForm> {
8383
],
8484
),
8585
FormBuilderColorPickerField(
86-
attribute: 'color_picker',
86+
name: 'color_picker',
8787
// initialValue: Colors.yellow,
8888
colorPickerType: ColorPickerType.MaterialPicker,
8989
decoration: InputDecoration(labelText: 'Pick Color'),
9090
),
9191
FormBuilderChipsInput(
9292
decoration: InputDecoration(labelText: 'Chips'),
93-
attribute: 'chips_test',
93+
name: 'chips_test',
9494
onChanged: _onChanged,
9595
initialValue: [
9696
Contact('Andrew', '[email protected]',
@@ -142,7 +142,7 @@ class CompleteFormState extends State<CompleteForm> {
142142
},
143143
),
144144
FormBuilderDateTimePicker(
145-
attribute: 'date',
145+
name: 'date',
146146
inputType: InputType.time,
147147
decoration: InputDecoration(
148148
labelText: 'Appointment Time',
@@ -151,7 +151,7 @@ class CompleteFormState extends State<CompleteForm> {
151151
pickerType: PickerType.cupertino,
152152
),
153153
FormBuilderDateRangePicker(
154-
attribute: 'date_range',
154+
name: 'date_range',
155155
firstDate: DateTime(1970),
156156
lastDate: DateTime(2030),
157157
format: DateFormat('yyyy-MM-dd'),
@@ -163,7 +163,7 @@ class CompleteFormState extends State<CompleteForm> {
163163
),
164164
),
165165
FormBuilderSlider(
166-
attribute: 'slider',
166+
name: 'slider',
167167
validator: FormBuilderValidators.compose([
168168
FormBuilderValidators.min(context, 6),
169169
]),
@@ -179,7 +179,7 @@ class CompleteFormState extends State<CompleteForm> {
179179
),
180180
),
181181
FormBuilderRangeSlider(
182-
attribute: 'range_slider',
182+
name: 'range_slider',
183183
validator: FormBuilderValidators.compose(
184184
[FormBuilderValidators.min(context, 6)]),
185185
onChanged: _onChanged,
@@ -194,7 +194,7 @@ class CompleteFormState extends State<CompleteForm> {
194194
),
195195
),
196196
FormBuilderCheckbox(
197-
attribute: 'accept_terms',
197+
name: 'accept_terms',
198198
initialValue: false,
199199
onChanged: _onChanged,
200200
title: RichText(
@@ -226,7 +226,7 @@ class CompleteFormState extends State<CompleteForm> {
226226
FormBuilderTextField(
227227
key: _ageKey,
228228
autovalidate: true,
229-
attribute: 'age',
229+
name: 'age',
230230
decoration: InputDecoration(
231231
labelText: 'Age',
232232
suffixIcon: _ageHasError
@@ -253,7 +253,7 @@ class CompleteFormState extends State<CompleteForm> {
253253
FormBuilderDropdown(
254254
key: _genderKey,
255255
// autovalidate: true,
256-
attribute: 'gender',
256+
name: 'gender',
257257
decoration: InputDecoration(
258258
labelText: 'Gender',
259259
suffix: _genderHasError
@@ -283,7 +283,7 @@ class CompleteFormState extends State<CompleteForm> {
283283
decoration: InputDecoration(
284284
labelText: 'Country',
285285
),
286-
attribute: 'country',
286+
name: 'country',
287287
onChanged: _onChanged,
288288
itemBuilder: (context, country) {
289289
return ListTile(
@@ -312,7 +312,7 @@ class CompleteFormState extends State<CompleteForm> {
312312
decoration: InputDecoration(
313313
labelText: 'My chosen language',
314314
),
315-
attribute: 'best_language',
315+
name: 'best_language',
316316
onChanged: _onChanged,
317317
validator: FormBuilderValidators.compose(
318318
[FormBuilderValidators.required(context)]),
@@ -327,7 +327,7 @@ class CompleteFormState extends State<CompleteForm> {
327327
FormBuilderSegmentedControl(
328328
decoration:
329329
InputDecoration(labelText: 'Movie Rating (Archer)'),
330-
attribute: 'movie_rating',
330+
name: 'movie_rating',
331331
// initialValue: 1,
332332
// textStyle: TextStyle(fontWeight: FontWeight.bold),
333333
options: List.generate(5, (i) => i + 1)
@@ -343,13 +343,13 @@ class CompleteFormState extends State<CompleteForm> {
343343
),
344344
FormBuilderSwitch(
345345
title: Text('I Accept the tems and conditions'),
346-
attribute: 'accept_terms_switch',
346+
name: 'accept_terms_switch',
347347
initialValue: true,
348348
onChanged: _onChanged,
349349
),
350350
FormBuilderTouchSpin(
351-
decoration: InputDecoration(labelText: 'Stepper'),
352-
attribute: 'stepper',
351+
decoration: InputDecoration(labelText: 'TouchSpin'),
352+
name: 'touch_spin',
353353
initialValue: 10,
354354
step: 1,
355355
iconSize: 48.0,
@@ -358,7 +358,7 @@ class CompleteFormState extends State<CompleteForm> {
358358
),
359359
FormBuilderRating(
360360
decoration: InputDecoration(labelText: 'Rate this form'),
361-
attribute: 'rate',
361+
name: 'rate',
362362
iconSize: 32.0,
363363
initialValue: 1.0,
364364
max: 5.0,
@@ -367,7 +367,7 @@ class CompleteFormState extends State<CompleteForm> {
367367
FormBuilderCheckboxGroup(
368368
decoration:
369369
InputDecoration(labelText: 'The language of my people'),
370-
attribute: 'languages',
370+
name: 'languages',
371371
initialValue: ['Dart'],
372372
options: [
373373
FormBuilderFieldOption(value: 'Dart'),
@@ -388,19 +388,19 @@ class CompleteFormState extends State<CompleteForm> {
388388
labelText: 'Signature',
389389
border: OutlineInputBorder(),
390390
),
391-
attribute: 'signature',
391+
name: 'signature',
392392
border: Border.all(color: Colors.green),
393393
onChanged: _onChanged,
394394
),
395395
FormBuilderImagePicker(
396-
attribute: 'photos',
396+
name: 'photos',
397397
decoration: InputDecoration(labelText: 'Pick Photos'),
398398
maxImages: 1,
399399
),
400400
SizedBox(height: 15),
401401
FormBuilderCountryPicker(
402402
initialValue: 'Germany',
403-
attribute: 'country',
403+
name: 'country',
404404
decoration: InputDecoration(
405405
border: OutlineInputBorder(), labelText: 'Country'),
406406
validator: FormBuilderValidators.compose([
@@ -410,7 +410,7 @@ class CompleteFormState extends State<CompleteForm> {
410410
),
411411
SizedBox(height: 15),
412412
FormBuilderPhoneField(
413-
attribute: 'phone_number',
413+
name: 'phone_number',
414414
initialValue: '+254',
415415
// defaultSelectedCountryIsoCode: 'KE',
416416
cursorColor: Colors.black,
@@ -431,7 +431,7 @@ class CompleteFormState extends State<CompleteForm> {
431431
/*SizedBox(height: 15),
432432
FormBuilderSignaturePad(
433433
decoration: InputDecoration(labelText: 'Signature'),
434-
attribute: 'signature',
434+
name: 'signature',
435435
// height: 250,
436436
clearButtonText: 'Start Over',
437437
onChanged: _onChanged,

lib/src/fields/form_builder_checkbox.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class FormBuilderCheckbox extends FormBuilderField<bool> {
1414
FormBuilderCheckbox({
1515
//From Super
1616
Key key,
17-
@required String attribute,
17+
@required String name,
1818
FormFieldValidator validator,
1919
bool initialValue,
2020
bool readOnly = false,
@@ -36,7 +36,7 @@ class FormBuilderCheckbox extends FormBuilderField<bool> {
3636
}) : super(
3737
key: key,
3838
initialValue: initialValue,
39-
attribute: attribute,
39+
name: name,
4040
validator: validator,
4141
valueTransformer: valueTransformer,
4242
onChanged: onChanged,

lib/src/fields/form_builder_checkbox_group.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ class FormBuilderCheckboxGroup<T> extends FormBuilderField<List<T>> {
99
FormBuilderCheckboxGroup({
1010
Key key,
1111
//From Super
12-
@required String attribute,
12+
@required String name,
1313
FormFieldValidator validator,
1414
List<T> initialValue,
1515
bool readOnly = false,
@@ -43,7 +43,7 @@ class FormBuilderCheckboxGroup<T> extends FormBuilderField<List<T>> {
4343
}) : super(
4444
key: key,
4545
initialValue: initialValue,
46-
attribute: attribute,
46+
name: name,
4747
validator: validator,
4848
valueTransformer: valueTransformer,
4949
onChanged: onChanged,

lib/src/fields/form_builder_checkbox_list.dart

Lines changed: 27 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class FormBuilderCheckboxList<T> extends FormBuilderField<List<T>> {
1313
FormBuilderCheckboxList({
1414
Key key,
1515
//From Super
16-
@required String attribute,
16+
@required String name,
1717
FormFieldValidator validator,
1818
List<T> initialValue,
1919
bool readOnly = false,
@@ -33,7 +33,7 @@ class FormBuilderCheckboxList<T> extends FormBuilderField<List<T>> {
3333
}) : super(
3434
key: key,
3535
initialValue: initialValue,
36-
attribute: attribute,
36+
name: name,
3737
validator: validator,
3838
valueTransformer: valueTransformer,
3939
onChanged: onChanged,
@@ -48,33 +48,31 @@ class FormBuilderCheckboxList<T> extends FormBuilderField<List<T>> {
4848
var checkboxList = [];
4949

5050
for (var i = 0; i < options.length; i++) {
51-
checkboxList.addAll(
52-
[
53-
CheckboxListTile(
54-
value: state.value.contains(options[i].value),
55-
title: options[i],
56-
onChanged: state.readOnly
57-
? null
58-
: (val) {
59-
var currentValue = [...state.value];
60-
if (!currentValue.contains(options[i].value)) {
61-
currentValue.add(options[i].value);
62-
} else {
63-
currentValue.remove(options[i].value);
64-
}
65-
state.requestFocus();
66-
state.didChange(currentValue);
67-
},
68-
dense: true,
69-
isThreeLine: false,
70-
controlAffinity: controlAffinity,
71-
// secondary: secondary,
72-
activeColor: activeColor,
73-
checkColor: checkColor,
74-
),
75-
Divider(height: 0.0),
76-
],
77-
);
51+
checkboxList.addAll([
52+
CheckboxListTile(
53+
value: state.value.contains(options[i].value),
54+
title: options[i],
55+
onChanged: state.readOnly
56+
? null
57+
: (val) {
58+
var currentValue = [...state.value];
59+
if (!currentValue.contains(options[i].value)) {
60+
currentValue.add(options[i].value);
61+
} else {
62+
currentValue.remove(options[i].value);
63+
}
64+
state.requestFocus();
65+
state.didChange(currentValue);
66+
},
67+
dense: true,
68+
isThreeLine: false,
69+
controlAffinity: controlAffinity,
70+
// secondary: secondary,
71+
activeColor: activeColor,
72+
checkColor: checkColor,
73+
),
74+
Divider(height: 0.0),
75+
]);
7876
}
7977
return InputDecorator(
8078
decoration: decoration.copyWith(

lib/src/fields/form_builder_chips_input.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class FormBuilderChipsInput<T> extends FormBuilderField<List<T>> {
2424
FormBuilderChipsInput({
2525
Key key,
2626
//From Super
27-
@required String attribute,
27+
@required String name,
2828
FormFieldValidator validator,
2929
List<T> initialValue = const [],
3030
bool readOnly = false,
@@ -55,7 +55,7 @@ class FormBuilderChipsInput<T> extends FormBuilderField<List<T>> {
5555
}) : super(
5656
key: key,
5757
initialValue: initialValue,
58-
attribute: attribute,
58+
name: name,
5959
validator: validator,
6060
valueTransformer: valueTransformer,
6161
onChanged: onChanged,

lib/src/fields/form_builder_choice_chips.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class FormBuilderChoiceChip<T> extends FormBuilderField<T> {
3131
FormBuilderChoiceChip({
3232
Key key,
3333
//From Super
34-
@required String attribute,
34+
@required String name,
3535
FormFieldValidator validator,
3636
T initialValue,
3737
bool readOnly = false,
@@ -68,7 +68,7 @@ class FormBuilderChoiceChip<T> extends FormBuilderField<T> {
6868
}) : super(
6969
key: key,
7070
initialValue: initialValue,
71-
attribute: attribute,
71+
name: name,
7272
validator: validator,
7373
valueTransformer: valueTransformer,
7474
onChanged: onChanged,

lib/src/fields/form_builder_color_picker.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class FormBuilderColorPickerField extends FormBuilderField<Color> {
3232

3333
FormBuilderColorPickerField({
3434
Key key,
35-
@required String attribute,
35+
@required String name,
3636
Color initialValue,
3737
FormFieldValidator validator,
3838
bool enabled = true,
@@ -76,7 +76,7 @@ class FormBuilderColorPickerField extends FormBuilderField<Color> {
7676
}) : super(
7777
key: key,
7878
initialValue: initialValue,
79-
attribute: attribute,
79+
name: name,
8080
validator: validator,
8181
valueTransformer: valueTransformer,
8282
onChanged: onChanged,

lib/src/fields/form_builder_country_picker.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class FormBuilderCountryPicker extends FormBuilderField<String> {
3232
FormBuilderCountryPicker({
3333
Key key,
3434
//From Super
35-
@required String attribute,
35+
@required String name,
3636
FormFieldValidator validator,
3737
String initialValue,
3838
bool readOnly = false,
@@ -71,7 +71,7 @@ class FormBuilderCountryPicker extends FormBuilderField<String> {
7171
super(
7272
key: key,
7373
initialValue: initialValue,
74-
attribute: attribute,
74+
name: name,
7575
validator: validator,
7676
valueTransformer: valueTransformer,
7777
onChanged: onChanged,

0 commit comments

Comments
 (0)