Skip to content

Commit 207cf07

Browse files
committed
Fix bug where programmatic change of SearchableDropdown value doesnt affect UI. Fixes #627
1 parent 95926d3 commit 207cf07

File tree

4 files changed

+19
-5
lines changed

4 files changed

+19
-5
lines changed

CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
1+
## [4.1.0] - 18-Dec-2020
2+
* Added support for Portuguese (pt)
3+
* Added support for Japanese (ja)
4+
* Added `FormBuilderValidators.notEqual` validator
5+
* Fix bug in `RadioGroup` where reset and didChange doesnt affect UI. Fixes #646, Fixes #647
6+
* Image picker fix: Added null-safe spread operator for `field.value`. Fixes #607
7+
* Fixed focus issue in `ChipsInput`
8+
* Fixed bug `SearchableDropdown` where setting value programmatically does not update UI. Fixes #627
9+
* Upgraded flutter_typeahead to 1.9.1.
10+
11+
112
## [4.0.2] - 27-Nov-2020
213
* Fixed issue in Typeahead field where didChange not call and onChanged fired. Closes #595
314
* Fixed issue where french not included in list of supported languages & translations not working. Closes #561

lib/src/fields/form_builder_searchable_dropdown.dart

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,7 @@ class FormBuilderSearchableDropdown<T> extends FormBuilderField<T> {
165165
return InputDecorator(
166166
decoration: state.decoration(),
167167
child: dropdown_search.DropdownSearch<T>(
168+
key: ValueKey(state.value), //Hack to rebuild when didChange is called
168169
items: items,
169170
maxHeight: 300,
170171
onFind: onFind,
@@ -184,8 +185,9 @@ class FormBuilderSearchableDropdown<T> extends FormBuilderField<T> {
184185
dropdownBuilderSupportsNullItem:
185186
dropdownBuilderSupportsNullItem,
186187
dropDownButton: dropDownButton,
187-
dropdownSearchDecoration:
188-
InputDecoration.collapsed(hintText: hint),
188+
dropdownSearchDecoration: InputDecoration.collapsed(
189+
hintText: hint,
190+
),
189191
emptyBuilder: emptyBuilder,
190192
errorBuilder: errorBuilder,
191193
filterFn: filterFn,

lib/src/form_builder_field.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,7 @@ class FormBuilderFieldState<F extends FormBuilderField<T>, T>
180180
FocusScope.of(context).requestFocus(effectiveFocusNode);
181181
}
182182

183+
// FIXME: This could be a getter instead of a classic function
183184
InputDecoration decoration() => widget.decoration.copyWith(
184185
errorText: widget.decoration.errorText ?? errorText,
185186
);

pubspec.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: flutter_form_builder
22
description: This package helps in creation of forms in Flutter by removing the boilerplate code, reusing validation, react to changes, and collect final user input.
3-
version: 4.0.2+1
3+
version: 4.1.0
44
homepage: https://github.com/danvick/flutter_form_builder
55

66
environment:
@@ -18,13 +18,13 @@ dependencies:
1818
date_range_picker: ^1.0.6
1919
datetime_picker_formfield: ^1.0.0
2020
dropdown_search: ^0.4.8
21-
file_picker: ^2.1.0
21+
file_picker: ^2.1.4
2222
flutter_colorpicker: ^0.3.4
2323
flutter_chips_input: ^1.9.5
2424
flutter_datetime_picker: ^1.4.0
2525
flutter_touch_spin: ^1.0.1
2626
flutter_typeahead: ^1.9.1
27-
image_picker: ^0.6.7+14
27+
image_picker: ^0.6.7+17
2828
image_picker_for_web: ^0.1.0+2
2929
intl: ^0.16.1
3030
permission_handler: ^5.0.1+1

0 commit comments

Comments
 (0)