@@ -87,41 +87,53 @@ class FormBuilderSearchableDropdown<T> extends FormBuilderField<T> {
87
87
88
88
final PopupProps <T > popupProps;
89
89
90
+ ///custom dropdown clear button icon properties
91
+ final IconButtonProps ? clearButtonProps;
92
+
93
+ /// style on which to base the label
94
+ final TextStyle ? dropdownSearchTextStyle;
95
+
96
+ ///custom dropdown icon button properties
97
+ final IconButtonProps ? dropdownButtonProps;
98
+
90
99
/// Creates field for selecting value(s) from a searchable list
91
- FormBuilderSearchableDropdown (
92
- {Key ? key,
93
- AutovalidateMode autovalidateMode = AutovalidateMode .disabled,
94
- bool enabled = true ,
95
- FocusNode ? focusNode,
96
- FormFieldSetter <T >? onSaved,
97
- FormFieldValidator <T >? validator,
98
- InputDecoration decoration = const InputDecoration (),
99
- required String name,
100
- T ? initialValue,
101
- ValueChanged <T ?>? onChanged,
102
- ValueTransformer <T ?>? valueTransformer,
103
- VoidCallback ? onReset,
104
- this .asyncItems,
105
- this .autoValidateMode,
106
- this .compareFn,
107
- this .dropdownBuilder,
108
- this .dropdownSearchDecoration,
109
- this .dropdownSearchTextAlign,
110
- this .dropdownSearchTextAlignVertical,
111
- this .filterFn,
112
- this .isFilteredOnline = false ,
113
- this .itemAsString,
114
- this .items,
115
- this .onBeforeChange,
116
- this .popupOnItemAdded,
117
- this .popupOnItemRemoved,
118
- this .popupSelectionWidget,
119
- this .selectedItem,
120
- this .selectedItems = const [],
121
- this .shouldRequestFocus = false ,
122
- this .showClearButton = false ,
123
- this .popupProps = const PopupProps .menu ()})
124
- : assert (T == String || compareFn != null ),
100
+ FormBuilderSearchableDropdown ({
101
+ Key ? key,
102
+ AutovalidateMode autovalidateMode = AutovalidateMode .disabled,
103
+ bool enabled = true ,
104
+ FocusNode ? focusNode,
105
+ FormFieldSetter <T >? onSaved,
106
+ FormFieldValidator <T >? validator,
107
+ InputDecoration decoration = const InputDecoration (),
108
+ required String name,
109
+ T ? initialValue,
110
+ ValueChanged <T ?>? onChanged,
111
+ ValueTransformer <T ?>? valueTransformer,
112
+ VoidCallback ? onReset,
113
+ this .asyncItems,
114
+ this .autoValidateMode,
115
+ this .compareFn,
116
+ this .dropdownBuilder,
117
+ this .dropdownSearchDecoration,
118
+ this .dropdownSearchTextAlign,
119
+ this .dropdownSearchTextAlignVertical,
120
+ this .filterFn,
121
+ this .isFilteredOnline = false ,
122
+ this .itemAsString,
123
+ this .items,
124
+ this .onBeforeChange,
125
+ this .popupOnItemAdded,
126
+ this .popupOnItemRemoved,
127
+ this .popupSelectionWidget,
128
+ this .selectedItem,
129
+ this .selectedItems = const [],
130
+ this .shouldRequestFocus = false ,
131
+ this .showClearButton = false ,
132
+ this .popupProps = const PopupProps .menu (),
133
+ this .clearButtonProps,
134
+ this .dropdownSearchTextStyle,
135
+ this .dropdownButtonProps,
136
+ }) : assert (T == String || compareFn != null ),
125
137
isMultiSelectionMode = false ,
126
138
dropdownBuilderMultiSelection = null ,
127
139
onBeforeChangeMultiSelection = null ,
@@ -147,28 +159,30 @@ class FormBuilderSearchableDropdown<T> extends FormBuilderField<T> {
147
159
return dropdown_search.DropdownSearch <T >(
148
160
// Hack to rebuild when didChange is called
149
161
key: UniqueKey (),
162
+ asyncItems: asyncItems,
163
+ clearButtonProps: clearButtonProps,
164
+ compareFn: compareFn,
165
+ enabled: state.enabled,
166
+ dropdownBuilder: dropdownBuilder,
167
+ dropdownButtonProps: dropdownButtonProps,
168
+ dropdownSearchDecoration: state.decoration,
169
+ dropdownSearchTextAlign: dropdownSearchTextAlign,
170
+ dropdownSearchTextAlignVertical: dropdownSearchTextAlignVertical,
171
+ dropdownSearchTextStyle: dropdownSearchTextStyle,
172
+ filterFn: filterFn,
173
+ isFilteredOnline: isFilteredOnline,
150
174
items: items,
175
+ itemAsString: itemAsString,
176
+ onBeforeChange: onBeforeChange,
151
177
onChanged: (value) {
152
178
if (shouldRequestFocus) {
153
179
state.requestFocus ();
154
180
}
155
181
state.didChange (value);
156
182
},
157
- enabled: state.enabled,
158
- autoValidateMode: autovalidateMode,
159
- compareFn: compareFn,
160
- dropdownBuilder: dropdownBuilder,
161
- dropdownSearchDecoration: state.decoration,
162
- filterFn: filterFn,
163
- isFilteredOnline: isFilteredOnline,
164
- itemAsString: itemAsString,
183
+ popupProps: popupProps,
165
184
selectedItem: state.value,
166
185
showClearButton: showClearButton,
167
- onBeforeChange: onBeforeChange,
168
- dropdownSearchTextAlign: dropdownSearchTextAlign,
169
- dropdownSearchTextAlignVertical: dropdownSearchTextAlignVertical,
170
- asyncItems: asyncItems,
171
- popupProps: popupProps,
172
186
);
173
187
},
174
188
);
0 commit comments