- Add detailed description of the phone login app - Document key features including Firebase authentication - Explain the project architecture and structure - Add installation and usage instructions - Include information about dependencies and best practices - Provide comprehensive documentation for developers Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Phone Login
A Flutter application for phone number-based authentication with Firebase. This app demonstrates a complete phone login flow including phone number input, SMS verification, and authenticated user interfaces.
Features
- Phone number authentication using Firebase
- International phone number input with country selection
- SMS verification with 6-digit code input
- Responsive UI with adaptive light/dark themes
- Proper state management with error handling
- Clean architecture following Flutter best practices
- Proper separation of concerns (presentation, domain, data layers)
Architecture
The application follows a layered architecture with the following key components:
- Authentication: Managed through Firebase Authentication with
firebase_authpackage. TheAuthStateclass handles authentication state using Provider pattern. - Navigation: Implemented with
go_routerfor declarative routing with authentication-aware redirects. - State Management: Uses
providerpackage withChangeNotifierProviderfor global state management. - UI Components: Built with Flutter's Material Design widgets and enhanced with specialized packages:
intl_phone_fieldfor international phone number inputpinputfor PIN input fields on SMS verification
Project Structure
lib/
├── main.dart # App entry point
├── app.dart # MaterialApp setup, theme, and routing
├── auth/ # Authentication-related screens and logic
│ ├── auth_state.dart # Manages authentication state
│ ├── phone_input_screen.dart
│ └── sms_verification_screen.dart
├── home/ # Home screen
│ └── home_screen.dart
├── profile/ # User profile screen
│ └── profile_screen.dart
├── services/ # Backend services (e.g., Firebase)
│ └── auth_service.dart
├── shared/ # Common models, widgets, and utilities
│ ├── models/
│ │ └── user_model.dart
│ └── widgets/
│ └── loading_indicator.dart
└── theme/ # Theming and styling
└── app_theme.dart
Getting Started
This project is a starting point for a Flutter application with phone authentication capabilities.
Prerequisites
- Flutter SDK (latest stable)
- Firebase project configured with phone authentication enabled
Installation
- Clone the repository
- Run
flutter pub getto install dependencies - Configure Firebase for your platform (Android/iOS)
- Run the application with
flutter run
Running the Application
# Run the application
flutter run
# Run tests
flutter test
# Analyze code
flutter analyze
# Format code
dart format lib/
# Build for Android
flutter build apk
# Build for iOS
flutter build ios
Key Dependencies
firebase_core: 4.3.0firebase_auth: 6.1.3go_router: ^17.0.1provider: ^6.1.5+1intl_phone_field: ^3.2.0pinput: ^6.0.1
Development Best Practices
This project follows Flutter and Dart best practices including:
- Proper separation of concerns
- Clean architecture with distinct layers
- State management with proper error handling
- Responsive UI design
- Comprehensive error handling and loading states
- Proper resource disposal
- Null safety compliance
- Code formatting and linting
Description
Languages
C++
35.7%
Dart
29.2%
CMake
28.1%
Swift
2.9%
C
2.1%
Other
1.9%