Files
be_happy_public/lib/presentation/state/verify_code_state.dart
2026-05-12 12:02:40 +03:00

60 lines
1.4 KiB
Dart

class VerifyCodeState {
final String phoneNumber;
final String tempToken;
final String code;
final int secondsLeft;
final int attemptsLeft;
final bool isSubmitting;
final bool isSuccess;
final bool isBlocked;
final String? error;
VerifyCodeState({
required this.phoneNumber,
required this.tempToken,
required this.code,
required this.secondsLeft,
required this.attemptsLeft,
required this.isSubmitting,
required this.isSuccess,
required this.isBlocked,
this.error,
});
factory VerifyCodeState.initial() {
return VerifyCodeState(
phoneNumber: '',
tempToken: '',
code: '',
secondsLeft: 60,
attemptsLeft: 3,
isSubmitting: false,
isSuccess: false,
isBlocked: false,
);
}
VerifyCodeState copyWith({
String? phoneNumber,
String? tempToken,
String? code,
int? secondsLeft,
int? attemptsLeft,
bool? isSubmitting,
bool? isSuccess,
bool? isBlocked,
String? error,
}) {
return VerifyCodeState(
phoneNumber: phoneNumber ?? this.phoneNumber,
tempToken: tempToken ?? this.tempToken,
code: code ?? this.code,
secondsLeft: secondsLeft ?? this.secondsLeft,
attemptsLeft: attemptsLeft ?? this.attemptsLeft,
isSubmitting: isSubmitting ?? this.isSubmitting,
isSuccess: isSuccess ?? this.isSuccess,
isBlocked: isBlocked ?? this.isBlocked,
error: error,
);
}
}