simple_search_dropdown 4.4.0 simple_search_dropdown: ^4.4.0 copied to clipboard
A dropdown that offers a search bar, multiple and single selections.
Search Dropdown #
Search DropDown is a dropdown that offers a search bar, multiple and single selections.
Import #
import 'package:simple_search_dropdown/simple_search_dropdown.dart';
Getting Started #
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.
Usage #
Features #
Add Mode:
Delete Mode:
Search:
1. Single SearchDropDown #
SearchDropDown(
listItens: listitems,
onDeleteItem: removeItem,
onAddItem: addItem,
addMode: true,
deleteMode: true,
updateSelectedItem: updateSelectedItem,
),
2. Multiple SearchDropDown #
MultipleSearchDropDown(
listItems: listitems,
onDeleteItem: removeItem,
onAddItem: addItem,
addMode: true,
deleteMode: true,
selectedItems: selectedMultipleItems,
updateSelectedItems: updateSelectedItems,
),
3. Reseting the dropdown to the unselected state: #
//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'),
),