updateDecoration method

void updateDecoration({
  1. InputDecoration? decoration,
  2. List<TextInputFormatter>? inputFormatters,
  3. TextCapitalization? textCapitalization,
  4. TextStyle? style,
  5. TextInputType? keyboardType,
  6. TextInputAction? textInputAction,
  7. bool refresh = true,
})

Implementation

void updateDecoration(
    {InputDecoration? decoration,
    List<TextInputFormatter>? inputFormatters,
    TextCapitalization? textCapitalization,
    TextStyle? style,
    TextInputType? keyboardType,
    TextInputAction? textInputAction,
    bool refresh = true}) {
  if (decoration != null) {
    this.decoration = decoration;
  }

  if (inputFormatters != null) {
    this.inputFormatters = inputFormatters;
  }

  if (textCapitalization != null) {
    this.textCapitalization = textCapitalization;
  }

  if (style != null) {
    this.style = style;
  }

  if (keyboardType != null) {
    this.keyboardType = keyboardType;
  }

  if (textInputAction != null) {
    this.textInputAction = textInputAction;
  }

  this.decoration = this.decoration.copyWith(
        errorText: textEditingController!.error,
        suffixIcon: IconButton(
          icon: getSuffixIcon,
//        iconSize: this.customButtonIconSize,
//        padding: EdgeInsets.only(right: 0),
          onPressed: !enabled
              ? null
              : () {
                  if (!hasText && !showingSuggestions) {
                    showAllSuggestions();
                  } else {
                    if (showingSuggestions) hideAllSuggestions();
                    clear();
                    setState(() {});
                  }
                },
        ),
        suffixText: null,
      );

  updatedTextField();

  if (refresh) setState(() {});
}