FormeDropdownButton<T extends Object> constructor
FormeDropdownButton<T extends Object> ({
- required List<
DropdownMenuItem< items,T> > - T? initialValue,
- required String name,
- bool readOnly = false,
- Key? key,
- int? order,
- bool quietlyValidate = false,
- Duration? asyncValidatorDebounce,
- AutovalidateMode? autovalidateMode,
- FormeValueChanged<
T?> ? onValueChanged, - FormeFocusChanged<
T?> ? onFocusChanged, - FormeFieldValidationChanged<
T?> ? onValidationChanged, - FormeFieldInitialed<
T?> ? onInitialed, - FormeFieldSetter<
T?> ? onSaved, - FormeValidator<
T?> ? validator, - FormeAsyncValidator<
T?> ? asyncValidator, - DropdownButtonBuilder? selectedItemBuilder,
- VoidCallback? onTap,
- bool autofocus = false,
- Widget? hint,
- Widget? disabledHint,
- int elevation = 8,
- TextStyle? style,
- bool isDense = true,
- bool isExpanded = true,
- double itemHeight = kMinInteractiveDimension,
- Color? focusColor,
- Color? dropdownColor,
- double iconSize = 24,
- Widget? icon,
- Color? iconDisabledColor,
- Color? iconEnabledColor,
- InputDecoration? decoration,
- FormeFieldDecorator<
T?> ? decorator, - bool requestFocusOnUserInteraction = true,
- bool registrable = true,
- bool enabled = true,
- Widget? underline,
- bool? enableFeedback,
- AlignmentGeometry? alignment,
- BorderRadius? borderRadius,
- BeforeValueChanged<
T?> ? beforeValueChanged, - bool useTempValueDuringBeforeValueChangedChecking = true,
Implementation
FormeDropdownButton({
required this.items,
T? initialValue,
required String name,
bool readOnly = false,
Key? key,
int? order,
bool quietlyValidate = false,
Duration? asyncValidatorDebounce,
AutovalidateMode? autovalidateMode,
FormeValueChanged<T?>? onValueChanged,
FormeFocusChanged<T?>? onFocusChanged,
FormeFieldValidationChanged<T?>? onValidationChanged,
FormeFieldInitialed<T?>? onInitialed,
FormeFieldSetter<T?>? onSaved,
FormeValidator<T?>? validator,
FormeAsyncValidator<T?>? asyncValidator,
DropdownButtonBuilder? selectedItemBuilder,
VoidCallback? onTap,
bool autofocus = false,
Widget? hint,
Widget? disabledHint,
int elevation = 8,
TextStyle? style,
bool isDense = true,
bool isExpanded = true,
double itemHeight = kMinInteractiveDimension,
Color? focusColor,
Color? dropdownColor,
double iconSize = 24,
Widget? icon,
Color? iconDisabledColor,
Color? iconEnabledColor,
InputDecoration? decoration,
FormeFieldDecorator<T?>? decorator,
bool requestFocusOnUserInteraction = true,
bool registrable = true,
bool enabled = true,
Widget? underline,
double? menuMaxHeight,
bool? enableFeedback,
AlignmentGeometry? alignment,
BorderRadius? borderRadius,
this.beforeValueChanged,
this.useTempValueDuringBeforeValueChangedChecking = true,
}) : super(
enabled: enabled,
registrable: registrable,
requestFocusOnUserInteraction: requestFocusOnUserInteraction,
order: order,
quietlyValidate: quietlyValidate,
asyncValidatorDebounce: asyncValidatorDebounce,
autovalidateMode: autovalidateMode,
onValueChanged: onValueChanged,
onFocusChanged: onFocusChanged,
onValidationChanged: onValidationChanged,
onInitialed: onInitialed,
onSaved: onSaved,
validator: validator,
asyncValidator: asyncValidator,
key: key,
readOnly: readOnly,
name: name,
initialValue: initialValue,
decorator: decorator ??
(decoration == null
? null
: FormeInputDecoratorBuilder<T?>(
decoration: decoration,
emptyChecker: (value, controller) =>
value == null &&
(controller as FormeDropdownButtonController)
.tempValue ==
null,
wrapper: (child, controller) {
return DropdownButtonHideUnderline(child: child);
})),
builder: (genericState) {
final _FormDropdownButtonState<T> state =
genericState as _FormDropdownButtonState<T>;
final bool readOnly = state.readOnly;
final DropdownButton<T> dropdownButton = DropdownButton<T>(
borderRadius: borderRadius,
underline: underline,
focusNode: state.focusNode,
autofocus: autofocus,
selectedItemBuilder: selectedItemBuilder,
value: state._tempValue ?? state.value,
items: items,
onTap: onTap,
icon: icon,
iconSize: iconSize,
iconEnabledColor: iconEnabledColor,
iconDisabledColor: iconDisabledColor,
hint: hint,
disabledHint: disabledHint,
elevation: elevation,
style: style,
isDense: isDense,
isExpanded: isExpanded,
itemHeight: itemHeight,
focusColor: focusColor,
dropdownColor: dropdownColor,
menuMaxHeight: menuMaxHeight,
enableFeedback: enableFeedback,
alignment: alignment ?? AlignmentDirectional.centerStart,
onChanged: readOnly ? null : state._didChange,
);
return dropdownButton;
},
);