FormeDropdownButton<T extends Object> constructor

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