File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -141,6 +141,7 @@ class FormBuilderPhoneFieldState extends State<FormBuilderPhoneField> {
141141
142142 @override
143143 void initState () {
144+ super .initState ();
144145 _formState = FormBuilder .of (context);
145146 _formState? .registerFieldKey (widget.attribute, _fieldKey);
146147 _initialValue = widget.initialValue ??
@@ -151,7 +152,6 @@ class FormBuilderPhoneFieldState extends State<FormBuilderPhoneField> {
151152 _selectedDialogCountry = CountryPickerUtils .getCountryByIsoCode (
152153 widget.defaultSelectedCountryIsoCode);
153154 _parsePhone ();
154- super .initState ();
155155 }
156156
157157 Future <void > _parsePhone () async {
@@ -167,8 +167,10 @@ class FormBuilderPhoneFieldState extends State<FormBuilderPhoneField> {
167167 _effectiveController.text = parseResult['national_number' ];
168168 }
169169 } catch (error) {
170+ print (error);
170171 _effectiveController.text = _initialValue.replaceFirst ('+' , '' );
171172 }
173+ setState (() {});
172174 }
173175 }
174176
@@ -183,7 +185,7 @@ class FormBuilderPhoneFieldState extends State<FormBuilderPhoneField> {
183185
184186 return FormField (
185187 key: _fieldKey,
186- initialValue: fullNumber ,
188+ initialValue: _initialValue ,
187189 autovalidate: widget.autovalidate,
188190 validator: (val) =>
189191 FormBuilderValidators .validateValidators (val, widget.validators),
You can’t perform that action at this time.
0 commit comments