delayed_autocomplete 0.0.3 delayed_autocomplete: ^0.0.3 copied to clipboard
A simple autocomplete widget for Flutter that shows suggestion with a delay.
A simple autocomplete widget for Flutter that shows suggestion with a delay.
Features #
- Delay for showing suggestions
- Easy to customize design
- Easy to use apis
Getting Started #
Import the following package in your dart file
import 'package:delayed_autocomplete/delayed_autocomplete.dart';
Then Usage #
DeyaledAutocomplete(
// how much time you wanna wait before getting and showing suggestions
delayinMilliseconds: 1000,
hintText: "Search",
borderColor: Colors.blue,
// this is the widget that will be shown in the list
itemWidget: (dynamic object) {
String name = object as String;
return Container(
height: 50,
child: Center(
child: Text(name),
),
);
},
toDo: (String suggestion) {
List<String> suggestions = [
"Apple",
"Banana",
"Orange",
"Pineapple",
"Mango"
];
List<String> finallist = [];
for (String s in suggestions) {
if (s.toLowerCase().contains(suggestion.toLowerCase())) {
finallist.add(s);
}
}
return finallist; // this list's items must be of same type as the object you passed in the itemWidget
},
)