This commit is contained in:
2026-04-20 23:52:00 +02:00
parent c5b5b76bd6
commit a19fd1104f
37 changed files with 1546 additions and 428 deletions

View File

@@ -1,26 +1,35 @@
part of 'auth_bloc.dart';
part of 'auth_cubit.dart';
enum AuthStatus { initial, loading, success, failure }
enum AuthStatus { initial, loading, failure }
class AuthState extends Equatable {
final AuthStatus status;
final bool isLoginMode;
final String? errorMessage;
final String? infoMessage;
const AuthState({
required this.status,
this.error,
required this.isLoginMode,
this.status = AuthStatus.initial,
this.isLoginMode = true,
this.errorMessage,
this.infoMessage,
});
final AuthStatus status;
final String? error;
final bool isLoginMode;
@override
List<Object?> get props => [status, error, isLoginMode];
AuthState copyWith({AuthStatus? status, String? error, bool? isLoginMode}) {
AuthState copyWith({
AuthStatus? status,
bool? isLoginMode,
String? errorMessage,
String? infoMessage,
}) {
return AuthState(
status: status ?? this.status,
error: error,
isLoginMode: isLoginMode ?? this.isLoginMode,
// Se non passo esplicitamente un errore, lo resetto per evitare che rimanga bloccato a schermo
errorMessage: errorMessage,
infoMessage: infoMessage,
);
}
@override
List<Object?> get props => [status, isLoginMode, errorMessage, infoMessage];
}