PhoneFormField constructor

PhoneFormField({
  1. Key? key,
  2. PhoneController? controller,
  3. @Deprecated('This is now always true and has no effect anymore') bool shouldFormat = true,
  4. dynamic onChanged(
    1. PhoneNumber
    )?,
  5. FocusNode? focusNode,
  6. CountrySelectorNavigator countrySelectorNavigator = const CountrySelectorNavigator.page(),
  7. @Deprecated('Use [initialValue] or [controller] to set the initial phone number') IsoCode defaultCountry = IsoCode.US,
  8. bool isCountrySelectionEnabled = true,
  9. bool? isCountryButtonPersistent,
  10. @Deprecated('Use [isCountryButtonPersistent]') bool? isCountryChipPersistent,
  11. @Deprecated('Use [CountryButtonStyle] instead') bool? showFlagInInput,
  12. @Deprecated('Use [CountryButtonStyle] instead') bool? showDialCode,
  13. @Deprecated('Use [CountryButtonStyle] instead') bool? showIsoCodeInInput,
  14. @Deprecated('Use [CountryButtonStyle] instead') EdgeInsets? countryButtonPadding,
  15. @Deprecated('Use [CountryButtonStyle] instead') double? flagSize,
  16. @Deprecated('Use [CountryButtonStyle] instead') TextStyle? countryCodeStyle,
  17. CountryButtonStyle countryButtonStyle = const CountryButtonStyle(),
  18. FormFieldValidator<PhoneNumber>? validator,
  19. PhoneNumber? initialValue,
  20. FormFieldSetter<PhoneNumber>? onSaved,
  21. AutovalidateMode? autovalidateMode = AutovalidateMode.onUserInteraction,
  22. String? restorationId,
  23. bool enabled = true,
  24. InputDecoration decoration = const InputDecoration(),
  25. TextInputType keyboardType = TextInputType.phone,
  26. TextInputAction? textInputAction,
  27. TextStyle? style,
  28. StrutStyle? strutStyle,
  29. @Deprecated('Has no effect, Change text directionality instead') TextAlign? textAlign,
  30. TextAlignVertical? textAlignVertical,
  31. bool autofocus = false,
  32. String obscuringCharacter = '*',
  33. bool obscureText = false,
  34. bool autocorrect = true,
  35. SmartDashesType? smartDashesType,
  36. SmartQuotesType? smartQuotesType,
  37. bool enableSuggestions = true,
  38. Widget contextMenuBuilder(
    1. BuildContext,
    2. EditableTextState
    )?,
  39. bool? showCursor,
  40. VoidCallback? onEditingComplete,
  41. ValueChanged<String>? onSubmitted,
  42. AppPrivateCommandCallback? onAppPrivateCommand,
  43. dynamic onTapOutside(
    1. PointerDownEvent
    )?,
  44. List<TextInputFormatter>? inputFormatters,
  45. double cursorWidth = 2.0,
  46. double? cursorHeight,
  47. Radius? cursorRadius,
  48. Color? cursorColor,
  49. BoxHeightStyle selectionHeightStyle = ui.BoxHeightStyle.tight,
  50. BoxWidthStyle selectionWidthStyle = ui.BoxWidthStyle.tight,
  51. Brightness? keyboardAppearance,
  52. EdgeInsets scrollPadding = const EdgeInsets.all(20.0),
  53. bool enableInteractiveSelection = true,
  54. TextSelectionControls? selectionControls,
  55. MouseCursor? mouseCursor,
  56. ScrollPhysics? scrollPhysics,
  57. ScrollController? scrollController,
  58. Iterable<String>? autofillHints,
  59. bool enableIMEPersonalizedLearning = true,
})

Implementation

PhoneFormField({
  super.key,
  this.controller,
  @Deprecated('This is now always true and has no effect anymore')
  this.shouldFormat = true,
  this.onChanged,
  this.focusNode,
  this.countrySelectorNavigator = const CountrySelectorNavigator.page(),
  @Deprecated(
      'Use [initialValue] or [controller] to set the initial phone number')
  this.defaultCountry = IsoCode.US,
  this.isCountrySelectionEnabled = true,
  bool? isCountryButtonPersistent,
  @Deprecated('Use [isCountryButtonPersistent]')
  bool? isCountryChipPersistent,
  @Deprecated('Use [CountryButtonStyle] instead') bool? showFlagInInput,
  @Deprecated('Use [CountryButtonStyle] instead') bool? showDialCode,
  @Deprecated('Use [CountryButtonStyle] instead') bool? showIsoCodeInInput,
  @Deprecated('Use [CountryButtonStyle] instead')
  EdgeInsets? countryButtonPadding,
  @Deprecated('Use [CountryButtonStyle] instead') double? flagSize,
  @Deprecated('Use [CountryButtonStyle] instead') TextStyle? countryCodeStyle,
  CountryButtonStyle countryButtonStyle = const CountryButtonStyle(),
  // form field inputs
  super.validator,
  PhoneNumber? initialValue,
  super.onSaved,
  super.autovalidateMode = AutovalidateMode.onUserInteraction,
  super.restorationId,
  super.enabled = true,
  // textfield inputs
  this.decoration = const InputDecoration(),
  this.keyboardType = TextInputType.phone,
  this.textInputAction,
  this.style,
  this.strutStyle,
  @Deprecated('Has no effect, Change text directionality instead')
  this.textAlign,
  this.textAlignVertical,
  this.autofocus = false,
  this.obscuringCharacter = '*',
  this.obscureText = false,
  this.autocorrect = true,
  this.smartDashesType,
  this.smartQuotesType,
  this.enableSuggestions = true,
  this.contextMenuBuilder,
  this.showCursor,
  this.onEditingComplete,
  this.onSubmitted,
  this.onAppPrivateCommand,
  this.onTapOutside,
  this.inputFormatters,
  this.cursorWidth = 2.0,
  this.cursorHeight,
  this.cursorRadius,
  this.cursorColor,
  this.selectionHeightStyle = ui.BoxHeightStyle.tight,
  this.selectionWidthStyle = ui.BoxWidthStyle.tight,
  this.keyboardAppearance,
  this.scrollPadding = const EdgeInsets.all(20.0),
  this.enableInteractiveSelection = true,
  this.selectionControls,
  this.mouseCursor,
  this.scrollPhysics,
  this.scrollController,
  this.autofillHints,
  this.enableIMEPersonalizedLearning = true,
})  : assert(
        initialValue == null || controller == null,
        'One of initialValue or controller can be specified at a time',
      ),
      isCountryButtonPersistent =
          isCountryButtonPersistent ?? isCountryChipPersistent ?? true,
      countryButtonStyle = countryButtonStyle.copyWith(
        showFlag: showFlagInInput,
        showDialCode: showDialCode,
        showIsoCode: showIsoCodeInInput,
        padding: countryButtonPadding,
        flagSize: flagSize,
        textStyle: countryCodeStyle,
      ),
      super(
        builder: (state) => (state as PhoneFormFieldState).builder(),
        initialValue: controller?.value ?? initialValue,
      );