List<String> suggestons = ["USA", "UK", "Uganda", "Uruguay", "United Arab Emirates"];
Expanded(child: Autocomplete( optionsBuilder: (TextEditingValue textEditingValue){
if (textEditingValue.text == ''){
return const Iterable<String>.empty();
} else {
List<String> matches = <String>[];
matches.addAll(suggestons);
matches.retainWhere((s) {
return s.toLowerCase().contains(textEditingValue.text.toLowerCase());
});
return matches;
}
},
onSelected: (String selected){
print('Selection $selected');
},
)
Hasilnya
0 comments:
Post a Comment