What's Changed
- [Breaking]: Handle selected Value on Client Side Issue: #191
Before
The package sets the selectedValue automatically inside the component, which leads to issues when navigating or selecting suggestions
SearchField(
hint: 'Basic SearchField',
dynamicHeight: true,
maxSuggestionBoxHeight: 300,
initialValue: SearchFieldListItem<String>('ABC'),
suggestions: dynamicHeightSuggestion
.map(SearchFieldListItem<String>.new)
.toList(),
suggestionState: Suggestion.expand,
),
After
Now the client should handle the selectedValue explicitly in the client code (consumer code) by using the onSuggestionTap callback. This approach simplifies the API and provides more accurate control over the internal state of the package.
var selectedValue = SearchFieldListItem<String>('ABC');
SearchField(
hint: 'Basic SearchField',
dynamicHeight: true,
maxSuggestionBoxHeight: 300,
// now the selectedValue is handled by the client
onSuggestionTap: (SearchFieldListItem<String> item) {
setState(() {
selectedValue = item;
});
},
selectedValue: selectedValue, // rename initialValue to selectedValue
suggestions: dynamicHeightSuggestion
.map(SearchFieldListItem<String>.new)
.toList(),
suggestionState: Suggestion.expand,
),
-
Fixes: Issue: #178, Issue: #155
-
Fixes: Issue: #151 Clarifies use of SuggestionAction and now defaults to
SuggestionState.unfocus
without having to useFocusNode
on client side. -
Fixes: Issue: #190 Keyboard navigation does not work after selecting a suggestion.
Huge thanks to all contributors and supporters.
Happy Thanksgiving! 🦃
- add contextmenubuilder property by @maheshj01 in #189
- [regression] Fix: Keyboard navigation does not work Issue: 183
- [Breaking] Proposal to handle selectedValue on the client side by @maheshj01 in #194
Full Changelog: v1.1.7...v1.2.0