FormeDropdownButton<T extends Object> constructor
FormeDropdownButton<T extends Object> ({
- Key? key,
- String? name,
- T? initialValue,
- FormeAsyncValidator<
T?> ? asyncValidator, - Duration? asyncValidatorDebounce,
- AutovalidateMode? autovalidateMode,
- bool enabled = true,
- FocusNode? focusNode,
- FormeFieldInitialized<
T?> ? onInitialized, - FormeFieldSetter<
T?> ? onSaved, - FormeFieldStatusChanged<
T?> ? onStatusChanged, - int? order,
- bool quietlyValidate = false,
- bool readOnly = false,
- bool requestFocusOnUserInteraction = true,
- FormeFieldValidationFilter<
T?> ? validationFilter, - FormeValidator<
T?> ? validator, - FormeFieldDecorator<
T?> ? decorator, - List<
DropdownMenuItem< ? items,T> > - AlignmentGeometry? alignment,
- bool autofocus = false,
- BorderRadius? borderRadius,
- InputDecoration? decoration,
- Widget? disabledHint,
- Color? dropdownColor,
- int elevation = 8,
- bool? enableFeedback,
- Color? focusColor,
- Widget? hint,
- Widget? icon,
- Color? iconDisabledColor,
- Color? iconEnabledColor,
- double iconSize = 24,
- bool isDense = true,
- bool isExpanded = false,
- double itemHeight = kMinInteractiveDimension,
- VoidCallback? onTap,
- DropdownButtonBuilder? selectedItemBuilder,
- TextStyle? style,
Implementation
FormeDropdownButton({
super.key,
super.name,
super.initialValue,
super.asyncValidator,
super.asyncValidatorDebounce,
super.autovalidateMode,
super.enabled = true,
super.focusNode,
super.onInitialized,
super.onSaved,
super.onStatusChanged,
super.order,
super.quietlyValidate = false,
super.readOnly = false,
super.requestFocusOnUserInteraction = true,
super.validationFilter,
super.validator,
super.decorator,
this.items,
this.alignment,
this.autofocus = false,
this.borderRadius,
this.decoration,
this.disabledHint,
this.dropdownColor,
this.elevation = 8,
this.enableFeedback,
this.focusColor,
this.hint,
this.icon,
this.iconDisabledColor,
this.iconEnabledColor,
this.iconSize = 24,
this.isDense = true,
this.isExpanded = false,
this.itemHeight = kMinInteractiveDimension,
this.menuMaxHeight,
this.onTap,
this.selectedItemBuilder,
this.style,
}) : super.allFields(
builder: (state) {
final bool readOnly = state.readOnly;
// we add [Form] here to avoid register to user's [Form]
return Form(
child: DropdownButtonFormField(
autofocus: autofocus,
selectedItemBuilder: selectedItemBuilder,
hint: hint,
disabledHint: disabledHint,
onTap: onTap,
elevation: 8,
style: style,
items: items,
icon: icon,
iconDisabledColor: iconDisabledColor,
iconEnabledColor: iconEnabledColor,
iconSize: iconSize,
isDense: isDense,
isExpanded: isExpanded,
itemHeight: itemHeight,
focusColor: focusColor,
dropdownColor: dropdownColor,
menuMaxHeight: menuMaxHeight,
enableFeedback: enableFeedback,
alignment: alignment ?? AlignmentDirectional.centerStart,
borderRadius: borderRadius,
onChanged: readOnly ? null : state.didChange,
decoration:
(decoration ?? InputDecoration(focusColor: focusColor))
.copyWith(errorText: state.errorText),
value: state.value,
focusNode: state.focusNode,
),
);
},
);