fix
This commit is contained in:
@@ -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);
|
||||
}
|
||||
Reference in New Issue
Block a user