dropdown_plus_bloc library
dropdown_plus — A customizable Flutter dropdown package with BLoC integration.
This library provides two powerful dropdown widgets:
- SearchableDropdownPlus: A single-select searchable dropdown with BLoC support.
- MultiSelectDropdownPlus: A multi-select dropdown with BLoC support and chip display.
Quick Start
import 'package:dropdown_plus/dropdown_plus.dart';
Single Select
SearchableDropdownPlus<MyCubit, MyState>(
cubit: myCubit,
hintText: 'Search and select...',
onSearch: myCubit.search,
onStateChange: (state, updateList, updateLoading) {
if (state is MyLoadedState) {
updateList(state.items.map((e) => DropdownItem(value: e, label: e.name)).toList());
updateLoading(false);
} else if (state is MyLoadingState) {
updateLoading(true);
}
},
onSelectionChanged: (item) => print('Selected: ${item.label}'),
);
Multi Select
MultiSelectDropdownPlus<MyCubit, MyState>(
cubit: myCubit,
hintText: 'Select items...',
onSearch: myCubit.search,
onStateChange: (state, updateList, updateLoading) {
if (state is MyLoadedState) {
updateList(state.items.map((e) => DropdownItem(value: e, label: e.name)).toList());
updateLoading(false);
} else if (state is MyLoadingState) {
updateLoading(true);
}
},
onSelectionChanged: (items) => print('Selected: ${items.map((e) => e.label).join(', ')}'),
);
Classes
-
DropdownItem<
T> - A generic model representing a single item in a SearchableDropdownPlus or MultiSelectDropdownPlus dropdown list.
- DropdownPlusTheme
- Defines the visual theme for SearchableDropdownPlus and MultiSelectDropdownPlus widgets.
- DropdownPlusThemePresets
- Provides ready-made DropdownPlusTheme instances for each DropdownPlusThemeStyle.
-
MultiSelectDropdownPlus<
C extends BlocBase< S> , S> - A multi-select dropdown that integrates with any BLoC/Cubit.
-
SearchableDropdownPlus<
C extends BlocBase< S> , S> - A single-select searchable dropdown that integrates with any BLoC/Cubit.
Enums
- DropdownPlusThemeStyle
- Predefined visual styles for SearchableDropdownPlus and MultiSelectDropdownPlus.