This commit is contained in:
2026-07-13 01:38:13 +03:00
parent 9eda119527
commit 98c5a7a1d1
54 changed files with 860 additions and 454 deletions

View File

@@ -1,40 +1,55 @@
import 'package:be_happy/domain/entities/certificate.dart';
import 'package:be_happy/domain/entities/payment_card.dart';
import '../../domain/entities/top_up_tariff.dart';
sealed class TopUpState {
const TopUpState();
}
class TopUpState {
class TopUpLoading extends TopUpState {
const TopUpLoading();
}
class TopUpLoaded extends TopUpState {
final List<Certificate> certificates;
final List<PaymentCard> cards;
final Certificate? selectedTariff;
final PaymentCard? selectedCard;
final bool isLoading;
final bool isAgreed;
final bool isProcessingPayment;
TopUpState({
const TopUpLoaded({
this.certificates = const [],
this.cards = const [],
this.selectedTariff,
this.selectedCard,
this.isLoading = false,
this.isAgreed = false,
this.isProcessingPayment = false,
});
TopUpState copyWith({
TopUpLoaded copyWith({
List<Certificate>? certificates,
List<PaymentCard>? cards,
Certificate? selectedTariff,
PaymentCard? selectedCard,
bool? isLoading,
bool? isAgreed,
bool? isProcessingPayment,
}) {
return TopUpState(
return TopUpLoaded(
certificates: certificates ?? this.certificates,
cards: cards ?? this.cards,
selectedTariff: selectedTariff ?? this.selectedTariff,
selectedCard: selectedCard ?? this.selectedCard,
isLoading: isLoading ?? this.isLoading,
isAgreed: isAgreed ?? this.isAgreed,
isProcessingPayment: isProcessingPayment ?? this.isProcessingPayment,
);
}
}
class TopUpPaymentSuccess extends TopUpState {
const TopUpPaymentSuccess();
}
class TopUpPaymentFailure extends TopUpState {
final String errorMessage;
const TopUpPaymentFailure(this.errorMessage);
}