PhoneFormField class

Phone input extending form field.

controller:

Use a PhoneController for PhoneFormField when you need to dynamically change the value.

Whenever the user modifies the phone field with an associated controller, the phone field updates the display value and the controller notifies its listeners.

You can also use an initialValue: The initial value used.

Only one of initialValue and controller can be specified. If controller is specified the initialValue will be the first value of the PhoneController

Inheritance

Constructors

PhoneFormField({Key? key, PhoneController? controller, @Deprecated('This is now always true and has no effect anymore') bool shouldFormat = true, dynamic onChanged(PhoneNumber)?, FocusNode? focusNode, CountrySelectorNavigator countrySelectorNavigator = const CountrySelectorNavigator.page(), @Deprecated('Use [initialValue] or [controller] to set the initial phone number') IsoCode defaultCountry = IsoCode.US, bool 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(), FormFieldValidator<PhoneNumber>? validator, PhoneNumber? initialValue, FormFieldSetter<PhoneNumber>? onSaved, AutovalidateMode? autovalidateMode = AutovalidateMode.onUserInteraction, String? restorationId, bool enabled = true, InputDecoration decoration = const InputDecoration(), TextInputType keyboardType = TextInputType.phone, TextInputAction? textInputAction, TextStyle? style, StrutStyle? strutStyle, @Deprecated('Has no effect, Change text directionality instead') TextAlign? textAlign, TextAlignVertical? textAlignVertical, bool autofocus = false, String obscuringCharacter = '*', bool obscureText = false, bool autocorrect = true, SmartDashesType? smartDashesType, SmartQuotesType? smartQuotesType, bool enableSuggestions = true, Widget contextMenuBuilder(BuildContext, EditableTextState)?, bool? showCursor, VoidCallback? onEditingComplete, ValueChanged<String>? onSubmitted, AppPrivateCommandCallback? onAppPrivateCommand, dynamic onTapOutside(PointerDownEvent)?, List<TextInputFormatter>? inputFormatters, double cursorWidth = 2.0, double? cursorHeight, Radius? cursorRadius, Color? cursorColor, BoxHeightStyle selectionHeightStyle = ui.BoxHeightStyle.tight, 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, bool enableIMEPersonalizedLearning = true})

Properties

autocorrect bool
final
autofillHints Iterable<String>?
final
autofocus bool
final
autovalidateMode AutovalidateMode
Used to enable/disable this form field auto validation and update its error text.
finalinherited
builder FormFieldBuilder<PhoneNumber>
Function that returns the widget representing this form field. It is passed the form field state as input, containing the current value and validation state of this field.
finalinherited
contextMenuBuilder → (Widget Function(BuildContext, EditableTextState)?)
final
controller PhoneController?
Use a PhoneController for PhoneFormField when you need to dynamically change the value.
final
countryButtonStyle CountryButtonStyle
The style of the country selector button
final
countrySelectorNavigator CountrySelectorNavigator
how to display the country selection
final
cursorColor Color?
final
cursorHeight double?
final
cursorRadius Radius?
final
cursorWidth double
final
decoration InputDecoration
final
defaultCountry IsoCode
country that is displayed when there is no value
final
enabled bool
Whether the form is able to receive user input.
finalinherited
enableIMEPersonalizedLearning bool
final
enableInteractiveSelection bool
final
enableSuggestions bool
final
focusNode FocusNode?
the focusNode of the national number
final
hashCode int
The hash code for this object.
no setterinherited
initialValue PhoneNumber?
An optional value to initialize the form field to, or null otherwise.
finalinherited
inputFormatters List<TextInputFormatter>?
final
isCountryButtonPersistent bool
This controls wether the country button is alway shown or is hidden by the label when the national number is empty. In flutter terms this controls whether the country button is shown as a prefix or prefixIcon inside the text field.
final
isCountrySelectionEnabled bool
whether the user can select a new country when pressing the country button
final
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
keyboardAppearance Brightness?
final
keyboardType TextInputType
final
mouseCursor MouseCursor?
final
obscureText bool
final
obscuringCharacter String
final
onAppPrivateCommand AppPrivateCommandCallback?
final
onChanged → (dynamic Function(PhoneNumber)?)
callback called when the input value changes
final
onEditingComplete VoidCallback?
final
onSaved FormFieldSetter<PhoneNumber>?
An optional method to call with the final value when the form is saved via FormState.save.
finalinherited
onSubmitted ValueChanged<String>?
final
onTapOutside → (dynamic Function(PointerDownEvent)?)
final
restorationId String?
Restoration ID to save and restore the state of the form field.
finalinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
scrollController ScrollController?
final
scrollPadding EdgeInsets
final
scrollPhysics ScrollPhysics?
final
selectionControls TextSelectionControls?
final
selectionEnabled bool
no setter
selectionHeightStyle BoxHeightStyle
final
selectionWidthStyle BoxWidthStyle
final
shouldFormat bool
final
showCursor bool?
final
smartDashesType SmartDashesType?
final
smartQuotesType SmartQuotesType?
final
strutStyle StrutStyle?
final
style TextStyle?
final
textAlign TextAlign?
final
textAlignVertical TextAlignVertical?
final
textInputAction TextInputAction?
final
validator FormFieldValidator<PhoneNumber>?
An optional method that validates an input. Returns an error string to display if the input is invalid, or null otherwise.
finalinherited

Methods

createElement() StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() PhoneFormFieldState
Creates the mutable state for this widget at a given location in the tree.
override
debugDescribeChildren() List<DiagnosticsNode>
Returns a list of DiagnosticsNode objects describing this node's children.
inherited
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toDiagnosticsNode({String? name, DiagnosticsTreeStyle? style}) DiagnosticsNode
Returns a debug representation of the object that is used by debugging tools and by DiagnosticsNode.toStringDeep.
inherited
toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) String
A string representation of this object.
inherited
toStringDeep({String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug}) String
Returns a string representation of this node and its descendants.
inherited
toStringShallow({String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) String
Returns a one-line detailed description of the object.
inherited
toStringShort() String
A short, textual description of this widget.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited