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) async {
//you can call your api here
return await _getSuggestions(suggestion);
// this list's items must be of same type as the object you passed in the itemWidget
},
)