Skip to content

Mobile Number

A customizable mobile number input component with country code selection.

The MobileNumber widget provides a specialized input field for mobile numbers with an integrated country picker. It automatically validates phone number length based on the selected country and provides customizable formatting and validation options.

  • Input Styles: Standard, Floating Label, Disabled.
  • Country Selection: Built-in country picker with flags and dial codes.
  • Validation: Automatic phone number validation based on selected country.
  • Customizable: Supports custom validators, formatters, and styling.

A mobile number input with hint text placeholder.


A mobile number input with a floating label that moves above the input when focused or filled.


A mobile number input in disabled state that cannot be interacted with.


PropertyTypeDescription
labelTextString?The label text displayed above the input field.
hintTextString?The hint text displayed inside the input field when empty.
validatorString? Function(String?)?Custom validator function for the mobile number input. If null, uses default validation.
inputFormattersList<TextInputFormatter>?Custom input formatters. If null, uses digits-only formatter with country-based length limiting.
textInputTypeTextInputTypeThe keyboard type for the input field. Defaults to TextInputType.phone.
autovalidateModeAutovalidateMode?When to automatically validate the input. Defaults to AutovalidateMode.onUserInteraction.
prefixWidgetWidget?Custom prefix widget to display before the country selector.
dialogTitleStringThe title displayed in the country picker dialog. Defaults to 'Select Country'.
searchHintStringThe hint text displayed in the country picker search field.
controllerTextEditingController?Text editing controller for the mobile number input.
prefixPaddingEdgeInsetsGeometryPadding around the prefix icon (country selector).
onCountrySelectedvoid Function(Country)?Callback function triggered when a country is selected.
isErrorboolWhether the input field should display in error state. Defaults to false.
isEnabledboolWhether the input field is enabled for user interaction. Defaults to true.