एक फ्लटर पैकेज जो आपके ऐप को कस्टमाइज़ किए गए ड्रॉपडाउन के साथ बढ़ावा देने के लिए डिज़ाइन किया गया है, जिसमें सूची डेटा सर्च, नेटवर्क सर्च और मल्टी-सेलेक्शन शामिल है।
सार्वजनिक जानकारी से बना चयन मार्गदर्शन। केवल संदर्भ हेतु।
dropdown_flutter एक Flutter पैकेज है जो कस्टमाइज़ेबल ड्रॉपडाउन घटक प्रदान करता है, जिसमें सर्च करने योग्य सूचियों, नेटवर्क-आधारित सर्च और मल्टी-सीलेक्शन का समर्थन होता है। यह फ़िल्टरिंग और डायनामिक लोडिंग के माध्यम से बड़े डेटासेट से प्रभावी डेटा चयन के लिए उपयोगकर्ता अनुभव को बढ़ाता है। यह पैकेज सभी प्रमुख प्लेटफॉर्म जैसे Android, iOS, Web, macOS, Windows और Linux में संगत है, जिससे यह क्रॉस-प्लेटफॉर्म एप्लिकेशन के लिए आदर्श है। साफ़ API और लचीले डिज़ाइन के साथ, यह Flutter ऐप्स में उन्नत ड्रॉपडाउन कार्यक्षमता को एकीकृत करने को सरल बनाता है।
उपयोग
बड़े डेटासेट के साथ फॉर्म इनपुट्स
API से डायनामिक डेटा चयन
डैशबोर्ड में बहु-चयन फ़िल्टर
एडमिन पैनल में खोजयोग्य ड्रॉपडाउन
उपयोगकर्ता पसंदीदा चयनकर्ता
मुख्य विशेषताएँ
खोजयो जा सकने सूची इनपुट
नेटवर्क-आधारित खोज समर्थन
बहु-चयन क्षमता
क्रॉस-प्लेटफॉर्म संगतता
कस्टमाइज़ेबल यूआई स्टाइलिंग
रियल-टाइम फ़िल्टरिंग
इनके लिए उपयुक्त
डेटा-भारी फॉर्म बनाने वाले डेवलपर्स
गतिशील ड्रॉपडाउन की आवश्यकता वाले ऐप
क्रॉस-प्लेटफॉर्म Flutter प्रोजेक्ट्स
उपयोगकर्ता इंटरफेस कें ध्यान में रखते हुए एप्लिकेशन डिज़ाइनर
पुनः उपयोगी ड्रॉपडाउन घटकों की आवश्यकता वाली टीमें
विचार योग्य बातें
बड़े डेटासेट के लिए सावधानीपूर्वक राज्य प्रबंधन की आवश्यकता होती है
जटिल थीम के लिए अतिरिक्त स्टाइलिंग की आवश्यकता हो सकती है
नेटवर्क सर्च कार्यान्वयन बाह्य API संरचना पर निर्भर करता है
सीमित आंतरिक सत्यापन
बहुत बड़ी सूचियों के साथ प्रदर्शन प्रभाव जब पेजेशन नहीं है
मूल README
संबंधित सोर्स रिपॉज़िटरी के मूल README का स्नैपशॉट। नवीनतम सामग्री के लिए रिपॉज़िटरी देखें।
Dropdown Flutter
A customizable Flutter dropdown — search, network search, multi-select and form validation built in.
Install
Requires Flutter 3.27+ and Dart 3.6+. The original
custom_dropdown.dart import remains supported.
That is the whole setup — no builders, controllers or config required.
Constructors
Constructor
Use it for
DropdownFlutter()
A plain list of items
.search()
Filtering a local list as the user types
.searchRequest()
Fetching results from an API
.multiSelect()
Selecting several items with checkboxes
.multiSelectSearch()
Multi-select over a filtered local list
.multiSelectSearchRequest()
Multi-select over API results
Choose the constructor for your data source and selection mode. Search options
apply to search constructors; select-all and list validation apply to multi-select.
The multiSelect* variants report through onListChanged; the rest use
onChanged.
Screenshots
Multi-select
Grouped
Highlighting
Dark theme
Usage
Search — local and network
Plain String items search out of the box. For your own type, mix in
CustomDropdownListFilter and decide what counts as a match.
classMemberwithCustomDropdownListFilter{
constMember(this.name, this.role);
finalString name;
finalString role;
// toString() supplies the row label; filter() decides what matches.@overrideStringtoString() => name;
@overrideboolfilter(String q) => name.toLowerCase().contains(q.toLowerCase()) ||
role.toLowerCase().contains(q.toLowerCase()); // "engineer" finds them all
}
DropdownFlutter<Member>.search(items: members, onChanged: print);
DropdownFlutter<Member>.searchRequest( // same, but from an API
futureRequest: (query) async => api.searchMembers(query),
futureRequestDelay: constDuration(milliseconds: 300),
onChanged: print,
);
Validation and controllers
final controller = SingleSelectController<String?>('Medium');
// MultiSelectController<String>(['Medium']) for multi-selectDropdownFlutter<String>(
items: priorities,
controller: controller, // read and set from anywhere
validator: (value) => value == null ? 'Required' : null,
validateOnChange: true, // listValidator for multi-select
onChanged: print,
);
controller.value = 'High';
controller.clear();
Custom rows
toString() gives the default label. For anything richer, supply a
listItemBuilder — headerBuilder, hintBuilder and noResultFoundBuilder
work the same way.
The features below are opt-in. Default surfaces and text follow the app theme;
fields support Tab focus and Enter/Space activation. Escape dismisses a menu and
returns focus to the field. Multi-select menus include a selection count and
Done button by default; choices are applied immediately, and Done closes the menu.
Use doneText to localize its label or showMultiSelectFooter: false to hide it.
Property
Effect
groupBy
Splits the list into labelled sections
highlightMatchedText
Emphasises the matched substring in results
recentSelectionsMaxCount
Pins recently picked items to the top
showSelectAll
Adds a select-all / clear-all row (multi-select)
selectAllText / clearAllText
Relabel that row
enableKeyboardNavigation
Arrow keys move, Enter selects, Escape closes
enableHapticFeedback
Light impact on open, click on select
animationDuration / animationCurve
Tunes the open/close animation
DropdownFlutter<Member>(
items: members,
groupBy: (member) => member.team, // any combination works
recentSelectionsMaxCount: 3,
enableKeyboardNavigation: true,
onChanged: print,
)
Styling
decoration covers colors, borders, shadows and text styles; the builders
replace widgets outright. Colors fall back to the ambient ColorScheme, so
dropdowns follow a dark theme with no extra configuration.
Size is controlled by overlayHeight, listItemPadding and listItemHeight
— the last defaults to null so rows fit their content; setting it lets the list
scroll more efficiently. Menus also respect available viewport space and keyboard
insets, including short lists with tall custom rows.
State and lifecycle
Create controllers once in State, and dispose them in your dispose() method.
The dropdown only disposes controllers it creates itself. Controllers may be
replaced or removed during rebuilds.
initialItem / initialItems seed an uncontrolled dropdown. Changing these
properties resets its selection; with a controller, set controller.value.
Do not supply both a controller and initial selection.
Multi-select values are immutable, duplicate-free snapshots. Use add, remove,
clear, or assign a new list to value; do not mutate controller.value.
Local initial selections must all belong to items. Custom objects should
implement consistent == and hashCode. Replace item lists when data changes.
If a selected item is removed, clear/update the controller explicitly.
FormState.reset() restores the initial selection (or the value present when
a controller was attached) and clears errors. Disabled fields do not validate.
Select-all acts on the current filtered/fetched results, preserving selections
outside those results. Clear-all removes only the current results.
Network search runs for nonempty queries. Clearing cancels pending debounce
timers and restores the supplied seed items. Old requests may finish, but
cannot overwrite newer results or update a disposed dropdown. Before typing,
an empty remote menu shows searchHintText instead of a no-results message.
Failed requests show a Retry action that repeats the current query. Customize
or localize this state with searchRequestErrorBuilder(context, error, retry);
raw exception details are not displayed by the default UI.
closeDropDownOnClearFilterSearch closes the menu when its clear button is used.
Reduced-motion settings skip the menu animation.
Builder callbacks have public types such as DropdownListItemBuilder<T> and
DropdownHeaderBuilder<T> for reusable builders.
Development
flutter pub get
flutter analyze
flutter testcd example
flutter test
Run the package regression/UX suites and example gallery together on an Android
emulator (from example/):
flutter emulators --launch <emulator-id>
flutter test integration_test/dropdown_flutter_test.dart -d <device-id>
Use flutter emulators and flutter devices to find the IDs.
CI checks the minimum supported Flutter version and stable Flutter.
All properties
Group
Properties
Items
items, initialItem / initialItems, excludeSelected, and the onChanged / onListChanged callbacks
Text
hintText, searchHintText, noResultFoundText, maxlines (line limit on the closed header)