Refactor signup page to use BLoC pattern and implement authentication repository
- Updated signup.dart to replace Provider with BLoC for state management. - Created AuthRepository to handle authentication logic and Firestore user management. - Added TripRepository and UserRepository for trip and user data management. - Implemented methods for user sign-in, sign-up, and data retrieval in repositories. - Enhanced trip management with create, update, delete, and participant management functionalities. - Updated AuthService to include new methods for sign-in and sign-up. - Removed unnecessary print statements from TripService for cleaner code. - Added dependencies for flutter_bloc and equatable in pubspec.yaml. Not tested yet
This commit is contained in:
55
lib/blocs/auth/auth_event.dart
Normal file
55
lib/blocs/auth/auth_event.dart
Normal file
@@ -0,0 +1,55 @@
|
||||
import 'package:equatable/equatable.dart';
|
||||
|
||||
abstract class AuthEvent extends Equatable {
|
||||
const AuthEvent();
|
||||
|
||||
@override
|
||||
List<Object?> get props => [];
|
||||
}
|
||||
|
||||
class AuthCheckRequested extends AuthEvent {}
|
||||
|
||||
class AuthSignInRequested extends AuthEvent {
|
||||
final String email;
|
||||
final String password;
|
||||
|
||||
const AuthSignInRequested({
|
||||
required this.email,
|
||||
required this.password,
|
||||
});
|
||||
|
||||
@override
|
||||
List<Object?> get props => [email, password];
|
||||
}
|
||||
|
||||
class AuthSignUpRequested extends AuthEvent {
|
||||
final String email;
|
||||
final String password;
|
||||
final String nom;
|
||||
final String prenom;
|
||||
|
||||
const AuthSignUpRequested({
|
||||
required this.email,
|
||||
required this.password,
|
||||
required this.nom,
|
||||
required this.prenom,
|
||||
});
|
||||
|
||||
@override
|
||||
List<Object?> get props => [email, password, nom, prenom];
|
||||
}
|
||||
|
||||
class AuthGoogleSignInRequested extends AuthEvent {}
|
||||
|
||||
class AuthAppleSignInRequested extends AuthEvent {}
|
||||
|
||||
class AuthSignOutRequested extends AuthEvent {}
|
||||
|
||||
class AuthPasswordResetRequested extends AuthEvent {
|
||||
final String email;
|
||||
|
||||
const AuthPasswordResetRequested({required this.email});
|
||||
|
||||
@override
|
||||
List<Object?> get props => [email];
|
||||
}
|
||||
Reference in New Issue
Block a user