Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/widgets/exercises/autocompleter.dart
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ class _ExerciseAutocompleterState extends State<ExerciseAutocompleter> {
children: [
TypeAheadField<Exercise>(
key: const Key('field-typeahead'),
debounceDuration: const Duration(milliseconds: 500),
decorationBuilder: (context, child) {
return Material(
type: MaterialType.card,
Expand Down
10 changes: 5 additions & 5 deletions lib/widgets/nutrition/widgets.dart
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ class _IngredientTypeaheadState extends State<IngredientTypeahead> {
children: [
TypeAheadField<IngredientApiSearchEntry>(
controller: widget._ingredientController,
debounceDuration: const Duration(milliseconds: 500),
builder: (context, controller, focusNode) {
return TextFormField(
controller: controller,
Expand All @@ -124,11 +125,6 @@ class _IngredientTypeaheadState extends State<IngredientTypeahead> {
}
return null;
},
onChanged: (value) {
widget.updateSearchQuery(value);
// unselect to start a new search
widget.unSelectIngredient();
},
decoration: InputDecoration(
prefixIcon: const Icon(Icons.search),
labelText: AppLocalizations.of(context).searchIngredient,
Expand All @@ -142,6 +138,10 @@ class _IngredientTypeaheadState extends State<IngredientTypeahead> {
return null;
}

widget.updateSearchQuery(pattern);
// unselect to start a new search
widget.unSelectIngredient();

return Provider.of<NutritionPlansProvider>(context, listen: false).searchIngredient(
pattern,
languageCode: Localizations.localeOf(context).languageCode,
Expand Down