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. FormeFieldStatusChanged<T?>? onStatusChanged,
  11. dynamic onInitialed,
  12. FormeFieldSetter<T?>? onSaved,
  13. FormeValidator<T?>? validator,
  14. FormeAsyncValidator<T?>? asyncValidator,
  15. DropdownButtonBuilder? selectedItemBuilder,
  16. VoidCallback? onTap,
  17. bool autofocus = false,
  18. Widget? hint,
  19. Widget? disabledHint,
  20. int elevation = 8,
  21. TextStyle? style,
  22. bool isDense = true,
  23. bool isExpanded = true,
  24. double itemHeight = kMinInteractiveDimension,
  25. Color? focusColor,
  26. Color? dropdownColor,
  27. double iconSize = 24,
  28. Widget? icon,
  29. Color? iconDisabledColor,
  30. Color? iconEnabledColor,
  31. InputDecoration? decoration,
  32. FormeFieldDecorator<T?>? decorator,
  33. bool requestFocusOnUserInteraction = true,
  34. bool registrable = true,
  35. bool enabled = true,
  36. Widget? underline,
  37. double? menuMaxHeight,
  38. bool? enableFeedback,
  39. AlignmentGeometry? alignment,
  40. BorderRadius? borderRadius,
  41. BeforeValueChanged<T?>? beforeValueChanged,
  42. bool useTempValueDuringBeforeValueChangedChecking = true,
  43. dynamic valueUpdater,
  44. FormeFieldValidationFilter<T?>? validationFilter,
  45. FocusNode? focusNode,
})

Implementation

FormeDropdownButton({
  required this.items,
  T? initialValue,
  required String name,
  bool readOnly = false,
  Key? key,
  int? order,
  bool quietlyValidate = false,
  Duration? asyncValidatorDebounce,
  AutovalidateMode? autovalidateMode,
  FormeFieldStatusChanged<T?>? onStatusChanged,
  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,
  FormeFieldValueUpdater<T?>? valueUpdater,
  FormeFieldValidationFilter<T?>? validationFilter,
  FocusNode? focusNode,
}) : super(
        focusNode: focusNode,
        validationFilter: validationFilter,
        valueUpdater: valueUpdater,
        enabled: enabled,
        registrable: registrable,
        requestFocusOnUserInteraction: requestFocusOnUserInteraction,
        order: order,
        quietlyValidate: quietlyValidate,
        asyncValidatorDebounce: asyncValidatorDebounce,
        autovalidateMode: autovalidateMode,
        onStatusChanged: onStatusChanged,
        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.copyWith(focusColor: focusColor),
                    emptyChecker: (value, controller) =>
                        value == null &&
                        (controller as _FormDropdownButtonState)._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;
        },
      );