FormeDropdownButton<T extends Object> constructor

FormeDropdownButton<T extends Object>({
  1. required List<DropdownMenuItem<T>> items,
  2. T? initialValue,
  3. required String name,
  4. bool readOnly = false,
  5. Key? key,
  6. int? order,
  7. bool quietlyValidate = false,
  8. Duration? asyncValidatorDebounce,
  9. AutovalidateMode? autovalidateMode,
  10. FormeValueChanged<T?>? onValueChanged,
  11. FormeFocusChanged<T?>? onFocusChanged,
  12. FormeFieldValidationChanged<T?>? onValidationChanged,
  13. FormeFieldInitialed<T?>? onInitialed,
  14. FormeFieldSetter<T?>? onSaved,
  15. FormeValidator<T?>? validator,
  16. FormeAsyncValidator<T?>? asyncValidator,
  17. DropdownButtonBuilder? selectedItemBuilder,
  18. VoidCallback? onTap,
  19. bool autofocus = false,
  20. Widget? hint,
  21. Widget? disabledHint,
  22. int elevation = 8,
  23. TextStyle? style,
  24. bool isDense = true,
  25. bool isExpanded = true,
  26. double itemHeight = kMinInteractiveDimension,
  27. Color? focusColor,
  28. Color? dropdownColor,
  29. double iconSize = 24,
  30. Widget? icon,
  31. Color? iconDisabledColor,
  32. Color? iconEnabledColor,
  33. InputDecoration? decoration,
  34. FormeFieldDecorator<T?>? decorator,
  35. bool requestFocusOnUserInteraction = true,
  36. bool registrable = true,
  37. bool enabled = true,
  38. Widget? underline,
  39. double? menuMaxHeight,
  40. bool? enableFeedback,
  41. AlignmentGeometry? alignment,
  42. BorderRadius? borderRadius,
  43. BeforeValueChanged<T?>? beforeValueChanged,
  44. 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;
        },
      );