extend method

Map<String, NyTextField Function(NyTextField nyTextField)> extend({
  1. InputDecoration decoration(
    1. dynamic data,
    2. InputDecoration inputDecoration
    )?,
  2. InputDecoration successDecoration(
    1. dynamic data,
    2. InputDecoration inputDecoration
    )?,
  3. InputDecoration errorDecoration(
    1. dynamic data,
    2. InputDecoration inputDecoration
    )?,
  4. String? labelText,
  5. TextStyle? labelStyle,
  6. TextEditingController? controller,
  7. bool? obscureText,
  8. int? maxLines,
  9. int? minLines,
  10. TextInputType? keyboardType,
  11. bool? autoFocus,
  12. TextAlign? textAlign,
  13. bool? enableSuggestions,
  14. FocusNode? focusNode,
  15. String? hintText,
  16. TextStyle? hintStyle,
  17. String? validationRules,
  18. String? dummyData,
  19. dynamic onChanged(
    1. String value
    )?,
  20. TextInputAction? textInputAction,
  21. TextStyle? style,
  22. StrutStyle? strutStyle,
  23. TextAlignVertical? textAlignVertical,
  24. TextDirection? textDirection,
  25. String? obscuringCharacter,
  26. bool? autocorrect,
  27. SmartDashesType? smartDashesType,
  28. SmartQuotesType? smartQuotesType,
  29. bool? expands,
  30. bool? readOnly,
  31. bool? showCursor,
  32. int? maxLength,
  33. bool? passwordViewable,
  34. bool? validateOnFocusChange,
  35. MouseCursor? mouseCursor,
  36. String? validationErrorMessage,
  37. TextCapitalization? textCapitalization,
  38. MaxLengthEnforcement? maxLengthEnforcement,
  39. AppPrivateCommandCallback? onAppPrivateCommand,
  40. List<TextInputFormatter>? inputFormatters,
  41. bool? enabled,
  42. double? cursorWidth,
  43. double? cursorHeight,
  44. Radius? cursorRadius,
  45. Color? cursorColor,
  46. Brightness? keyboardAppearance,
  47. EdgeInsets? scrollPadding,
  48. TextSelectionControls? selectionControls,
  49. DragStartBehavior? dragStartBehavior,
  50. GestureTapCallback? onTap,
  51. TapRegionCallback? onTapOutside,
  52. VoidCallback? onEditingComplete,
  53. ValueChanged<String>? onSubmitted,
  54. ScrollController? scrollController,
  55. ScrollPhysics? scrollPhysics,
  56. Iterable<String>? autofillHints,
  57. Clip? clipBehavior,
  58. dynamic handleValidationError(
    1. String handleError
    )?,
  59. bool? passwordVisible,
  60. String? type,
  61. Widget? prefixIcon,
  62. Color? backgroundColor,
  63. BorderRadius? borderRadius,
  64. InputBorder? border,
  65. InputBorder? focusedBorder,
  66. InputBorder? enabledBorder,
  67. EdgeInsetsGeometry? contentPadding,
  68. bool customValidationRule(
    1. dynamic value
    )?,
  69. String? title,
  70. TextStyle? titleStyle,
  71. bool? clearable,
  72. Widget? clearIcon,
  73. String? mask,
  74. String? maskMatch,
  75. bool? maskedReturnValue,
})

Extend the field style

Implementation

Map<String, NyTextField Function(NyTextField nyTextField)> extend({
  InputDecoration Function(dynamic data, InputDecoration inputDecoration)?
      decoration,
  InputDecoration Function(dynamic data, InputDecoration inputDecoration)?
      successDecoration,
  InputDecoration Function(dynamic data, InputDecoration inputDecoration)?
      errorDecoration,
  String? labelText,
  TextStyle? labelStyle,
  TextEditingController? controller,
  bool? obscureText,
  int? maxLines,
  int? minLines,
  TextInputType? keyboardType,
  bool? autoFocus,
  TextAlign? textAlign,
  bool? enableSuggestions,
  FocusNode? focusNode,
  String? hintText,
  TextStyle? hintStyle,
  String? validationRules,
  String? dummyData,
  Function(String value)? onChanged,
  TextInputAction? textInputAction,
  TextStyle? style,
  StrutStyle? strutStyle,
  TextAlignVertical? textAlignVertical,
  TextDirection? textDirection,
  String? obscuringCharacter,
  bool? autocorrect,
  SmartDashesType? smartDashesType,
  SmartQuotesType? smartQuotesType,
  bool? expands,
  bool? readOnly,
  bool? showCursor,
  int? maxLength,
  bool? passwordViewable,
  bool? validateOnFocusChange,
  MouseCursor? mouseCursor,
  String? validationErrorMessage,
  TextCapitalization? textCapitalization,
  MaxLengthEnforcement? maxLengthEnforcement,
  AppPrivateCommandCallback? onAppPrivateCommand,
  List<TextInputFormatter>? inputFormatters,
  bool? enabled,
  double? cursorWidth,
  double? cursorHeight,
  Radius? cursorRadius,
  Color? cursorColor,
  Brightness? keyboardAppearance,
  EdgeInsets? scrollPadding,
  TextSelectionControls? selectionControls,
  DragStartBehavior? dragStartBehavior,
  GestureTapCallback? onTap,
  TapRegionCallback? onTapOutside,
  VoidCallback? onEditingComplete,
  ValueChanged<String>? onSubmitted,
  ScrollController? scrollController,
  ScrollPhysics? scrollPhysics,
  Iterable<String>? autofillHints,
  Clip? clipBehavior,
  Function(String handleError)? handleValidationError,
  bool? passwordVisible,
  String? type,
  Widget? prefixIcon,
  Color? backgroundColor,
  BorderRadius? borderRadius,
  InputBorder? border,
  InputBorder? focusedBorder,
  InputBorder? enabledBorder,
  EdgeInsetsGeometry? contentPadding,
  bool Function(dynamic value)? customValidationRule,
  String? title,
  TextStyle? titleStyle,
  bool? clearable,
  Widget? clearIcon,
  String? mask,
  String? maskMatch,
  bool? maskedReturnValue,
}) {
  return {
    this: (NyTextField textField) {
      return textField.copyWith(
        decorator: DecoratorTextField(
          decoration: (data, inputDecoration) {
            if (decoration == null) {
              if (textField.decorator?.decoration != null) {
                return textField.decorator!.decoration!(
                    data, inputDecoration);
              }
              return const InputDecoration();
            }

            InputDecoration inputDecorationBase =
                textField.decorator!.decoration!(data, inputDecoration);
            return decoration(data, inputDecorationBase);
          },
          successDecoration: (data, inputDecoration) {
            if (successDecoration == null) {
              if (textField.decorator?.successDecoration != null) {
                return textField.decorator!.successDecoration!(
                    data, inputDecoration);
              }
              return const InputDecoration();
            }

            InputDecoration inputDecorationBase = textField
                .decorator!.successDecoration!(data, inputDecoration);
            return successDecoration(data, inputDecorationBase);
          },
          errorDecoration: (data, inputDecoration) {
            if (errorDecoration == null) {
              if (textField.decorator?.errorDecoration != null) {
                return textField.decorator!.errorDecoration!(
                    data, inputDecoration);
              }
              return const InputDecoration();
            }

            InputDecoration inputDecorationBase =
                textField.decorator!.errorDecoration!(data, inputDecoration);
            return errorDecoration(data, inputDecorationBase);
          },
        ),
        labelText: labelText ?? textField.labelText,
        labelStyle: labelStyle ?? textField.labelStyle,
        controller: controller ?? textField.controller,
        obscureText: obscureText ?? textField.obscureText,
        maxLines: maxLines ?? textField.maxLines,
        minLines: minLines ?? textField.minLines,
        keyboardType: keyboardType ?? textField.keyboardType,
        autoFocus: autoFocus ?? textField.autoFocus,
        textAlign: textAlign ?? textField.textAlign,
        enableSuggestions: enableSuggestions ?? textField.enableSuggestions,
        focusNode: focusNode ?? textField.focusNode,
        hintText: hintText ?? textField.hintText,
        hintStyle: hintStyle ?? textField.hintStyle,
        validationRules: validationRules ?? textField.validationRules,
        dummyData: dummyData ?? textField.dummyData,
        onChanged: onChanged ?? textField.onChanged,
        textInputAction: textInputAction ?? textField.textInputAction,
        style: style ?? textField.style,
        strutStyle: strutStyle ?? textField.strutStyle,
        textAlignVertical: textAlignVertical ?? textField.textAlignVertical,
        textDirection: textDirection ?? textField.textDirection,
        obscuringCharacter:
            obscuringCharacter ?? textField.obscuringCharacter,
        autocorrect: autocorrect ?? textField.autocorrect,
        smartDashesType: smartDashesType ?? textField.smartDashesType,
        smartQuotesType: smartQuotesType ?? textField.smartQuotesType,
        expands: expands ?? textField.expands,
        readOnly: readOnly ?? textField.readOnly,
        showCursor: showCursor ?? textField.showCursor,
        maxLength: maxLength ?? textField.maxLength,
        passwordViewable: passwordViewable ?? textField.passwordViewable,
        validateOnFocusChange:
            validateOnFocusChange ?? textField.validateOnFocusChange,
        mouseCursor: mouseCursor ?? textField.mouseCursor,
        validationErrorMessage:
            validationErrorMessage ?? textField.validationErrorMessage,
        textCapitalization:
            textCapitalization ?? textField.textCapitalization,
        maxLengthEnforcement:
            maxLengthEnforcement ?? textField.maxLengthEnforcement,
        onAppPrivateCommand:
            onAppPrivateCommand ?? textField.onAppPrivateCommand,
        inputFormatters: inputFormatters ?? textField.inputFormatters,
        enabled: enabled ?? textField.enabled,
        cursorWidth: cursorWidth ?? textField.cursorWidth,
        cursorHeight: cursorHeight ?? textField.cursorHeight,
        cursorRadius: cursorRadius ?? textField.cursorRadius,
        cursorColor: cursorColor ?? textField.cursorColor,
        keyboardAppearance:
            keyboardAppearance ?? textField.keyboardAppearance,
        scrollPadding: scrollPadding ?? textField.scrollPadding,
        selectionControls: selectionControls ?? textField.selectionControls,
        dragStartBehavior: dragStartBehavior ?? textField.dragStartBehavior,
        onTap: onTap ?? textField.onTap,
        onTapOutside: onTapOutside ?? textField.onTapOutside,
        onEditingComplete: onEditingComplete ?? textField.onEditingComplete,
        onSubmitted: onSubmitted ?? textField.onSubmitted,
        scrollController: scrollController ?? textField.scrollController,
        scrollPhysics: scrollPhysics ?? textField.scrollPhysics,
        autofillHints: autofillHints ?? textField.autofillHints,
        clipBehavior: clipBehavior ?? textField.clipBehavior,
        handleValidationError:
            handleValidationError ?? textField.handleValidationError,
        passwordVisible: passwordVisible ?? textField.passwordVisible,
        type: type ?? textField.type,
        prefixIcon: prefixIcon ?? textField.prefixIcon,
        backgroundColor: backgroundColor ?? textField.backgroundColor,
        borderRadius: borderRadius ?? textField.borderRadius,
        border: border ?? textField.border,
        focusedBorder: focusedBorder ?? textField.focusedBorder,
        enabledBorder: enabledBorder ?? textField.enabledBorder,
        contentPadding: contentPadding ?? textField.contentPadding,
        customValidationRule:
            customValidationRule ?? textField.customValidationRule,
        clearable: clearable ?? textField.clearable,
        clearIcon: clearIcon ?? textField.clearIcon,
        mask: mask ?? textField.mask,
        maskMatch: maskMatch ?? textField.maskMatch,
        maskedReturnValue: maskedReturnValue ?? textField.maskedReturnValue,
      );
    }
  };
}