@@ -117,6 +117,15 @@ class FormBuilderPhoneField extends FormBuilderField<String> {
117
117
/// By default this widget is `const Icon(Icons.arrow_drop_down)`
118
118
final Widget ? iconSelector;
119
119
120
+ /// View to display when search found no result
121
+ final Widget ? searchEmptyView;
122
+
123
+ /// Country picker button
124
+ final Widget Function (
125
+ Widget flag,
126
+ String countryCode,
127
+ )? countryPicker;
128
+
120
129
/// Creates field for international phone number input.
121
130
FormBuilderPhoneField ({
122
131
Key ? key,
@@ -184,6 +193,8 @@ class FormBuilderPhoneField extends FormBuilderField<String> {
184
193
this .priorityList,
185
194
this .itemBuilder,
186
195
this .iconSelector,
196
+ this .countryPicker,
197
+ this .searchEmptyView,
187
198
}) : assert (initialValue == null || controller == null ),
188
199
super (
189
200
key: key,
@@ -214,23 +225,30 @@ class FormBuilderPhoneField extends FormBuilderField<String> {
214
225
: state._openCountryPickerDialog ();
215
226
}
216
227
: null ,
217
- child: Row (
218
- children: < Widget > [
219
- iconSelector ?? const Icon (Icons .arrow_drop_down),
220
- const SizedBox (width: 10 ),
221
- CountryPickerUtils .getDefaultFlagImage (
222
- state._selectedDialogCountry,
223
- ),
224
- const SizedBox (width: 10 ),
225
- Text (
226
- '+${state ._selectedDialogCountry .phoneCode } ' ,
227
- style: Theme .of (state.context)
228
- .textTheme
229
- .subtitle1!
230
- .merge (style),
231
- ),
232
- ],
233
- ),
228
+ child: countryPicker != null
229
+ ? countryPicker (
230
+ CountryPickerUtils .getDefaultFlagImage (
231
+ state._selectedDialogCountry,
232
+ ),
233
+ '+${state ._selectedDialogCountry .phoneCode } ' ,
234
+ )
235
+ : Row (
236
+ children: < Widget > [
237
+ iconSelector ?? const Icon (Icons .arrow_drop_down),
238
+ const SizedBox (width: 10 ),
239
+ CountryPickerUtils .getDefaultFlagImage (
240
+ state._selectedDialogCountry,
241
+ ),
242
+ const SizedBox (width: 10 ),
243
+ Text (
244
+ '+${state ._selectedDialogCountry .phoneCode } ' ,
245
+ style: Theme .of (state.context)
246
+ .textTheme
247
+ .titleMedium!
248
+ .merge (style),
249
+ ),
250
+ ],
251
+ ),
234
252
),
235
253
Expanded (
236
254
child: TextField (
@@ -408,6 +426,7 @@ class _FormBuilderPhoneFieldState
408
426
searchInputDecoration:
409
427
InputDecoration (hintText: widget.searchText ?? 'Search...' ),
410
428
isSearchable: widget.isSearchable ?? true ,
429
+ searchEmptyView: widget.searchEmptyView,
411
430
title: widget.dialogTitle ??
412
431
Text (
413
432
'Select Your Phone Code' ,
0 commit comments