41 lines
1.1 KiB
Dart
41 lines
1.1 KiB
Dart
import 'package:be_happy/domain/entities/payment_card.dart';
|
|
|
|
import '../../domain/entities/tariff.dart';
|
|
|
|
enum TariffSheetStatus { initial, loading, success, failure }
|
|
|
|
class TariffSheetState {
|
|
final TariffSheetStatus status;
|
|
final List<Tariff> tariffs;
|
|
final String? errorMessage;
|
|
final PaymentCard? selectedCard;
|
|
final int userBalance;
|
|
final bool useBalance ;
|
|
|
|
TariffSheetState({
|
|
this.status = TariffSheetStatus.initial,
|
|
this.tariffs = const [],
|
|
this.selectedCard,
|
|
this.errorMessage,
|
|
this.userBalance = 0,
|
|
this.useBalance = false,
|
|
});
|
|
|
|
TariffSheetState copyWith({
|
|
TariffSheetStatus? status,
|
|
List<Tariff>? tariffs,
|
|
PaymentCard? selectedCard,
|
|
String? errorMessage,
|
|
int? userBalance,
|
|
bool? useBalance,
|
|
|
|
}) => TariffSheetState(
|
|
status: status ?? this.status,
|
|
tariffs: tariffs ?? this.tariffs,
|
|
selectedCard: selectedCard ?? this.selectedCard,
|
|
useBalance: useBalance ?? this.useBalance,
|
|
userBalance: userBalance ?? this.userBalance,
|
|
errorMessage: errorMessage ?? this.errorMessage,
|
|
);
|
|
}
|