MultiSelectDropdownPlusFormField<C extends BlocBase<S> , S> constructor
MultiSelectDropdownPlusFormField<C extends BlocBase<S> , S> ({
- required C cubit,
- required void onSearch(
- String query
- required void onStateChange(
- S state,
- void updateList(),
- void updateLoading()
- required String hintText,
- Key? key,
- List<
DropdownItem> initialValue = const [], - FormFieldValidator<
List< ? validator,DropdownItem> > - FormFieldSetter<
List< ? onSaved,DropdownItem> > - AutovalidateMode? autovalidateMode,
- bool enabled = true,
- String? searchHint,
- String? noResultsText,
- String? loadingText,
- bool needInitialFetch = false,
- int maxDisplayChips = 2,
- DropdownPlusTheme? dropdownTheme,
- DropdownPlusThemeStyle? themeStyle,
- Widget itemBuilder(
- DropdownItem item,
- bool isSelected
- Widget selectedItemBuilder(
- List<
DropdownItem> selected
- List<
- double? buttonHeight,
- double? buttonWidth,
- Future<
bool> checkInternetConnection()?, - Duration debounceDuration = Duration.zero,
- bool autofocusSearch = false,
- DropdownEmptyBuilder? emptyBuilder,
- DropdownLoadingBuilder? loadingBuilder,
- Object? error,
- VoidCallback? onRetry,
- DropdownErrorBuilder? errorBuilder,
- String? semanticsLabel,
- int minSearchLength = 0,
Implementation
MultiSelectDropdownPlusFormField({
required C cubit,
required void Function(String query) onSearch,
required void Function(
S state,
void Function(List<DropdownItem<dynamic>>) updateList,
void Function(bool) updateLoading,
) onStateChange,
required String hintText,
super.key,
List<DropdownItem<dynamic>> initialValue = const [],
super.validator,
super.onSaved,
super.autovalidateMode,
super.enabled,
String? searchHint,
String? noResultsText,
String? loadingText,
bool needInitialFetch = false,
int maxDisplayChips = 2,
DropdownPlusTheme? dropdownTheme,
DropdownPlusThemeStyle? themeStyle,
Widget Function(DropdownItem<dynamic> item, bool isSelected)? itemBuilder,
Widget Function(List<DropdownItem<dynamic>> selected)? selectedItemBuilder,
double? buttonHeight,
double? buttonWidth,
Future<bool> Function()? checkInternetConnection,
Duration debounceDuration = Duration.zero,
bool autofocusSearch = false,
DropdownEmptyBuilder? emptyBuilder,
DropdownLoadingBuilder? loadingBuilder,
Object? error,
VoidCallback? onRetry,
DropdownErrorBuilder? errorBuilder,
String? semanticsLabel,
int minSearchLength = 0,
}) : super(
initialValue: initialValue,
builder: (state) {
return dropdownFormFieldDecoration(
state: state,
dropdown: MultiSelectDropdownPlus<C, S>(
cubit: cubit,
onSearch: onSearch,
onStateChange: onStateChange,
hintText: hintText,
selectedItems: state.value ?? const [],
onSelectionChanged: (items) => state.didChange(items),
searchHint: searchHint,
noResultsText: noResultsText,
loadingText: loadingText,
needInitialFetch: needInitialFetch,
maxDisplayChips: maxDisplayChips,
dropdownTheme: dropdownTheme,
themeStyle: themeStyle,
itemBuilder: itemBuilder,
selectedItemBuilder: selectedItemBuilder,
buttonHeight: buttonHeight,
buttonWidth: buttonWidth,
checkInternetConnection: checkInternetConnection,
debounceDuration: debounceDuration,
enabled: enabled,
autofocusSearch: autofocusSearch,
emptyBuilder: emptyBuilder,
loadingBuilder: loadingBuilder,
error: error,
onRetry: onRetry,
errorBuilder: errorBuilder,
semanticsLabel: semanticsLabel,
minSearchLength: minSearchLength,
),
);
},
);