build method

  1. @override
Widget build(
  1. BuildContext context
)
override

Implementation

@override
Widget build(BuildContext context) {
  return TextFormField(
    key: UniqueKey(),
    controller: controller,
    focusNode: focusNode,
    cursorColor: cursorColor,
    maxLength: maxLength,
    onFieldSubmitted: (s) => onSubmitted?.call(s),
    validator: LengthValidator(minLength: minLength, maxLength: maxLength, allowEmpty: allowEmpty).call,
    keyboardType: keyboardType,
    textInputAction: textInputAction,
    textAlign: textAlign,
    onTapOutside: onTapOutside ?? (e) => focusNode.unfocus(),
    maxLines: maxLines,
    minLines: minLines,
    autofocus: autofocus,
    onChanged: onChanged,
    decoration: decoration ??
        InputDecoration(
          labelText: label,
          counterText: "",
          prefixIcon: prefixIcon,
          helperText: helperText,
          errorText: errorText,
          suffixIcon: suffixIcon ?? (!clear ? null : IconButton(icon: const Icon(Icons.clear), onPressed: () => controller.clear())),
        ),
  );
}