JetPhoneField class

A customizable phone number field widget with built-in validation.

This widget provides:

  • Phone number-specific keyboard
  • Customizable validation rules
  • International phone number support
  • Input formatting options
  • Integrated with Flutter Form Builder

Example usage:

JetPhoneField(
  name: 'phone',
  hintText: 'Enter phone number',
  countryCode: '+1', // Optional country code
  minLength: 10,
  maxLength: 15,
)
Inheritance

Constructors

JetPhoneField.new({Key? key, required String name, String? initialValue, FormFieldValidator<String>? validator, bool showPrefixIcon = true, Widget? prefixIcon, bool autofocus = false, bool isRequired = true, String hintText = '', bool enabled = true, int minLength = 10, int maxLength = 15, String? countryCode, List<TextInputFormatter>? inputFormatters, bool allowInternational = true, String? labelText, TextStyle? labelStyle, bool filled = true, Color? fillColor, InputBorder? border, InputBorder? enabledBorder, InputBorder? focusedBorder, InputBorder? errorBorder, InputBorder? disabledBorder, EdgeInsetsGeometry? contentPadding, TextStyle? errorStyle, String? helperText, TextStyle? helperStyle, BoxConstraints? constraints})
const

Properties

allowInternational bool
Whether to allow international format
final
autofocus bool
Whether to autofocus this field
final
border InputBorder?
Border for the field
final
constraints BoxConstraints?
Constraints for the input field
final
contentPadding EdgeInsetsGeometry?
Content padding for the field
final
countryCode String?
Country code prefix (e.g., '+1', '+44')
final
disabledBorder InputBorder?
Border when the field is disabled
final
enabled bool
Whether the field is enabled
final
enabledBorder InputBorder?
Border when the field is enabled
final
errorBorder InputBorder?
Border when the field has an error
final
errorStyle TextStyle?
Error style for validation messages
final
fillColor Color?
Fill color for the field
final
filled bool
Whether the field should be filled
final
focusedBorder InputBorder?
Border when the field is focused
final
hashCode int
The hash code for this object.
no setterinherited
helperStyle TextStyle?
Helper text style
final
helperText String?
Helper text to display below the field
final
hintText String
Hint text to display when field is empty
final
initialValue String?
Initial value for the phone field
final
inputFormatters List<TextInputFormatter>?
Input formatters for the field
final
isRequired bool
Whether this field is required
final
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
labelStyle TextStyle?
Label style for the field
final
labelText String?
Label text for the field
final
maxLength int
Maximum length for phone number (default: 15)
final
minLength int
Minimum length for phone number (default: 10)
final
name String
The name identifier for this form field
final
prefixIcon Widget?
Custom prefix icon widget
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
showPrefixIcon bool
Whether to show the default phone icon
final
validator FormFieldValidator<String>?
Custom validator function
final

Methods

build(BuildContext context) Widget
Describes the part of the user interface represented by this widget.
override
createElement() → _StatelessHookElement
Creates a StatelessElement to manage this widget's location in the tree.
inherited
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, int wrapWidth = 65}) 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