builder method

Widget builder()

Implementation

Widget builder() {
  final textAlignment = _computeTextAlign();
  final countryButtonForEachSlot = _buildCountryButtonForEachSlot(
    textAlignment,
  );
  return TextField(
    decoration: widget.decoration.copyWith(
      errorText: errorText,
      prefix: countryButtonForEachSlot[_CountryButtonSlot.prefix],
      prefixIcon: countryButtonForEachSlot[_CountryButtonSlot.prefixIcon],
      suffix: countryButtonForEachSlot[_CountryButtonSlot.suffix],
      suffixIcon: countryButtonForEachSlot[_CountryButtonSlot.suffixIcon],
    ),
    controller: controller._formattedNationalNumberController,
    focusNode: focusNode,
    enabled: widget.enabled,
    inputFormatters: widget.inputFormatters ??
        [
          if (widget.shouldLimitLengthByCountry && _maxValidLength != null)
            LimitMaxLengthFormatter(_maxValidLength!),
          FilteringTextInputFormatter.allow(RegExp(
              '[${AllowedCharacters.plus}${AllowedCharacters.digits}${AllowedCharacters.punctuation}]')),
        ],
    onChanged: _onTextfieldChanged,
    textAlign: _computeTextAlign(),
    autofillHints: widget.autofillHints,
    keyboardType: widget.keyboardType,
    textInputAction: widget.textInputAction,
    style: widget.style,
    strutStyle: widget.strutStyle,
    textAlignVertical: widget.textAlignVertical,
    autofocus: widget.autofocus,
    obscuringCharacter: widget.obscuringCharacter,
    obscureText: widget.obscureText,
    autocorrect: widget.autocorrect,
    smartDashesType: widget.smartDashesType,
    smartQuotesType: widget.smartQuotesType,
    enableSuggestions: widget.enableSuggestions,
    showCursor: widget.showCursor,
    onEditingComplete: widget.onEditingComplete,
    onSubmitted: (_) => widget.onSubmitted?.call(controller.value),
    onAppPrivateCommand: widget.onAppPrivateCommand,
    cursorWidth: widget.cursorWidth,
    cursorHeight: widget.cursorHeight,
    cursorRadius: widget.cursorRadius,
    cursorColor: widget.cursorColor,
    onTapOutside: widget.onTapOutside,
    onTapUpOutside: widget.onTapUpOutside,
    selectionHeightStyle: widget.selectionHeightStyle,
    selectionWidthStyle: widget.selectionWidthStyle,
    keyboardAppearance: widget.keyboardAppearance,
    scrollPadding: widget.scrollPadding,
    enableInteractiveSelection: widget.enableInteractiveSelection,
    selectionControls: widget.selectionControls,
    mouseCursor: widget.mouseCursor,
    scrollController: widget.scrollController,
    scrollPhysics: widget.scrollPhysics,
    restorationId: widget.restorationId,
    enableIMEPersonalizedLearning: widget.enableIMEPersonalizedLearning,
    readOnly: widget.readOnly,
    canRequestFocus: widget.canRequestFocus,
  );
}