Search DropDown is a dropdown that offers a search bar, multiple and single selections.
import 'package:simple_search_dropdown/simple_search_dropdown.dart';
This project is a widget to find items in a list without sacrifying beauty and usefulness:
- Different styles: Search DropDown can be customized with various styles, including colors, text styles, icons, and more.
- Multiple and single options: Search DropDown can be used to select multiple or single items.
- Add and Delete Mode: Search Dropdown accepts functions to add and delete items from the list inside it
- Compact and Simple: Search DropDown is very compact and takes up very little space on the screen.
SearchDropDown(
listItens: listitems,
onDeleteItem: removeItem,
onAddItem: addItem,
addMode: true,
deleteMode: true,
updateSelectedItem: updateSelectedItem,
),
MultipleSearchDropDown(
listItems: listitems,
onDeleteItem: removeItem,
onAddItem: addItem,
addMode: true,
deleteMode: true,
selectedItems: selectedMultipleItems,
updateSelectedItems: updateSelectedItems,
),
//create a key and add it to the dropdown:
final GlobalKey<SearchDropDownState> singleSearchKey = GlobalKey();
SearchDropDown(
listItens: listitems,
onDeleteItem: removeItem,
onAddItem: addItem,
addMode: true,
deleteMode: true,
updateSelectedItem: updateSelectedItem,
),
//create a function to clear the selection:
void clearSingleSelection() {
singleSearchKey.currentState?.clearSelection();
}
//assign it to a widget (like a button):
TextButton(
onPressed: clearSingleSelection,
child: const Text('Clear Single Selection'),
),