refactor: implement Flutter best practices and proper architecture
- Create proper service layer with AuthService and FirebaseAuthService - Implement UserModel for proper data representation - Enhance AuthState with proper loading states and error handling - Convert stateless widgets to stateful where appropriate - Add proper form validation and user feedback mechanisms - Implement comprehensive error handling and loading indicators - Fix redirect logic in router for proper authentication flow - Create theme system with light and dark themes - Add shared components like LoadingIndicator - Improve code organization following recommended architecture - Add proper disposal of controllers and focus nodes - Implement proper null safety handling Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
30
lib/shared/models/user_model.dart
Normal file
30
lib/shared/models/user_model.dart
Normal file
@@ -0,0 +1,30 @@
|
||||
class UserModel {
|
||||
final String uid;
|
||||
final String? displayName;
|
||||
final String? phoneNumber;
|
||||
final String? email;
|
||||
final String? photoURL;
|
||||
|
||||
UserModel({
|
||||
required this.uid,
|
||||
this.displayName,
|
||||
this.phoneNumber,
|
||||
this.email,
|
||||
this.photoURL,
|
||||
});
|
||||
|
||||
factory UserModel.fromFirebaseUser(User user) {
|
||||
return UserModel(
|
||||
uid: user.uid,
|
||||
displayName: user.displayName,
|
||||
phoneNumber: user.phoneNumber,
|
||||
email: user.email,
|
||||
photoURL: user.photoURL,
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'UserModel(uid: $uid, displayName: $displayName, phoneNumber: $phoneNumber, email: $email, photoURL: $photoURL)';
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user