fix
This commit is contained in:
@@ -19,7 +19,7 @@ class ScooterState {
|
||||
final String? address;
|
||||
final String? errorMessage;
|
||||
final String phoneNumber;
|
||||
final int balance;
|
||||
final double balance;
|
||||
final UserCheckFlags flags;
|
||||
final ClientNotification? lastNotification;
|
||||
|
||||
@@ -52,7 +52,7 @@ class ScooterState {
|
||||
String? address,
|
||||
String? errorMessage,
|
||||
String? phoneNumber,
|
||||
int? balance,
|
||||
double? balance,
|
||||
UserCheckFlags? flags,
|
||||
ClientNotification? lastNotification,
|
||||
}) {
|
||||
|
||||
@@ -1,27 +1,43 @@
|
||||
import '../../domain/entities/client_notification.dart';
|
||||
|
||||
enum NotificationsStatus { initial, loading, success, failure }
|
||||
enum NotificationsStatus { initial, loading, loadingMore, success, failure }
|
||||
|
||||
class NotificationsState {
|
||||
final NotificationsStatus status;
|
||||
final List<ClientNotification> notifications;
|
||||
final String? errorMessage;
|
||||
final int currentPage;
|
||||
final int totalPages;
|
||||
final bool hasMore;
|
||||
final bool isLoadingMore;
|
||||
|
||||
const NotificationsState({
|
||||
this.status = NotificationsStatus.initial,
|
||||
this.notifications = const [],
|
||||
this.errorMessage,
|
||||
this.currentPage = 1,
|
||||
this.totalPages = 1,
|
||||
this.hasMore = true,
|
||||
this.isLoadingMore = false,
|
||||
});
|
||||
|
||||
NotificationsState copyWith({
|
||||
NotificationsStatus? status,
|
||||
List<ClientNotification>? notifications,
|
||||
String? errorMessage,
|
||||
int? currentPage,
|
||||
int? totalPages,
|
||||
bool? hasMore,
|
||||
bool? isLoadingMore,
|
||||
}) {
|
||||
return NotificationsState(
|
||||
status: status ?? this.status,
|
||||
notifications: notifications ?? this.notifications,
|
||||
errorMessage: errorMessage ?? this.errorMessage,
|
||||
currentPage: currentPage ?? this.currentPage,
|
||||
totalPages: totalPages ?? this.totalPages,
|
||||
hasMore: hasMore ?? this.hasMore,
|
||||
isLoadingMore: isLoadingMore ?? this.isLoadingMore,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -11,7 +11,7 @@ class PaymentConfirmState {
|
||||
final bool paymentCompleted;
|
||||
final ScooterOrder? order;
|
||||
final bool useBalance;
|
||||
final int userBalance;
|
||||
final double userBalance;
|
||||
|
||||
const PaymentConfirmState({
|
||||
this.status = PaymentConfirmStatus.initial,
|
||||
@@ -30,7 +30,7 @@ class PaymentConfirmState {
|
||||
bool? paymentCompleted,
|
||||
ScooterOrder? order,
|
||||
bool? useBalance,
|
||||
int? userBalance,
|
||||
double? userBalance,
|
||||
}) {
|
||||
return PaymentConfirmState(
|
||||
status: status ?? this.status,
|
||||
|
||||
@@ -11,7 +11,7 @@ class PaymentMethodSheetState {
|
||||
PaymentMethodSheetState({
|
||||
this.status = PaymentMethodSheetStatus.initial,
|
||||
this.cards = const [],
|
||||
this.balance = 0.0,
|
||||
this.balance = 0,
|
||||
this.errorMessage,
|
||||
});
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ enum PaymentMethodsStatus { initial, loading, success, failure }
|
||||
class PaymentMethodsState {
|
||||
final PaymentMethodsStatus status;
|
||||
final List<PaymentCard> cards;
|
||||
final int balance;
|
||||
final double balance;
|
||||
final String? errorMessage;
|
||||
final bool isDeleting;
|
||||
final bool isSettingMain;
|
||||
@@ -22,7 +22,7 @@ class PaymentMethodsState {
|
||||
PaymentMethodsState copyWith({
|
||||
PaymentMethodsStatus? status,
|
||||
List<PaymentCard>? cards,
|
||||
int? balance,
|
||||
double? balance,
|
||||
String? errorMessage,
|
||||
bool? isDeleting,
|
||||
bool? isSettingMain,
|
||||
|
||||
@@ -10,7 +10,7 @@ class TariffSheetState {
|
||||
final String? errorMessage;
|
||||
final PaymentCard? selectedCard;
|
||||
final bool isInsurance;
|
||||
final int userBalance;
|
||||
final double userBalance;
|
||||
final bool useBalance ;
|
||||
|
||||
TariffSheetState({
|
||||
@@ -29,7 +29,7 @@ class TariffSheetState {
|
||||
PaymentCard? selectedCard,
|
||||
String? errorMessage,
|
||||
bool? isInsurance,
|
||||
int? userBalance,
|
||||
double? userBalance,
|
||||
bool? useBalance,
|
||||
|
||||
}) => TariffSheetState(
|
||||
|
||||
@@ -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