Files
flux/lib/features/auth/bloc/auth_state.dart

36 lines
896 B
Dart
Raw Normal View History

part of 'auth_cubit.dart';
2026-04-06 10:55:56 +02:00
enum AuthStatus { initial, pwResetSent, loading, failure }
2026-04-06 10:55:56 +02:00
class AuthState extends Equatable {
final AuthStatus status;
final bool isLoginMode;
final String? errorMessage;
final AppMessage? infoMessage;
2026-04-06 10:55:56 +02:00
const AuthState({
this.status = AuthStatus.initial,
this.isLoginMode = true,
this.errorMessage,
this.infoMessage,
});
2026-04-06 10:55:56 +02:00
AuthState copyWith({
AuthStatus? status,
bool? isLoginMode,
String? errorMessage,
AppMessage? infoMessage,
}) {
2026-04-06 10:55:56 +02:00
return AuthState(
status: status ?? this.status,
isLoginMode: isLoginMode ?? this.isLoginMode,
// Se non passo esplicitamente un errore, lo resetto per evitare che rimanga bloccato a schermo
errorMessage: errorMessage,
infoMessage: infoMessage,
2026-04-06 10:55:56 +02:00
);
}
@override
List<Object?> get props => [status, isLoginMode, errorMessage, infoMessage];
2026-04-06 10:55:56 +02:00
}