Package selection guidance compiled from public package information, community data, and project usage.
A Flutter plugin designed for seamless international phone number input, featuring automatic formatting, real-time validation, and country selection with built-in localization. It supports multiple platforms including Android, iOS, Web, macOS, Windows, and Linux. The package simplifies handling diverse phone number formats across countries by intelligently applying masks and providing a user-friendly interface for selecting country codes. Ideal for apps requiring global user registration or contact information collection.
Use cases
International user registration
Contact form inputs
Global messaging apps
User profile setup
Multi-region support
Key features
Automatic phone number formatting
Real-time validation
Country code selection
Localization support
Cross-platform compatibility
Input masking
Suitable for
Apps targeting global audiences
Forms requiring phone number validation
Developers needing internationalization
Mobile and web applications
UX-focused input components
Considerations
Requires internet for country data updates
May increase bundle size slightly
Depends on external localization files
Limited customization of UI components
Needs proper handling of edge cases in international formats
Original README
Original README snapshot from the linked source repository. Visit the repository for the latest content.
📱 Phone Text Field
A comprehensive Flutter package for international phone number input with validation, formatting, and country selection. Perfect for apps requiring phone number collection with proper validation and beautiful UI.
// Using ProviderclassPhoneProviderextendsChangeNotifier{
PhoneNumber? _phoneNumber;
PhoneNumber? get phoneNumber => _phoneNumber;
voidupdatePhone(PhoneNumber phoneNumber) {
_phoneNumber = phoneNumber;
notifyListeners();
}
}
// In your widgetConsumer<PhoneProvider>(
builder: (context, phoneProvider, child) {
returnPhoneTextField(
onChanged: (phoneNumber) {
phoneProvider.updatePhone(phoneNumber);
},
);
},
)
🐛 Bug Fixes & Improvements
Version 1.0.0+ Fixes
✅ Controller Integration Issue (#2)
Problem: Controller property was commented out, causing integration issues with forms.
// Before (broken)// final TextEditingController? controller;// After (fixed)finalTextEditingController? controller;
✅ +1 Country Code Flag Switching (#3)
Problem: When editing US/Canada numbers, flag would incorrectly switch between countries.
Solution: Improved country selection logic to preserve originally selected country when multiple countries share the same dial code.
✅ Chinese Phone Number Validation (#4)
Problem: Chinese numbers were validated as 12 digits instead of 11.
Push to your fork: git push origin feature/amazing-feature
Open a Pull Request
📝 Development Setup
# Clone the repository
git clone https://github.com/MohamedAbd0/phone_text_field.git
cd phone_text_field
# Install dependencies
flutter pub get
# Run tests
flutter test# Run example appcd example
flutter run
📄 License
This project is licensed under the MIT License - see the LICENSE file for details.