Skip to content

Lorenzobettega/simplesearchdropdown

Repository files navigation

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:

Add Mode

Delete Mode:

Delete Mode

Search:

Search Feature

1. Single SearchDropDown

    SearchDropDown(
        listItens: listitems,
        onDeleteItem: removeItem, 
        onAddItem: addItem,
        addMode: true,
        deleteMode: true,
        updateSelectedItem: updateSelectedItem,
    ),

Single Menu

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'),
    ),

Multi Menu

Multi Menu Selection

License

License

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published