updateDecoration method

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

Implementation

void updateDecoration(
    InputDecoration? decoration,
    List<TextInputFormatter>? inputFormatters,
    TextCapitalization? textCapitalization,
    TextStyle? style,
    TextInputType? keyboardType,
    TextInputAction? textInputAction) {
  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;
  }

  setState(() {
    textField = new TextField(
      inputFormatters: this.inputFormatters,
      textCapitalization: this.textCapitalization,
      decoration: this.decoration,
      style: this.style,
      keyboardType: this.keyboardType,
      focusNode: focusNode ?? new FocusNode(),
      controller: controller ?? new TextEditingController(),
      textInputAction: this.textInputAction,
      onChanged: (newText) {
        currentText = newText;
        updateOverlay(newText);

        if (textChanged != null) {
          textChanged!(newText);
        }
      },
      onTap: () {
        updateOverlay(currentText);
      },
      onSubmitted: (submittedText) =>
          triggerSubmitted(submittedText: submittedText),
    );
  });
}