Skip to content

Commit

Permalink
Fix bug where programmatic change of SearchableDropdown value doesnt …
Browse files Browse the repository at this point in the history
…affect UI. Fixes #627
  • Loading branch information
danvick committed Dec 18, 2020
1 parent 95926d3 commit 207cf07
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 5 deletions.
11 changes: 11 additions & 0 deletions CHANGELOG.md
@@ -1,3 +1,14 @@
## [4.1.0] - 18-Dec-2020
* Added support for Portuguese (pt)
* Added support for Japanese (ja)
* Added `FormBuilderValidators.notEqual` validator
* Fix bug in `RadioGroup` where reset and didChange doesnt affect UI. Fixes #646, Fixes #647
* Image picker fix: Added null-safe spread operator for `field.value`. Fixes #607
* Fixed focus issue in `ChipsInput`
* Fixed bug `SearchableDropdown` where setting value programmatically does not update UI. Fixes #627
* Upgraded flutter_typeahead to 1.9.1.


## [4.0.2] - 27-Nov-2020
* Fixed issue in Typeahead field where didChange not call and onChanged fired. Closes #595
* Fixed issue where french not included in list of supported languages & translations not working. Closes #561
Expand Down
6 changes: 4 additions & 2 deletions lib/src/fields/form_builder_searchable_dropdown.dart
Expand Up @@ -165,6 +165,7 @@ class FormBuilderSearchableDropdown<T> extends FormBuilderField<T> {
return InputDecorator(
decoration: state.decoration(),
child: dropdown_search.DropdownSearch<T>(
key: ValueKey(state.value), //Hack to rebuild when didChange is called
items: items,
maxHeight: 300,
onFind: onFind,
Expand All @@ -184,8 +185,9 @@ class FormBuilderSearchableDropdown<T> extends FormBuilderField<T> {
dropdownBuilderSupportsNullItem:
dropdownBuilderSupportsNullItem,
dropDownButton: dropDownButton,
dropdownSearchDecoration:
InputDecoration.collapsed(hintText: hint),
dropdownSearchDecoration: InputDecoration.collapsed(
hintText: hint,
),
emptyBuilder: emptyBuilder,
errorBuilder: errorBuilder,
filterFn: filterFn,
Expand Down
1 change: 1 addition & 0 deletions lib/src/form_builder_field.dart
Expand Up @@ -180,6 +180,7 @@ class FormBuilderFieldState<F extends FormBuilderField<T>, T>
FocusScope.of(context).requestFocus(effectiveFocusNode);
}

// FIXME: This could be a getter instead of a classic function
InputDecoration decoration() => widget.decoration.copyWith(
errorText: widget.decoration.errorText ?? errorText,
);
Expand Down
6 changes: 3 additions & 3 deletions pubspec.yaml
@@ -1,6 +1,6 @@
name: flutter_form_builder
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.
version: 4.0.2+1
version: 4.1.0
homepage: https://github.com/danvick/flutter_form_builder

environment:
Expand All @@ -18,13 +18,13 @@ dependencies:
date_range_picker: ^1.0.6
datetime_picker_formfield: ^1.0.0
dropdown_search: ^0.4.8
file_picker: ^2.1.0
file_picker: ^2.1.4
flutter_colorpicker: ^0.3.4
flutter_chips_input: ^1.9.5
flutter_datetime_picker: ^1.4.0
flutter_touch_spin: ^1.0.1
flutter_typeahead: ^1.9.1
image_picker: ^0.6.7+14
image_picker: ^0.6.7+17
image_picker_for_web: ^0.1.0+2
intl: ^0.16.1
permission_handler: ^5.0.1+1
Expand Down

0 comments on commit 207cf07

Please sign in to comment.