CustomSearchDropDown

A Flutter package for creating a custom search dropdown that allows users to search through a list of items and select one from the filtered results. It is generic, so you can use it with any type of data.

Features

  • Searchable dropdown with live filtering.
  • Customizable display text using a function.
  • Handles any type of item (generic type T).
  • Easy to integrate into your Flutter projects.

Installation

To use the CustomSearchDropDown in your Flutter project, add it as a dependency in your pubspec.yaml file.

dependencies:
  flutter:
    sdk: flutter
  custom_search_dropdown: ^1.0.0

## Example


 CustomSearchDropDown(
  labelText: labelText, // The label for the dropdown input field, e.g., "Select Item"
  items: data, // The list of items or data you want to populate the dropdown with. This could be a simple list or a list of models (e.g., list of objects).
  onChanged: (value) { 
    controller.text = value; // When an item is selected from the dropdown, set the selected value to the controller's text.
    Navigator.pop(context); // Close the dropdown selection screen (or popup).
  },
  displayText: (item) => item, // A function to return how each item in the list should be displayed. For simple lists, it just returns the item itself.
)

Libraries

searchdropdown