File tree Expand file tree Collapse file tree 2 files changed +6
-5
lines changed Expand file tree Collapse file tree 2 files changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -30,6 +30,7 @@ class _ExerciseAutocompleterState extends State<ExerciseAutocompleter> {
30
30
children: [
31
31
TypeAheadField <Exercise >(
32
32
key: const Key ('field-typeahead' ),
33
+ debounceDuration: const Duration (milliseconds: 500 ),
33
34
decorationBuilder: (context, child) {
34
35
return Material (
35
36
type: MaterialType .card,
Original file line number Diff line number Diff line change @@ -113,6 +113,7 @@ class _IngredientTypeaheadState extends State<IngredientTypeahead> {
113
113
children: [
114
114
TypeAheadField <IngredientApiSearchEntry >(
115
115
controller: widget._ingredientController,
116
+ debounceDuration: const Duration (milliseconds: 500 ),
116
117
builder: (context, controller, focusNode) {
117
118
return TextFormField (
118
119
controller: controller,
@@ -124,11 +125,6 @@ class _IngredientTypeaheadState extends State<IngredientTypeahead> {
124
125
}
125
126
return null ;
126
127
},
127
- onChanged: (value) {
128
- widget.updateSearchQuery (value);
129
- // unselect to start a new search
130
- widget.unSelectIngredient ();
131
- },
132
128
decoration: InputDecoration (
133
129
prefixIcon: const Icon (Icons .search),
134
130
labelText: AppLocalizations .of (context).searchIngredient,
@@ -142,6 +138,10 @@ class _IngredientTypeaheadState extends State<IngredientTypeahead> {
142
138
return null ;
143
139
}
144
140
141
+ widget.updateSearchQuery (pattern);
142
+ // unselect to start a new search
143
+ widget.unSelectIngredient ();
144
+
145
145
return Provider .of <NutritionPlansProvider >(context, listen: false ).searchIngredient (
146
146
pattern,
147
147
languageCode: Localizations .localeOf (context).languageCode,
You can’t perform that action at this time.
0 commit comments