phone_flag_input library
A beautiful and customizable phone number input widget for Flutter.
This library provides a comprehensive phone number input solution with:
- Country flag display with searchable country selector
- International dial code support
- Automatic input filtering and formatting
- Customizable theming
- Support for 100+ countries
Getting Started
Add this to your package's pubspec.yaml file:
dependencies:
phone_flag_input: ^0.0.1
Basic Usage
import 'package:phone_flag_input/phone_flag_input.dart';
PhoneInput(
initialCountry: Country.unitedStates,
onChanged: (phoneNumber) {
print('Full number: ${phoneNumber.fullNumber}');
},
)
With Initial Value
PhoneInput(
initialValue: PhoneNumber(Country.india, '9876543210'),
onChanged: (phoneNumber) => setState(() => _phone = phoneNumber),
)
With Custom Theme
PhoneInput(
theme: PhoneInputTheme(
flagHeight: 24,
flagWidth: 32,
maxWidth: 300,
borderRadius: BorderRadius.circular(12),
),
)
Filtering Specific Countries
PhoneInput(
countries: [
Country.unitedStates,
Country.canada,
Country.unitedKingdom,
Country.india,
],
onChanged: (phone) => print(phone),
)
Classes
- Country
- Represents a country with its dial code and ISO country code.
- PhoneInput
- A specialized input widget for entering international phone numbers.
- PhoneInputTheme
- Theme data for PhoneInput.
- PhoneNumber
- Represents a phone number with country code information.