PhoneInput constructor

PhoneInput({
  1. Key? key,
  2. PhoneController? controller,
  3. bool shouldFormat = true,
  4. ValueChanged<PhoneNumber?>? onChanged,
  5. FocusNode? focusNode,
  6. bool showFlagInInput = true,
  7. required CountrySelectorNavigator countrySelectorNavigator,
  8. dynamic onSaved(
    1. PhoneNumber?
    )?,
  9. IsoCode defaultCountry = IsoCode.US,
  10. InputDecoration decoration = const InputDecoration(border: UnderlineInputBorder()),
  11. AutovalidateMode autovalidateMode = AutovalidateMode.onUserInteraction,
  12. PhoneNumber? initialValue,
  13. double flagSize = 20,
  14. BoxShape flagShape = BoxShape.circle,
  15. PhoneNumberInputValidator? validator,
  16. bool isCountrySelectionEnabled = true,
  17. bool showArrow = true,
  18. TextInputType keyboardType = TextInputType.phone,
  19. TextInputAction? textInputAction,
  20. TextStyle? style,
  21. TextStyle? countryCodeStyle,
  22. StrutStyle? strutStyle,
  23. TextAlign textAlign = TextAlign.start,
  24. TextAlignVertical? textAlignVertical,
  25. bool autofocus = false,
  26. String obscuringCharacter = '*',
  27. bool obscureText = false,
  28. bool autocorrect = true,
  29. SmartDashesType? smartDashesType,
  30. SmartQuotesType? smartQuotesType,
  31. bool enableSuggestions = true,
  32. Widget contextMenuBuilder(
    1. BuildContext,
    2. EditableTextState
    )?,
  33. bool? showCursor,
  34. VoidCallback? onEditingComplete,
  35. ValueChanged<String>? onSubmitted,
  36. AppPrivateCommandCallback? onAppPrivateCommand,
  37. List<TextInputFormatter>? inputFormatters,
  38. bool enabled = true,
  39. double cursorWidth = 2.0,
  40. double? cursorHeight,
  41. Radius? cursorRadius,
  42. Color? cursorColor,
  43. BoxHeightStyle selectionHeightStyle = ui.BoxHeightStyle.tight,
  44. BoxWidthStyle selectionWidthStyle = ui.BoxWidthStyle.tight,
  45. Brightness? keyboardAppearance,
  46. EdgeInsets scrollPadding = const EdgeInsets.all(20.0),
  47. bool enableInteractiveSelection = true,
  48. TextSelectionControls? selectionControls,
  49. MouseCursor? mouseCursor,
  50. ScrollPhysics? scrollPhysics,
  51. ScrollController? scrollController,
  52. Iterable<String>? autofillHints,
  53. String? restorationId,
  54. bool enableIMEPersonalizedLearning = true,
})

Implementation

PhoneInput({
  super.key,
  this.controller,
  this.shouldFormat = true,
  this.onChanged,
  this.focusNode,
  bool showFlagInInput = true,
  required CountrySelectorNavigator countrySelectorNavigator,
  Function(PhoneNumber?)? super.onSaved,
  this.defaultCountry = IsoCode.US,
  InputDecoration decoration = const InputDecoration(border: UnderlineInputBorder()),
  AutovalidateMode super.autovalidateMode = AutovalidateMode.onUserInteraction,
  PhoneNumber? initialValue,
  double flagSize = 20,
  BoxShape flagShape = BoxShape.circle,
  PhoneNumberInputValidator? validator,
  bool isCountrySelectionEnabled = true,
  bool showArrow = true,
  // textfield inputs
  TextInputType keyboardType = TextInputType.phone,
  TextInputAction? textInputAction,
  TextStyle? style,
  TextStyle? countryCodeStyle,
  StrutStyle? strutStyle,
  TextAlign textAlign = TextAlign.start,
  TextAlignVertical? textAlignVertical,
  bool autofocus = false,
  String obscuringCharacter = '*',
  bool obscureText = false,
  bool autocorrect = true,
  SmartDashesType? smartDashesType,
  SmartQuotesType? smartQuotesType,
  bool enableSuggestions = true,
  Widget Function(BuildContext, EditableTextState)? contextMenuBuilder,
  bool? showCursor,
  VoidCallback? onEditingComplete,
  ValueChanged<String>? onSubmitted,
  AppPrivateCommandCallback? onAppPrivateCommand,
  List<TextInputFormatter>? inputFormatters,
  super.enabled,
  double cursorWidth = 2.0,
  double? cursorHeight,
  Radius? cursorRadius,
  Color? cursorColor,
  ui.BoxHeightStyle selectionHeightStyle = ui.BoxHeightStyle.tight,
  ui.BoxWidthStyle selectionWidthStyle = ui.BoxWidthStyle.tight,
  Brightness? keyboardAppearance,
  EdgeInsets scrollPadding = const EdgeInsets.all(20.0),
  bool enableInteractiveSelection = true,
  TextSelectionControls? selectionControls,
  MouseCursor? mouseCursor,
  ScrollPhysics? scrollPhysics,
  ScrollController? scrollController,
  Iterable<String>? autofillHints,
  super.restorationId,
  bool enableIMEPersonalizedLearning = true,
})  : assert(
        initialValue == null || controller == null,
        'One of initialValue or controller can be specified at a time',
      ),
      super(
        initialValue: controller != null ? controller.value : initialValue,
        validator: validator ?? PhoneValidator.valid(),
        builder: (state) {
          final field = state as PhoneInputState;
          return PhoneField(
            showArrow: showArrow,
            controller: field._childController,
            showFlagInInput: showFlagInInput,
            selectorNavigator: countrySelectorNavigator,
            errorText: field.getErrorText(),
            flagShape: flagShape,
            flagSize: flagSize,
            decoration: decoration,
            enabled: enabled,
            isCountrySelectionEnabled: isCountrySelectionEnabled,
            // textfield params
            autofillHints: autofillHints,
            keyboardType: keyboardType,
            textInputAction: textInputAction,
            style: style,
            countryCodeStyle: countryCodeStyle,
            strutStyle: strutStyle,
            textAlign: textAlign,
            textAlignVertical: textAlignVertical,
            autofocus: autofocus,
            obscuringCharacter: obscuringCharacter,
            obscureText: obscureText,
            autocorrect: autocorrect,
            smartDashesType: smartDashesType,
            smartQuotesType: smartQuotesType,
            enableSuggestions: enableSuggestions,
            contextMenuBuilder: contextMenuBuilder,
            showCursor: showCursor,
            onEditingComplete: onEditingComplete,
            onSubmitted: onSubmitted,
            onAppPrivateCommand: onAppPrivateCommand,
            cursorWidth: cursorWidth,
            cursorHeight: cursorHeight,
            cursorRadius: cursorRadius,
            cursorColor: cursorColor,
            selectionHeightStyle: selectionHeightStyle,
            selectionWidthStyle: selectionWidthStyle,
            keyboardAppearance: keyboardAppearance,
            scrollPadding: scrollPadding,
            enableInteractiveSelection: enableInteractiveSelection,
            selectionControls: selectionControls,
            mouseCursor: mouseCursor,
            scrollController: scrollController,
            scrollPhysics: scrollPhysics,
            restorationId: restorationId,
            enableIMEPersonalizedLearning: enableIMEPersonalizedLearning,
            inputFormatters: inputFormatters,
          );
        },
      );