clever_dropdown 1.0.1
clever_dropdown: ^1.0.1 copied to clipboard
A customizable Flutter dropdown widget with search, single & multi selection, and add-new-item support.
๐ฆ clever_dropdown #
A highly customizable and powerful dropdown widget for Flutter with:
- ๐ Real-time search
- โ Single & Multi-selection
- โ Support for adding new items
- โก Async item loading
clever_dropdownis perfect for forms, filters, settings, and searchable dropdown fields in Flutter apps โ works across Android, iOS, Web, and Desktop.
๐ Features #
- ๐น Single-selection dropdown
- ๐ธ Multi-selection with checkboxes
- ๐ Real-time filtering and search
- โ Dynamic "Add new" option
- ๐ Async data fetching
- โจ๏ธ Keyboard navigation (Arrow โ โ + Enter)
- ๐งฉ Custom styling (radius, color, icons, borders)
๐ฅ Installation #
Add this to your pubspec.yaml:
dependencies:
clever_dropdown: latest_version
๐ง Usage #
โ
Single Selection
CleverDropdown<String>(
items: ['Apple', 'Banana', 'Orange'],
value: 'Banana',
onChanged: (value) {
print('Selected: $value');
},
hintText: 'Select fruit',
isMultiple: false,
)
โ
Multi Selection
CleverDropdown<String>(
items: ['Red', 'Green', 'Blue'],
isMultiple: true, // Make this true
initialValues: ['Red'],
onChanged: (values) {
print('Selected Colors: $values');
},
hintText: 'Select colors',
)
๐ง Create New Item
CleverDropdown<String>(
...
onCreateTap: (newValue) {
print("Create tapped with value: $newValue");
// Add it to your backend or list
},
)
๐งพ Parameters #
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
items |
List<T> |
No | [] |
List of options for dropdown |
asyncItems |
Future<List<T>> Function() |
No | null |
Fetch items asynchronously |
hintText |
String |
No | 'Select' |
Placeholder text |
isMultiple |
bool |
No | false |
Enable multi-selection |
onChanged |
void Function(dynamic) |
Yes | null |
Callback for selection changes |
onCreateTap |
void Function(String) |
No | null |
Callback for adding new item (on Enter or tap) |
itemAsString |
String Function(T) |
No | null |
Converts item to displayable string |
enableAddItem |
bool |
No | false |
Allow adding new values dynamically |
maxListHeight |
double |
No | 200.0 |
Max height of dropdown list |
smoothBorderRadius |
SmoothBorderRadius |
No | default |
Custom smooth border radius using figma_squircle |
dropdownColor |
Color |
No | Colors.white |
Dropdown background color |
borderColor |
Color |
No | Colors.grey |
Outline border color |
showDropdownOnlyOnSearch |
bool |
No | false |
Show dropdown only when user types something |