Files
be_happy_public/lib/presentation/state/top_up_state.dart
2026-07-13 01:38:13 +03:00

55 lines
1.4 KiB
Dart

import 'package:be_happy/domain/entities/certificate.dart';
import 'package:be_happy/domain/entities/payment_card.dart';
sealed class TopUpState {
const 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 isAgreed;
final bool isProcessingPayment;
const TopUpLoaded({
this.certificates = const [],
this.cards = const [],
this.selectedTariff,
this.selectedCard,
this.isAgreed = false,
this.isProcessingPayment = false,
});
TopUpLoaded copyWith({
List<Certificate>? certificates,
List<PaymentCard>? cards,
Certificate? selectedTariff,
PaymentCard? selectedCard,
bool? isAgreed,
bool? isProcessingPayment,
}) {
return TopUpLoaded(
certificates: certificates ?? this.certificates,
cards: cards ?? this.cards,
selectedTariff: selectedTariff ?? this.selectedTariff,
selectedCard: selectedCard ?? this.selectedCard,
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);
}