some fix
# Conflicts: # lib/presentation/navigation/app_router.dart # pubspec.yaml
This commit is contained in:
@@ -1,64 +1,64 @@
|
||||
import '../../domain/entities/scooter_order.dart';
|
||||
|
||||
enum ActiveRideStatus { initial, loading, success, failure }
|
||||
|
||||
class ActiveRideState {
|
||||
final ActiveRideStatus status;
|
||||
final ScooterOrder? order;
|
||||
final String? errorMessage;
|
||||
final Duration elapsedTime;
|
||||
final double speed;
|
||||
final double distance;
|
||||
final double cost;
|
||||
final bool isPaused;
|
||||
final bool inZone;
|
||||
final double latitude;
|
||||
final double longitude;
|
||||
|
||||
const ActiveRideState({
|
||||
this.status = ActiveRideStatus.initial,
|
||||
this.order,
|
||||
this.errorMessage,
|
||||
this.elapsedTime = Duration.zero,
|
||||
this.speed = 0.0,
|
||||
this.distance = 0.0,
|
||||
this.latitude = 0.0,
|
||||
this.longitude = 0.0,
|
||||
this.cost = 0.0,
|
||||
this.isPaused = false,
|
||||
this.inZone = true,
|
||||
});
|
||||
|
||||
ActiveRideState copyWith({
|
||||
ActiveRideStatus? status,
|
||||
ScooterOrder? order,
|
||||
String? errorMessage,
|
||||
Duration? elapsedTime,
|
||||
double? speed,
|
||||
double? distance,
|
||||
double? cost,
|
||||
double? longitude,
|
||||
double? latitude,
|
||||
bool? isPaused,
|
||||
bool? inZone,
|
||||
}) {
|
||||
return ActiveRideState(
|
||||
status: status ?? this.status,
|
||||
order: order ?? this.order,
|
||||
errorMessage: errorMessage ?? this.errorMessage,
|
||||
elapsedTime: elapsedTime ?? this.elapsedTime,
|
||||
speed: speed ?? this.speed,
|
||||
distance: distance ?? this.distance,
|
||||
cost: cost ?? this.cost,
|
||||
latitude: latitude ?? this.latitude,
|
||||
longitude: longitude ?? this.longitude,
|
||||
isPaused: isPaused ?? this.isPaused,
|
||||
inZone: inZone ?? this.inZone,
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'ActiveRideState{status: $status, cost: $cost, isPaused: $isPaused}';
|
||||
}
|
||||
}
|
||||
import '../../domain/entities/scooter_order.dart';
|
||||
|
||||
enum ActiveRideStatus { initial, loading, success, failure }
|
||||
|
||||
class ActiveRideState {
|
||||
final ActiveRideStatus status;
|
||||
final ScooterOrder? order;
|
||||
final String? errorMessage;
|
||||
final Duration elapsedTime;
|
||||
final double speed;
|
||||
final double distance;
|
||||
final double cost;
|
||||
final bool isPaused;
|
||||
final bool inZone;
|
||||
final double latitude;
|
||||
final double longitude;
|
||||
|
||||
const ActiveRideState({
|
||||
this.status = ActiveRideStatus.initial,
|
||||
this.order,
|
||||
this.errorMessage,
|
||||
this.elapsedTime = Duration.zero,
|
||||
this.speed = 0.0,
|
||||
this.distance = 0.0,
|
||||
this.latitude = 0.0,
|
||||
this.longitude = 0.0,
|
||||
this.cost = 0.0,
|
||||
this.isPaused = false,
|
||||
this.inZone = true,
|
||||
});
|
||||
|
||||
ActiveRideState copyWith({
|
||||
ActiveRideStatus? status,
|
||||
ScooterOrder? order,
|
||||
String? errorMessage,
|
||||
Duration? elapsedTime,
|
||||
double? speed,
|
||||
double? distance,
|
||||
double? cost,
|
||||
double? longitude,
|
||||
double? latitude,
|
||||
bool? isPaused,
|
||||
bool? inZone,
|
||||
}) {
|
||||
return ActiveRideState(
|
||||
status: status ?? this.status,
|
||||
order: order ?? this.order,
|
||||
errorMessage: errorMessage ?? this.errorMessage,
|
||||
elapsedTime: elapsedTime ?? this.elapsedTime,
|
||||
speed: speed ?? this.speed,
|
||||
distance: distance ?? this.distance,
|
||||
cost: cost ?? this.cost,
|
||||
latitude: latitude ?? this.latitude,
|
||||
longitude: longitude ?? this.longitude,
|
||||
isPaused: isPaused ?? this.isPaused,
|
||||
inZone: inZone ?? this.inZone,
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'ActiveRideState{status: $status, cost: $cost, isPaused: $isPaused}';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,45 +1,45 @@
|
||||
enum AddCardStatus { initial, loading, success, failure }
|
||||
|
||||
class AddCardState {
|
||||
final AddCardStatus status;
|
||||
final String cardNumber;
|
||||
final String expiryDate;
|
||||
final String cvv;
|
||||
final String cardHolder;
|
||||
final String errorMessage;
|
||||
|
||||
const AddCardState({
|
||||
this.status = AddCardStatus.initial,
|
||||
this.cardNumber = '',
|
||||
this.expiryDate = '',
|
||||
this.cvv = '',
|
||||
this.cardHolder = '',
|
||||
this.errorMessage = '',
|
||||
});
|
||||
|
||||
AddCardState copyWith({
|
||||
AddCardStatus? status,
|
||||
String? cardNumber,
|
||||
String? expiryDate,
|
||||
String? cvv,
|
||||
String? cardHolder,
|
||||
String? errorMessage,
|
||||
}) {
|
||||
return AddCardState(
|
||||
status: status ?? this.status,
|
||||
cardNumber: cardNumber ?? this.cardNumber,
|
||||
expiryDate: expiryDate ?? this.expiryDate,
|
||||
cvv: cvv ?? this.cvv,
|
||||
cardHolder: cardHolder ?? this.cardHolder,
|
||||
errorMessage: errorMessage ?? this.errorMessage,
|
||||
);
|
||||
}
|
||||
|
||||
bool get isFormValid {
|
||||
final cleanCardNumber = cardNumber.replaceAll(' ', '');
|
||||
return cleanCardNumber.length == 16 &&
|
||||
expiryDate.length == 5 &&
|
||||
cvv.length == 3 &&
|
||||
cardHolder.trim().isNotEmpty;
|
||||
}
|
||||
enum AddCardStatus { initial, loading, success, failure }
|
||||
|
||||
class AddCardState {
|
||||
final AddCardStatus status;
|
||||
final String cardNumber;
|
||||
final String expiryDate;
|
||||
final String cvv;
|
||||
final String cardHolder;
|
||||
final String errorMessage;
|
||||
|
||||
const AddCardState({
|
||||
this.status = AddCardStatus.initial,
|
||||
this.cardNumber = '',
|
||||
this.expiryDate = '',
|
||||
this.cvv = '',
|
||||
this.cardHolder = '',
|
||||
this.errorMessage = '',
|
||||
});
|
||||
|
||||
AddCardState copyWith({
|
||||
AddCardStatus? status,
|
||||
String? cardNumber,
|
||||
String? expiryDate,
|
||||
String? cvv,
|
||||
String? cardHolder,
|
||||
String? errorMessage,
|
||||
}) {
|
||||
return AddCardState(
|
||||
status: status ?? this.status,
|
||||
cardNumber: cardNumber ?? this.cardNumber,
|
||||
expiryDate: expiryDate ?? this.expiryDate,
|
||||
cvv: cvv ?? this.cvv,
|
||||
cardHolder: cardHolder ?? this.cardHolder,
|
||||
errorMessage: errorMessage ?? this.errorMessage,
|
||||
);
|
||||
}
|
||||
|
||||
bool get isFormValid {
|
||||
final cleanCardNumber = cardNumber.replaceAll(' ', '');
|
||||
return cleanCardNumber.length == 16 &&
|
||||
expiryDate.length == 5 &&
|
||||
cvv.length == 3 &&
|
||||
cardHolder.trim().isNotEmpty;
|
||||
}
|
||||
}
|
||||
@@ -1,45 +1,45 @@
|
||||
class PhoneAuthState {
|
||||
final String phone;
|
||||
final bool isAdult;
|
||||
final bool privacyAccepted;
|
||||
final bool isSubmitting;
|
||||
final bool isSuccess;
|
||||
final String? error;
|
||||
|
||||
PhoneAuthState({
|
||||
required this.phone,
|
||||
required this.isAdult,
|
||||
required this.privacyAccepted,
|
||||
required this.isSubmitting,
|
||||
required this.isSuccess,
|
||||
this.error,
|
||||
});
|
||||
|
||||
factory PhoneAuthState.initial() {
|
||||
return PhoneAuthState(
|
||||
phone: '',
|
||||
isAdult: false,
|
||||
privacyAccepted: false,
|
||||
isSubmitting: false,
|
||||
isSuccess: false,
|
||||
);
|
||||
}
|
||||
|
||||
PhoneAuthState copyWith({
|
||||
String? phone,
|
||||
bool? isAdult,
|
||||
bool? privacyAccepted,
|
||||
bool? isSubmitting,
|
||||
bool? isSuccess,
|
||||
String? error,
|
||||
}) {
|
||||
return PhoneAuthState(
|
||||
phone: phone ?? this.phone,
|
||||
isAdult: isAdult ?? this.isAdult,
|
||||
privacyAccepted: privacyAccepted ?? this.privacyAccepted,
|
||||
isSubmitting: isSubmitting ?? this.isSubmitting,
|
||||
isSuccess: isSuccess ?? this.isSuccess,
|
||||
error: error,
|
||||
);
|
||||
}
|
||||
class PhoneAuthState {
|
||||
final String phone;
|
||||
final bool isAdult;
|
||||
final bool privacyAccepted;
|
||||
final bool isSubmitting;
|
||||
final bool isSuccess;
|
||||
final String? error;
|
||||
|
||||
PhoneAuthState({
|
||||
required this.phone,
|
||||
required this.isAdult,
|
||||
required this.privacyAccepted,
|
||||
required this.isSubmitting,
|
||||
required this.isSuccess,
|
||||
this.error,
|
||||
});
|
||||
|
||||
factory PhoneAuthState.initial() {
|
||||
return PhoneAuthState(
|
||||
phone: '',
|
||||
isAdult: false,
|
||||
privacyAccepted: false,
|
||||
isSubmitting: false,
|
||||
isSuccess: false,
|
||||
);
|
||||
}
|
||||
|
||||
PhoneAuthState copyWith({
|
||||
String? phone,
|
||||
bool? isAdult,
|
||||
bool? privacyAccepted,
|
||||
bool? isSubmitting,
|
||||
bool? isSuccess,
|
||||
String? error,
|
||||
}) {
|
||||
return PhoneAuthState(
|
||||
phone: phone ?? this.phone,
|
||||
isAdult: isAdult ?? this.isAdult,
|
||||
privacyAccepted: privacyAccepted ?? this.privacyAccepted,
|
||||
isSubmitting: isSubmitting ?? this.isSubmitting,
|
||||
isSuccess: isSuccess ?? this.isSuccess,
|
||||
error: error,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,27 +1,27 @@
|
||||
import '../../domain/entities/scooter_order.dart';
|
||||
|
||||
enum CurrentRidesStatus { initial, loading, success, failure }
|
||||
|
||||
class CurrentRidesState {
|
||||
final CurrentRidesStatus status;
|
||||
final List<ScooterOrder> orders;
|
||||
final String? errorMessage;
|
||||
|
||||
const CurrentRidesState({
|
||||
this.status = CurrentRidesStatus.initial,
|
||||
this.orders = const [],
|
||||
this.errorMessage,
|
||||
});
|
||||
|
||||
CurrentRidesState copyWith({
|
||||
CurrentRidesStatus? status,
|
||||
List<ScooterOrder>? orders,
|
||||
String? errorMessage,
|
||||
}) {
|
||||
return CurrentRidesState(
|
||||
status: status ?? this.status,
|
||||
orders: orders ?? this.orders,
|
||||
errorMessage: errorMessage ?? this.errorMessage,
|
||||
);
|
||||
}
|
||||
}
|
||||
import '../../domain/entities/scooter_order.dart';
|
||||
|
||||
enum CurrentRidesStatus { initial, loading, success, failure }
|
||||
|
||||
class CurrentRidesState {
|
||||
final CurrentRidesStatus status;
|
||||
final List<ScooterOrder> orders;
|
||||
final String? errorMessage;
|
||||
|
||||
const CurrentRidesState({
|
||||
this.status = CurrentRidesStatus.initial,
|
||||
this.orders = const [],
|
||||
this.errorMessage,
|
||||
});
|
||||
|
||||
CurrentRidesState copyWith({
|
||||
CurrentRidesStatus? status,
|
||||
List<ScooterOrder>? orders,
|
||||
String? errorMessage,
|
||||
}) {
|
||||
return CurrentRidesState(
|
||||
status: status ?? this.status,
|
||||
orders: orders ?? this.orders,
|
||||
errorMessage: errorMessage ?? this.errorMessage,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,42 +1,42 @@
|
||||
import '../../domain/entities/user_profile.dart';
|
||||
|
||||
class EditProfileState {
|
||||
final bool isSaving;
|
||||
final bool isSuccess;
|
||||
final bool isLoading;
|
||||
final UserProfile? profile;
|
||||
final String? error;
|
||||
|
||||
const EditProfileState({
|
||||
required this.isSaving,
|
||||
required this.isSuccess,
|
||||
required this.isLoading,
|
||||
this.profile,
|
||||
this.error,
|
||||
});
|
||||
|
||||
factory EditProfileState.initial() {
|
||||
return const EditProfileState(
|
||||
isSaving: false,
|
||||
isSuccess: false,
|
||||
isLoading: false,
|
||||
);
|
||||
}
|
||||
|
||||
EditProfileState copyWith({
|
||||
bool? isSaving,
|
||||
bool? isSuccess,
|
||||
bool? isLoading,
|
||||
UserProfile? profile,
|
||||
String? error,
|
||||
}) {
|
||||
return EditProfileState(
|
||||
isSaving: isSaving ?? this.isSaving,
|
||||
isSuccess: isSuccess ?? this.isSuccess,
|
||||
isLoading: isLoading ?? this.isLoading,
|
||||
profile: profile ?? this.profile,
|
||||
error: error,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
import '../../domain/entities/user_profile.dart';
|
||||
|
||||
class EditProfileState {
|
||||
final bool isSaving;
|
||||
final bool isSuccess;
|
||||
final bool isLoading;
|
||||
final UserProfile? profile;
|
||||
final String? error;
|
||||
|
||||
const EditProfileState({
|
||||
required this.isSaving,
|
||||
required this.isSuccess,
|
||||
required this.isLoading,
|
||||
this.profile,
|
||||
this.error,
|
||||
});
|
||||
|
||||
factory EditProfileState.initial() {
|
||||
return const EditProfileState(
|
||||
isSaving: false,
|
||||
isSuccess: false,
|
||||
isLoading: false,
|
||||
);
|
||||
}
|
||||
|
||||
EditProfileState copyWith({
|
||||
bool? isSaving,
|
||||
bool? isSuccess,
|
||||
bool? isLoading,
|
||||
UserProfile? profile,
|
||||
String? error,
|
||||
}) {
|
||||
return EditProfileState(
|
||||
isSaving: isSaving ?? this.isSaving,
|
||||
isSuccess: isSuccess ?? this.isSuccess,
|
||||
isLoading: isLoading ?? this.isLoading,
|
||||
profile: profile ?? this.profile,
|
||||
error: error,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
56
lib/presentation/state/fine_payment_state.dart
Normal file
56
lib/presentation/state/fine_payment_state.dart
Normal file
@@ -0,0 +1,56 @@
|
||||
import 'package:equatable/equatable.dart';
|
||||
import '../../domain/entities/fine.dart';
|
||||
import '../../domain/entities/payment_card.dart';
|
||||
|
||||
enum FinePaymentStatus { initial, loading, success, failure }
|
||||
|
||||
class FinePaymentState extends Equatable {
|
||||
final FinePaymentStatus status;
|
||||
final Fine? fine;
|
||||
final PaymentCard? selectedCard;
|
||||
final bool useBalance;
|
||||
final double userBalance;
|
||||
final String? errorMessage;
|
||||
final bool paymentCompleted;
|
||||
|
||||
const FinePaymentState({
|
||||
this.status = FinePaymentStatus.initial,
|
||||
this.fine,
|
||||
this.selectedCard,
|
||||
this.useBalance = false,
|
||||
this.userBalance = 0.0,
|
||||
this.errorMessage,
|
||||
this.paymentCompleted = false,
|
||||
});
|
||||
|
||||
FinePaymentState copyWith({
|
||||
FinePaymentStatus? status,
|
||||
Fine? fine,
|
||||
PaymentCard? selectedCard,
|
||||
bool? useBalance,
|
||||
double? userBalance,
|
||||
String? errorMessage,
|
||||
bool? paymentCompleted,
|
||||
}) {
|
||||
return FinePaymentState(
|
||||
status: status ?? this.status,
|
||||
fine: fine ?? this.fine,
|
||||
selectedCard: selectedCard ?? this.selectedCard,
|
||||
useBalance: useBalance ?? this.useBalance,
|
||||
userBalance: userBalance ?? this.userBalance,
|
||||
errorMessage: errorMessage,
|
||||
paymentCompleted: paymentCompleted ?? this.paymentCompleted,
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
List<Object?> get props => [
|
||||
status,
|
||||
fine,
|
||||
selectedCard,
|
||||
useBalance,
|
||||
userBalance,
|
||||
errorMessage,
|
||||
paymentCompleted,
|
||||
];
|
||||
}
|
||||
@@ -1,29 +1,29 @@
|
||||
class MapSettingsModalState {
|
||||
final bool isAllGeomarksActive;
|
||||
final bool isAllGeozonesActive;
|
||||
final bool isRestrictedDrivingZoneActive;
|
||||
final bool isParkingZoneActive;
|
||||
final bool isRestrictedParkingZoneActive;
|
||||
|
||||
MapSettingsModalState({
|
||||
required this.isAllGeomarksActive,
|
||||
required this.isAllGeozonesActive,
|
||||
required this.isRestrictedDrivingZoneActive,
|
||||
required this.isParkingZoneActive,
|
||||
required this.isRestrictedParkingZoneActive,
|
||||
});
|
||||
|
||||
MapSettingsModalState copyWith({
|
||||
bool? isGeomarksActive,
|
||||
bool? isAllGeozonesActive,
|
||||
bool? isRestrictedDrivingZoneActive,
|
||||
bool? isParkingZoneActive,
|
||||
bool? isRestrictedParkingZoneActive,
|
||||
}) => MapSettingsModalState(
|
||||
isAllGeomarksActive: isGeomarksActive ?? this.isAllGeomarksActive,
|
||||
isAllGeozonesActive: isAllGeozonesActive ?? this.isAllGeozonesActive,
|
||||
isRestrictedDrivingZoneActive: isRestrictedDrivingZoneActive ?? this.isRestrictedDrivingZoneActive,
|
||||
isParkingZoneActive: isParkingZoneActive ?? this.isParkingZoneActive,
|
||||
isRestrictedParkingZoneActive: isRestrictedParkingZoneActive ?? this.isRestrictedParkingZoneActive,
|
||||
);
|
||||
}
|
||||
class MapSettingsModalState {
|
||||
final bool isAllGeomarksActive;
|
||||
final bool isAllGeozonesActive;
|
||||
final bool isRestrictedDrivingZoneActive;
|
||||
final bool isParkingZoneActive;
|
||||
final bool isRestrictedParkingZoneActive;
|
||||
|
||||
MapSettingsModalState({
|
||||
required this.isAllGeomarksActive,
|
||||
required this.isAllGeozonesActive,
|
||||
required this.isRestrictedDrivingZoneActive,
|
||||
required this.isParkingZoneActive,
|
||||
required this.isRestrictedParkingZoneActive,
|
||||
});
|
||||
|
||||
MapSettingsModalState copyWith({
|
||||
bool? isGeomarksActive,
|
||||
bool? isAllGeozonesActive,
|
||||
bool? isRestrictedDrivingZoneActive,
|
||||
bool? isParkingZoneActive,
|
||||
bool? isRestrictedParkingZoneActive,
|
||||
}) => MapSettingsModalState(
|
||||
isAllGeomarksActive: isGeomarksActive ?? this.isAllGeomarksActive,
|
||||
isAllGeozonesActive: isAllGeozonesActive ?? this.isAllGeozonesActive,
|
||||
isRestrictedDrivingZoneActive: isRestrictedDrivingZoneActive ?? this.isRestrictedDrivingZoneActive,
|
||||
isParkingZoneActive: isParkingZoneActive ?? this.isParkingZoneActive,
|
||||
isRestrictedParkingZoneActive: isRestrictedParkingZoneActive ?? this.isRestrictedParkingZoneActive,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,76 +1,76 @@
|
||||
import 'package:be_happy/domain/entities/user_check_flags.dart';
|
||||
|
||||
import '../../domain/entities/point.dart';
|
||||
import '../../domain/entities/scooter.dart';
|
||||
import '../../domain/entities/zone.dart';
|
||||
import '../../domain/entities/client_notification.dart';
|
||||
|
||||
enum ScooterStatus { initial, loading, success, failure }
|
||||
|
||||
class ScooterState {
|
||||
final List<Scooter> scooters;
|
||||
final List<Scooter> reservedScooters;
|
||||
final Scooter? selectedScooterForFocus;
|
||||
final List<Zone> zones;
|
||||
final List<double> area;
|
||||
final List<double> areaScooters;
|
||||
final ScooterStatus status;
|
||||
final bool isGeomarksShowed;
|
||||
final String? address;
|
||||
final String? errorMessage;
|
||||
final String phoneNumber;
|
||||
final double balance;
|
||||
final UserCheckFlags flags;
|
||||
final ClientNotification? lastNotification;
|
||||
|
||||
ScooterState({
|
||||
this.scooters = const [],
|
||||
this.reservedScooters = const [],
|
||||
this.selectedScooterForFocus,
|
||||
this.zones = const [],
|
||||
this.area = const [],
|
||||
this.areaScooters = const [],
|
||||
this.status = ScooterStatus.initial,
|
||||
required this.isGeomarksShowed,
|
||||
this.address,
|
||||
this.errorMessage,
|
||||
this.phoneNumber = "+375XXXXXXXXX",
|
||||
this.balance = 999,
|
||||
this.flags = const UserCheckFlags(hasFine: false, hasUnpaidOrder: false, hasCard: false),
|
||||
this.lastNotification,
|
||||
});
|
||||
|
||||
ScooterState copyWith({
|
||||
List<Scooter>? scooters,
|
||||
List<Scooter>? reservedScooters,
|
||||
Scooter? selectedScooterForFocus,
|
||||
List<Zone>? zones,
|
||||
List<double>? area,
|
||||
List<double>? areaScooters,
|
||||
ScooterStatus? status,
|
||||
bool? isGeomarksShowed,
|
||||
String? address,
|
||||
String? errorMessage,
|
||||
String? phoneNumber,
|
||||
double? balance,
|
||||
UserCheckFlags? flags,
|
||||
ClientNotification? lastNotification,
|
||||
}) {
|
||||
return ScooterState(
|
||||
scooters: scooters ?? this.scooters,
|
||||
reservedScooters: reservedScooters ?? this.reservedScooters,
|
||||
selectedScooterForFocus: selectedScooterForFocus ?? this.selectedScooterForFocus,
|
||||
zones: zones ?? this.zones,
|
||||
area: area ?? this.area,
|
||||
areaScooters: areaScooters ?? this.areaScooters,
|
||||
status: status ?? this.status,
|
||||
address: address ?? this.address,
|
||||
isGeomarksShowed: isGeomarksShowed?? this.isGeomarksShowed,
|
||||
errorMessage: errorMessage ?? this.errorMessage,
|
||||
phoneNumber: phoneNumber ?? this.phoneNumber,
|
||||
balance: balance ?? this.balance,
|
||||
flags: flags ?? this.flags,
|
||||
lastNotification: lastNotification ?? this.lastNotification,
|
||||
);
|
||||
}
|
||||
}
|
||||
import 'package:be_happy/domain/entities/user_check_flags.dart';
|
||||
|
||||
import '../../domain/entities/point.dart';
|
||||
import '../../domain/entities/scooter.dart';
|
||||
import '../../domain/entities/zone.dart';
|
||||
import '../../domain/entities/client_notification.dart';
|
||||
|
||||
enum ScooterStatus { initial, loading, success, failure }
|
||||
|
||||
class ScooterState {
|
||||
final List<Scooter> scooters;
|
||||
final List<Scooter> reservedScooters;
|
||||
final Scooter? selectedScooterForFocus;
|
||||
final List<Zone> zones;
|
||||
final List<double> area;
|
||||
final List<double> areaScooters;
|
||||
final ScooterStatus status;
|
||||
final bool isGeomarksShowed;
|
||||
final String? address;
|
||||
final String? errorMessage;
|
||||
final String phoneNumber;
|
||||
final double balance;
|
||||
final UserCheckFlags flags;
|
||||
final ClientNotification? lastNotification;
|
||||
|
||||
ScooterState({
|
||||
this.scooters = const [],
|
||||
this.reservedScooters = const [],
|
||||
this.selectedScooterForFocus,
|
||||
this.zones = const [],
|
||||
this.area = const [],
|
||||
this.areaScooters = const [],
|
||||
this.status = ScooterStatus.initial,
|
||||
required this.isGeomarksShowed,
|
||||
this.address,
|
||||
this.errorMessage,
|
||||
this.phoneNumber = "+375XXXXXXXXX",
|
||||
this.balance = 999,
|
||||
this.flags = const UserCheckFlags(hasFine: false, hasUnpaidOrder: false, hasCard: false),
|
||||
this.lastNotification,
|
||||
});
|
||||
|
||||
ScooterState copyWith({
|
||||
List<Scooter>? scooters,
|
||||
List<Scooter>? reservedScooters,
|
||||
Scooter? selectedScooterForFocus,
|
||||
List<Zone>? zones,
|
||||
List<double>? area,
|
||||
List<double>? areaScooters,
|
||||
ScooterStatus? status,
|
||||
bool? isGeomarksShowed,
|
||||
String? address,
|
||||
String? errorMessage,
|
||||
String? phoneNumber,
|
||||
double? balance,
|
||||
UserCheckFlags? flags,
|
||||
ClientNotification? lastNotification,
|
||||
}) {
|
||||
return ScooterState(
|
||||
scooters: scooters ?? this.scooters,
|
||||
reservedScooters: reservedScooters ?? this.reservedScooters,
|
||||
selectedScooterForFocus: selectedScooterForFocus ?? this.selectedScooterForFocus,
|
||||
zones: zones ?? this.zones,
|
||||
area: area ?? this.area,
|
||||
areaScooters: areaScooters ?? this.areaScooters,
|
||||
status: status ?? this.status,
|
||||
address: address ?? this.address,
|
||||
isGeomarksShowed: isGeomarksShowed?? this.isGeomarksShowed,
|
||||
errorMessage: errorMessage ?? this.errorMessage,
|
||||
phoneNumber: phoneNumber ?? this.phoneNumber,
|
||||
balance: balance ?? this.balance,
|
||||
flags: flags ?? this.flags,
|
||||
lastNotification: lastNotification ?? this.lastNotification,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,31 +1,31 @@
|
||||
import '../../../domain/entities/news.dart';
|
||||
|
||||
enum NewsStatus { initial, loading, success, failure }
|
||||
|
||||
class NewsState {
|
||||
final NewsStatus status;
|
||||
final List<NewsEntity> news;
|
||||
final String? errorMessage;
|
||||
|
||||
const NewsState({
|
||||
required this.status,
|
||||
this.news = const [],
|
||||
this.errorMessage,
|
||||
});
|
||||
|
||||
NewsState copyWith({
|
||||
NewsStatus? status,
|
||||
List<NewsEntity>? news,
|
||||
String? errorMessage,
|
||||
}) {
|
||||
return NewsState(
|
||||
status: status ?? this.status,
|
||||
news: news ?? this.news,
|
||||
errorMessage: errorMessage ?? this.errorMessage,
|
||||
);
|
||||
}
|
||||
|
||||
bool get isLoading => status == NewsStatus.loading;
|
||||
bool get isSuccess => status == NewsStatus.success;
|
||||
bool get isFailure => status == NewsStatus.failure;
|
||||
import '../../../domain/entities/news.dart';
|
||||
|
||||
enum NewsStatus { initial, loading, success, failure }
|
||||
|
||||
class NewsState {
|
||||
final NewsStatus status;
|
||||
final List<NewsEntity> news;
|
||||
final String? errorMessage;
|
||||
|
||||
const NewsState({
|
||||
required this.status,
|
||||
this.news = const [],
|
||||
this.errorMessage,
|
||||
});
|
||||
|
||||
NewsState copyWith({
|
||||
NewsStatus? status,
|
||||
List<NewsEntity>? news,
|
||||
String? errorMessage,
|
||||
}) {
|
||||
return NewsState(
|
||||
status: status ?? this.status,
|
||||
news: news ?? this.news,
|
||||
errorMessage: errorMessage ?? this.errorMessage,
|
||||
);
|
||||
}
|
||||
|
||||
bool get isLoading => status == NewsStatus.loading;
|
||||
bool get isSuccess => status == NewsStatus.success;
|
||||
bool get isFailure => status == NewsStatus.failure;
|
||||
}
|
||||
@@ -1,43 +1,43 @@
|
||||
import '../../domain/entities/client_notification.dart';
|
||||
|
||||
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,
|
||||
);
|
||||
}
|
||||
import '../../domain/entities/client_notification.dart';
|
||||
|
||||
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,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,45 +1,45 @@
|
||||
import 'package:be_happy/domain/entities/payment_card.dart';
|
||||
|
||||
import '../../domain/entities/scooter_order.dart';
|
||||
|
||||
enum PaymentConfirmStatus { initial, loading, success, failure }
|
||||
|
||||
class PaymentConfirmState {
|
||||
final PaymentConfirmStatus status;
|
||||
final PaymentCard? selectedCard;
|
||||
final String? errorMessage;
|
||||
final bool paymentCompleted;
|
||||
final ScooterOrder? order;
|
||||
final bool useBalance;
|
||||
final double userBalance;
|
||||
|
||||
const PaymentConfirmState({
|
||||
this.status = PaymentConfirmStatus.initial,
|
||||
this.errorMessage,
|
||||
this.selectedCard,
|
||||
this.paymentCompleted = false,
|
||||
this.order,
|
||||
this.useBalance = false,
|
||||
this.userBalance = 0,
|
||||
});
|
||||
|
||||
PaymentConfirmState copyWith({
|
||||
PaymentConfirmStatus? status,
|
||||
String? errorMessage,
|
||||
PaymentCard? selectedCard,
|
||||
bool? paymentCompleted,
|
||||
ScooterOrder? order,
|
||||
bool? useBalance,
|
||||
double? userBalance,
|
||||
}) {
|
||||
return PaymentConfirmState(
|
||||
status: status ?? this.status,
|
||||
errorMessage: errorMessage ?? this.errorMessage,
|
||||
selectedCard: selectedCard ?? this.selectedCard,
|
||||
paymentCompleted: paymentCompleted ?? this.paymentCompleted,
|
||||
order: order ?? this.order,
|
||||
useBalance: useBalance ?? this.useBalance,
|
||||
userBalance: userBalance ?? this.userBalance,
|
||||
);
|
||||
}
|
||||
import 'package:be_happy/domain/entities/payment_card.dart';
|
||||
|
||||
import '../../domain/entities/scooter_order.dart';
|
||||
|
||||
enum PaymentConfirmStatus { initial, loading, success, failure }
|
||||
|
||||
class PaymentConfirmState {
|
||||
final PaymentConfirmStatus status;
|
||||
final PaymentCard? selectedCard;
|
||||
final String? errorMessage;
|
||||
final bool paymentCompleted;
|
||||
final ScooterOrder? order;
|
||||
final bool useBalance;
|
||||
final double userBalance;
|
||||
|
||||
const PaymentConfirmState({
|
||||
this.status = PaymentConfirmStatus.initial,
|
||||
this.errorMessage,
|
||||
this.selectedCard,
|
||||
this.paymentCompleted = false,
|
||||
this.order,
|
||||
this.useBalance = false,
|
||||
this.userBalance = 0,
|
||||
});
|
||||
|
||||
PaymentConfirmState copyWith({
|
||||
PaymentConfirmStatus? status,
|
||||
String? errorMessage,
|
||||
PaymentCard? selectedCard,
|
||||
bool? paymentCompleted,
|
||||
ScooterOrder? order,
|
||||
bool? useBalance,
|
||||
double? userBalance,
|
||||
}) {
|
||||
return PaymentConfirmState(
|
||||
status: status ?? this.status,
|
||||
errorMessage: errorMessage ?? this.errorMessage,
|
||||
selectedCard: selectedCard ?? this.selectedCard,
|
||||
paymentCompleted: paymentCompleted ?? this.paymentCompleted,
|
||||
order: order ?? this.order,
|
||||
useBalance: useBalance ?? this.useBalance,
|
||||
userBalance: userBalance ?? this.userBalance,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,30 +1,30 @@
|
||||
import '../../domain/entities/payment_card.dart';
|
||||
|
||||
enum PaymentMethodSheetStatus { initial, loading, success, failure }
|
||||
|
||||
class PaymentMethodSheetState {
|
||||
final PaymentMethodSheetStatus status;
|
||||
final List<PaymentCard> cards;
|
||||
final double balance;
|
||||
final String? errorMessage;
|
||||
|
||||
PaymentMethodSheetState({
|
||||
this.status = PaymentMethodSheetStatus.initial,
|
||||
this.cards = const [],
|
||||
this.balance = 0,
|
||||
this.errorMessage,
|
||||
});
|
||||
|
||||
PaymentMethodSheetState copyWith({
|
||||
PaymentMethodSheetStatus? status,
|
||||
List<PaymentCard>? cards,
|
||||
double? balance,
|
||||
String? errorMessage,
|
||||
}) =>
|
||||
PaymentMethodSheetState(
|
||||
status: status ?? this.status,
|
||||
cards: cards ?? this.cards,
|
||||
balance: balance ?? this.balance,
|
||||
errorMessage: errorMessage ?? this.errorMessage,
|
||||
);
|
||||
}
|
||||
import '../../domain/entities/payment_card.dart';
|
||||
|
||||
enum PaymentMethodSheetStatus { initial, loading, success, failure }
|
||||
|
||||
class PaymentMethodSheetState {
|
||||
final PaymentMethodSheetStatus status;
|
||||
final List<PaymentCard> cards;
|
||||
final double balance;
|
||||
final String? errorMessage;
|
||||
|
||||
PaymentMethodSheetState({
|
||||
this.status = PaymentMethodSheetStatus.initial,
|
||||
this.cards = const [],
|
||||
this.balance = 0,
|
||||
this.errorMessage,
|
||||
});
|
||||
|
||||
PaymentMethodSheetState copyWith({
|
||||
PaymentMethodSheetStatus? status,
|
||||
List<PaymentCard>? cards,
|
||||
double? balance,
|
||||
String? errorMessage,
|
||||
}) =>
|
||||
PaymentMethodSheetState(
|
||||
status: status ?? this.status,
|
||||
cards: cards ?? this.cards,
|
||||
balance: balance ?? this.balance,
|
||||
errorMessage: errorMessage ?? this.errorMessage,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,38 +1,38 @@
|
||||
import '../../domain/entities/payment_card.dart';
|
||||
|
||||
enum PaymentMethodsStatus { initial, loading, success, failure }
|
||||
|
||||
class PaymentMethodsState {
|
||||
final PaymentMethodsStatus status;
|
||||
final List<PaymentCard> cards;
|
||||
final double balance;
|
||||
final String? errorMessage;
|
||||
final bool isDeleting;
|
||||
final bool isSettingMain;
|
||||
|
||||
PaymentMethodsState({
|
||||
this.status = PaymentMethodsStatus.initial,
|
||||
this.cards = const [],
|
||||
this.balance = 99,
|
||||
this.errorMessage,
|
||||
this.isDeleting = false,
|
||||
this.isSettingMain = false,
|
||||
});
|
||||
|
||||
PaymentMethodsState copyWith({
|
||||
PaymentMethodsStatus? status,
|
||||
List<PaymentCard>? cards,
|
||||
double? balance,
|
||||
String? errorMessage,
|
||||
bool? isDeleting,
|
||||
bool? isSettingMain,
|
||||
}) =>
|
||||
PaymentMethodsState(
|
||||
status: status ?? this.status,
|
||||
cards: cards ?? this.cards,
|
||||
balance: balance ?? this.balance,
|
||||
errorMessage: errorMessage ?? this.errorMessage,
|
||||
isDeleting: isDeleting ?? this.isDeleting,
|
||||
isSettingMain: isSettingMain ?? this.isSettingMain,
|
||||
);
|
||||
}
|
||||
import '../../domain/entities/payment_card.dart';
|
||||
|
||||
enum PaymentMethodsStatus { initial, loading, success, failure }
|
||||
|
||||
class PaymentMethodsState {
|
||||
final PaymentMethodsStatus status;
|
||||
final List<PaymentCard> cards;
|
||||
final double balance;
|
||||
final String? errorMessage;
|
||||
final bool isDeleting;
|
||||
final bool isSettingMain;
|
||||
|
||||
PaymentMethodsState({
|
||||
this.status = PaymentMethodsStatus.initial,
|
||||
this.cards = const [],
|
||||
this.balance = 99,
|
||||
this.errorMessage,
|
||||
this.isDeleting = false,
|
||||
this.isSettingMain = false,
|
||||
});
|
||||
|
||||
PaymentMethodsState copyWith({
|
||||
PaymentMethodsStatus? status,
|
||||
List<PaymentCard>? cards,
|
||||
double? balance,
|
||||
String? errorMessage,
|
||||
bool? isDeleting,
|
||||
bool? isSettingMain,
|
||||
}) =>
|
||||
PaymentMethodsState(
|
||||
status: status ?? this.status,
|
||||
cards: cards ?? this.cards,
|
||||
balance: balance ?? this.balance,
|
||||
errorMessage: errorMessage ?? this.errorMessage,
|
||||
isDeleting: isDeleting ?? this.isDeleting,
|
||||
isSettingMain: isSettingMain ?? this.isSettingMain,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,27 +1,27 @@
|
||||
sealed class PinState {
|
||||
final String pin;
|
||||
final String? error;
|
||||
|
||||
const PinState({required this.pin, this.error});
|
||||
}
|
||||
|
||||
// Состояние создания нового ПИН-кода
|
||||
class PinCreateInProgress extends PinState {
|
||||
const PinCreateInProgress({required String pin, String? error})
|
||||
: super(pin: pin, error: error);
|
||||
}
|
||||
|
||||
// Состояние ввода существующего ПИН-кода для входа
|
||||
class PinLoginInProgress extends PinState {
|
||||
const PinLoginInProgress({required String pin, String? error})
|
||||
: super(pin: pin, error: error);
|
||||
}
|
||||
|
||||
// Технические состояния
|
||||
class PinLoading extends PinState {
|
||||
const PinLoading() : super(pin: '');
|
||||
}
|
||||
|
||||
class PinSuccess extends PinState {
|
||||
const PinSuccess() : super(pin: '');
|
||||
sealed class PinState {
|
||||
final String pin;
|
||||
final String? error;
|
||||
|
||||
const PinState({required this.pin, this.error});
|
||||
}
|
||||
|
||||
// Состояние создания нового ПИН-кода
|
||||
class PinCreateInProgress extends PinState {
|
||||
const PinCreateInProgress({required String pin, String? error})
|
||||
: super(pin: pin, error: error);
|
||||
}
|
||||
|
||||
// Состояние ввода существующего ПИН-кода для входа
|
||||
class PinLoginInProgress extends PinState {
|
||||
const PinLoginInProgress({required String pin, String? error})
|
||||
: super(pin: pin, error: error);
|
||||
}
|
||||
|
||||
// Технические состояния
|
||||
class PinLoading extends PinState {
|
||||
const PinLoading() : super(pin: '');
|
||||
}
|
||||
|
||||
class PinSuccess extends PinState {
|
||||
const PinSuccess() : super(pin: '');
|
||||
}
|
||||
@@ -1,29 +1,29 @@
|
||||
import '../../domain/entities/user_profile.dart';
|
||||
|
||||
class ProfileState {
|
||||
final bool isLoading;
|
||||
final UserProfile? profile;
|
||||
final String? error;
|
||||
|
||||
const ProfileState({
|
||||
required this.isLoading,
|
||||
this.profile,
|
||||
this.error,
|
||||
});
|
||||
|
||||
factory ProfileState.initial() {
|
||||
return const ProfileState(isLoading: true);
|
||||
}
|
||||
|
||||
ProfileState copyWith({
|
||||
bool? isLoading,
|
||||
UserProfile? profile,
|
||||
String? error,
|
||||
}) {
|
||||
return ProfileState(
|
||||
isLoading: isLoading ?? this.isLoading,
|
||||
profile: profile ?? this.profile,
|
||||
error: error,
|
||||
);
|
||||
}
|
||||
}
|
||||
import '../../domain/entities/user_profile.dart';
|
||||
|
||||
class ProfileState {
|
||||
final bool isLoading;
|
||||
final UserProfile? profile;
|
||||
final String? error;
|
||||
|
||||
const ProfileState({
|
||||
required this.isLoading,
|
||||
this.profile,
|
||||
this.error,
|
||||
});
|
||||
|
||||
factory ProfileState.initial() {
|
||||
return const ProfileState(isLoading: true);
|
||||
}
|
||||
|
||||
ProfileState copyWith({
|
||||
bool? isLoading,
|
||||
UserProfile? profile,
|
||||
String? error,
|
||||
}) {
|
||||
return ProfileState(
|
||||
isLoading: isLoading ?? this.isLoading,
|
||||
profile: profile ?? this.profile,
|
||||
error: error,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,25 +1,25 @@
|
||||
enum PromoCodeStatus { initial, loading, success, failure }
|
||||
|
||||
class PromoCodeState {
|
||||
final PromoCodeStatus status;
|
||||
final double? newBalance;
|
||||
final String? errorMessage;
|
||||
|
||||
const PromoCodeState({
|
||||
this.status = PromoCodeStatus.initial,
|
||||
this.newBalance,
|
||||
this.errorMessage,
|
||||
});
|
||||
|
||||
PromoCodeState copyWith({
|
||||
PromoCodeStatus? status,
|
||||
double? newBalance,
|
||||
String? errorMessage,
|
||||
}) {
|
||||
return PromoCodeState(
|
||||
status: status ?? this.status,
|
||||
newBalance: newBalance ?? this.newBalance,
|
||||
errorMessage: errorMessage ?? this.errorMessage,
|
||||
);
|
||||
}
|
||||
enum PromoCodeStatus { initial, loading, success, failure }
|
||||
|
||||
class PromoCodeState {
|
||||
final PromoCodeStatus status;
|
||||
final double? newBalance;
|
||||
final String? errorMessage;
|
||||
|
||||
const PromoCodeState({
|
||||
this.status = PromoCodeStatus.initial,
|
||||
this.newBalance,
|
||||
this.errorMessage,
|
||||
});
|
||||
|
||||
PromoCodeState copyWith({
|
||||
PromoCodeStatus? status,
|
||||
double? newBalance,
|
||||
String? errorMessage,
|
||||
}) {
|
||||
return PromoCodeState(
|
||||
status: status ?? this.status,
|
||||
newBalance: newBalance ?? this.newBalance,
|
||||
errorMessage: errorMessage ?? this.errorMessage,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,29 +1,29 @@
|
||||
enum ReservedRideStatus { initial, loading, success, failure }
|
||||
|
||||
class ReservedRideState {
|
||||
final ReservedRideStatus status;
|
||||
final String? errorMessage;
|
||||
final bool rideStarted;
|
||||
final bool rideCancelled;
|
||||
|
||||
const ReservedRideState({
|
||||
this.status = ReservedRideStatus.initial,
|
||||
this.errorMessage,
|
||||
this.rideStarted = false,
|
||||
this.rideCancelled = false,
|
||||
});
|
||||
|
||||
ReservedRideState copyWith({
|
||||
ReservedRideStatus? status,
|
||||
String? errorMessage,
|
||||
bool? rideStarted,
|
||||
bool? rideCancelled,
|
||||
}) {
|
||||
return ReservedRideState(
|
||||
status: status ?? this.status,
|
||||
errorMessage: errorMessage ?? this.errorMessage,
|
||||
rideStarted: rideStarted ?? this.rideStarted,
|
||||
rideCancelled: rideCancelled ?? this.rideCancelled,
|
||||
);
|
||||
}
|
||||
}
|
||||
enum ReservedRideStatus { initial, loading, success, failure }
|
||||
|
||||
class ReservedRideState {
|
||||
final ReservedRideStatus status;
|
||||
final String? errorMessage;
|
||||
final bool rideStarted;
|
||||
final bool rideCancelled;
|
||||
|
||||
const ReservedRideState({
|
||||
this.status = ReservedRideStatus.initial,
|
||||
this.errorMessage,
|
||||
this.rideStarted = false,
|
||||
this.rideCancelled = false,
|
||||
});
|
||||
|
||||
ReservedRideState copyWith({
|
||||
ReservedRideStatus? status,
|
||||
String? errorMessage,
|
||||
bool? rideStarted,
|
||||
bool? rideCancelled,
|
||||
}) {
|
||||
return ReservedRideState(
|
||||
status: status ?? this.status,
|
||||
errorMessage: errorMessage ?? this.errorMessage,
|
||||
rideStarted: rideStarted ?? this.rideStarted,
|
||||
rideCancelled: rideCancelled ?? this.rideCancelled,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
// route_state.dart
|
||||
import '../../domain/entities/point.dart';
|
||||
|
||||
abstract class RouteState {}
|
||||
|
||||
class RouteInitial extends RouteState {}
|
||||
|
||||
class RouteLoading extends RouteState {}
|
||||
|
||||
class RouteLoaded extends RouteState {
|
||||
final List<Point> points;
|
||||
RouteLoaded(this.points);
|
||||
}
|
||||
|
||||
class RouteError extends RouteState {
|
||||
final String message;
|
||||
RouteError(this.message);
|
||||
// route_state.dart
|
||||
import '../../domain/entities/point.dart';
|
||||
|
||||
abstract class RouteState {}
|
||||
|
||||
class RouteInitial extends RouteState {}
|
||||
|
||||
class RouteLoading extends RouteState {}
|
||||
|
||||
class RouteLoaded extends RouteState {
|
||||
final List<Point> points;
|
||||
RouteLoaded(this.points);
|
||||
}
|
||||
|
||||
class RouteError extends RouteState {
|
||||
final String message;
|
||||
RouteError(this.message);
|
||||
}
|
||||
@@ -1,23 +1,27 @@
|
||||
abstract class ScooterCodeState {
|
||||
final String code;
|
||||
final String? error;
|
||||
|
||||
const ScooterCodeState({this.code = '', this.error});
|
||||
}
|
||||
|
||||
class ScooterCodeInitial extends ScooterCodeState {
|
||||
const ScooterCodeInitial({super.code, super.error});
|
||||
}
|
||||
|
||||
class ScooterCodeLoading extends ScooterCodeState {
|
||||
const ScooterCodeLoading({super.code});
|
||||
}
|
||||
|
||||
class ScooterCodeSuccess extends ScooterCodeState {
|
||||
final dynamic scooter; // Замените dynamic на вашу модель Scooter
|
||||
const ScooterCodeSuccess(this.scooter, {super.code});
|
||||
}
|
||||
|
||||
class ScooterCodeFailure extends ScooterCodeState {
|
||||
const ScooterCodeFailure(String error, {super.code}) : super(error: error);
|
||||
import '../../domain/entities/scooter.dart';
|
||||
|
||||
abstract class ScooterCodeState {
|
||||
final String code;
|
||||
final String? error;
|
||||
|
||||
const ScooterCodeState({this.code = '', this.error});
|
||||
}
|
||||
|
||||
class ScooterCodeInitial extends ScooterCodeState {
|
||||
const ScooterCodeInitial({super.code, super.error});
|
||||
}
|
||||
|
||||
class ScooterCodeLoading extends ScooterCodeState {
|
||||
const ScooterCodeLoading({super.code});
|
||||
}
|
||||
|
||||
class ScooterCodeSuccess extends ScooterCodeState {
|
||||
final Scooter scooter;
|
||||
final String address;
|
||||
final double distance;
|
||||
const ScooterCodeSuccess(this.scooter, {super.code, required this.address, required this.distance});
|
||||
}
|
||||
|
||||
class ScooterCodeFailure extends ScooterCodeState {
|
||||
const ScooterCodeFailure(String error, {super.code}) : super(error: error);
|
||||
}
|
||||
@@ -1,32 +1,32 @@
|
||||
|
||||
import '../../domain/entities/scooter.dart';
|
||||
|
||||
enum ScooterDetailModalStatus { initial, loading, success, failure }
|
||||
|
||||
class ScooterDetailModalState {
|
||||
final ScooterDetailModalStatus status;
|
||||
final String? address;
|
||||
final String? errorMessage;
|
||||
final List<Scooter>? scooters;
|
||||
|
||||
ScooterDetailModalState({
|
||||
this.status = ScooterDetailModalStatus.initial,
|
||||
this.address,
|
||||
this.errorMessage,
|
||||
this.scooters,
|
||||
});
|
||||
|
||||
ScooterDetailModalState copyWith({
|
||||
ScooterDetailModalStatus? status,
|
||||
double? distance,
|
||||
String? address,
|
||||
String? errorMessage,
|
||||
List<Scooter>? scooters,
|
||||
|
||||
}) => ScooterDetailModalState(
|
||||
status: status ?? this.status,
|
||||
address: address ?? this.address,
|
||||
errorMessage: errorMessage ?? this.errorMessage,
|
||||
scooters: scooters ?? this.scooters,
|
||||
);
|
||||
|
||||
import '../../domain/entities/scooter.dart';
|
||||
|
||||
enum ScooterDetailModalStatus { initial, loading, success, failure }
|
||||
|
||||
class ScooterDetailModalState {
|
||||
final ScooterDetailModalStatus status;
|
||||
final String? address;
|
||||
final String? errorMessage;
|
||||
final List<Scooter>? scooters;
|
||||
|
||||
ScooterDetailModalState({
|
||||
this.status = ScooterDetailModalStatus.initial,
|
||||
this.address,
|
||||
this.errorMessage,
|
||||
this.scooters,
|
||||
});
|
||||
|
||||
ScooterDetailModalState copyWith({
|
||||
ScooterDetailModalStatus? status,
|
||||
double? distance,
|
||||
String? address,
|
||||
String? errorMessage,
|
||||
List<Scooter>? scooters,
|
||||
|
||||
}) => ScooterDetailModalState(
|
||||
status: status ?? this.status,
|
||||
address: address ?? this.address,
|
||||
errorMessage: errorMessage ?? this.errorMessage,
|
||||
scooters: scooters ?? this.scooters,
|
||||
);
|
||||
}
|
||||
@@ -1,27 +1,27 @@
|
||||
import '../../domain/entities/scooter.dart';
|
||||
|
||||
enum ScooterStatus { initial, loading, success, failure }
|
||||
|
||||
class ScooterDetailState {
|
||||
final ScooterStatus status;
|
||||
final Scooter? scooter;
|
||||
final String? errorMessage;
|
||||
|
||||
const ScooterDetailState({
|
||||
this.status = ScooterStatus.initial,
|
||||
this.scooter,
|
||||
this.errorMessage,
|
||||
});
|
||||
|
||||
ScooterDetailState copyWith({
|
||||
ScooterStatus? status,
|
||||
Scooter? scooter,
|
||||
String? errorMessage,
|
||||
}) {
|
||||
return ScooterDetailState(
|
||||
status: status ?? this.status,
|
||||
scooter: scooter ?? this.scooter,
|
||||
errorMessage: errorMessage ?? this.errorMessage,
|
||||
);
|
||||
}
|
||||
}
|
||||
import '../../domain/entities/scooter.dart';
|
||||
|
||||
enum ScooterStatus { initial, loading, success, failure }
|
||||
|
||||
class ScooterDetailState {
|
||||
final ScooterStatus status;
|
||||
final Scooter? scooter;
|
||||
final String? errorMessage;
|
||||
|
||||
const ScooterDetailState({
|
||||
this.status = ScooterStatus.initial,
|
||||
this.scooter,
|
||||
this.errorMessage,
|
||||
});
|
||||
|
||||
ScooterDetailState copyWith({
|
||||
ScooterStatus? status,
|
||||
Scooter? scooter,
|
||||
String? errorMessage,
|
||||
}) {
|
||||
return ScooterDetailState(
|
||||
status: status ?? this.status,
|
||||
scooter: scooter ?? this.scooter,
|
||||
errorMessage: errorMessage ?? this.errorMessage,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,31 +1,31 @@
|
||||
enum SendPhotoStatus { initial, loading, success, failure }
|
||||
|
||||
class SendPhotoState {
|
||||
final SendPhotoStatus status;
|
||||
final List<String> selectedImages;
|
||||
final List<int> recievedPhotoIds;
|
||||
final String errorMessage;
|
||||
|
||||
const SendPhotoState({
|
||||
this.status = SendPhotoStatus.initial,
|
||||
this.selectedImages = const [],
|
||||
this.recievedPhotoIds = const [],
|
||||
this.errorMessage = '',
|
||||
});
|
||||
|
||||
SendPhotoState copyWith({
|
||||
SendPhotoStatus? status,
|
||||
List<String>? selectedImages,
|
||||
List<int>? recievedPhotoIds,
|
||||
String? errorMessage,
|
||||
}) {
|
||||
return SendPhotoState(
|
||||
status: status ?? this.status,
|
||||
selectedImages: selectedImages ?? this.selectedImages,
|
||||
recievedPhotoIds: recievedPhotoIds ?? this.recievedPhotoIds,
|
||||
errorMessage: errorMessage ?? this.errorMessage,
|
||||
);
|
||||
}
|
||||
|
||||
bool get hasSelectedImages => selectedImages.isNotEmpty;
|
||||
}
|
||||
enum SendPhotoStatus { initial, loading, success, failure }
|
||||
|
||||
class SendPhotoState {
|
||||
final SendPhotoStatus status;
|
||||
final List<String> selectedImages;
|
||||
final List<int> recievedPhotoIds;
|
||||
final String errorMessage;
|
||||
|
||||
const SendPhotoState({
|
||||
this.status = SendPhotoStatus.initial,
|
||||
this.selectedImages = const [],
|
||||
this.recievedPhotoIds = const [],
|
||||
this.errorMessage = '',
|
||||
});
|
||||
|
||||
SendPhotoState copyWith({
|
||||
SendPhotoStatus? status,
|
||||
List<String>? selectedImages,
|
||||
List<int>? recievedPhotoIds,
|
||||
String? errorMessage,
|
||||
}) {
|
||||
return SendPhotoState(
|
||||
status: status ?? this.status,
|
||||
selectedImages: selectedImages ?? this.selectedImages,
|
||||
recievedPhotoIds: recievedPhotoIds ?? this.recievedPhotoIds,
|
||||
errorMessage: errorMessage ?? this.errorMessage,
|
||||
);
|
||||
}
|
||||
|
||||
bool get hasSelectedImages => selectedImages.isNotEmpty;
|
||||
}
|
||||
|
||||
@@ -1,25 +1,25 @@
|
||||
import 'package:equatable/equatable.dart';
|
||||
|
||||
abstract class SplashState extends Equatable {
|
||||
const SplashState();
|
||||
|
||||
@override
|
||||
List<Object> get props => [];
|
||||
}
|
||||
|
||||
// Начальное состояние, когда мы еще не знаем, авторизован ли пользователь
|
||||
class AuthInitial extends SplashState {}
|
||||
|
||||
class AuthInProgress extends SplashState {}
|
||||
|
||||
// Пользователь успешно авторизован (токен обновлен)
|
||||
class AuthAuthenticated extends SplashState {}
|
||||
|
||||
// Пользователь не авторизован (нет токена или его не удалось обновить)
|
||||
class AuthUnauthenticated extends SplashState {}
|
||||
|
||||
// успешно ввел пин код
|
||||
class AuthPinVerified extends SplashState {}
|
||||
|
||||
// Специальное состояние для первого запуска приложения
|
||||
class AuthFirstLaunch extends SplashState {}
|
||||
import 'package:equatable/equatable.dart';
|
||||
|
||||
abstract class SplashState extends Equatable {
|
||||
const SplashState();
|
||||
|
||||
@override
|
||||
List<Object> get props => [];
|
||||
}
|
||||
|
||||
// Начальное состояние, когда мы еще не знаем, авторизован ли пользователь
|
||||
class AuthInitial extends SplashState {}
|
||||
|
||||
class AuthInProgress extends SplashState {}
|
||||
|
||||
// Пользователь успешно авторизован (токен обновлен)
|
||||
class AuthAuthenticated extends SplashState {}
|
||||
|
||||
// Пользователь не авторизован (нет токена или его не удалось обновить)
|
||||
class AuthUnauthenticated extends SplashState {}
|
||||
|
||||
// успешно ввел пин код
|
||||
class AuthPinVerified extends SplashState {}
|
||||
|
||||
// Специальное состояние для первого запуска приложения
|
||||
class AuthFirstLaunch extends SplashState {}
|
||||
|
||||
@@ -1,22 +1,22 @@
|
||||
import 'package:be_happy/domain/entities/client_subscription.dart';
|
||||
|
||||
import '../../domain/entities/subscription.dart';
|
||||
|
||||
abstract class SubscriptionState {}
|
||||
|
||||
class SubscriptionsLoading extends SubscriptionState {}
|
||||
|
||||
class SubscriptionsLoaded extends SubscriptionState {
|
||||
final List<Subscription> subscriptions;
|
||||
final List<ClientSubscription> activeSubscriptions;
|
||||
|
||||
SubscriptionsLoaded({
|
||||
required this.subscriptions,
|
||||
required this.activeSubscriptions,
|
||||
});
|
||||
}
|
||||
|
||||
class SubscriptionsError extends SubscriptionState {
|
||||
final String message;
|
||||
SubscriptionsError(this.message);
|
||||
import 'package:be_happy/domain/entities/client_subscription.dart';
|
||||
|
||||
import '../../domain/entities/subscription.dart';
|
||||
|
||||
abstract class SubscriptionState {}
|
||||
|
||||
class SubscriptionsLoading extends SubscriptionState {}
|
||||
|
||||
class SubscriptionsLoaded extends SubscriptionState {
|
||||
final List<Subscription> subscriptions;
|
||||
final List<ClientSubscription> activeSubscriptions;
|
||||
|
||||
SubscriptionsLoaded({
|
||||
required this.subscriptions,
|
||||
required this.activeSubscriptions,
|
||||
});
|
||||
}
|
||||
|
||||
class SubscriptionsError extends SubscriptionState {
|
||||
final String message;
|
||||
SubscriptionsError(this.message);
|
||||
}
|
||||
@@ -1,51 +1,51 @@
|
||||
import 'package:be_happy/domain/entities/payment_card.dart';
|
||||
import 'package:be_happy/domain/entities/subscription.dart';
|
||||
|
||||
import '../../domain/entities/subscription_period.dart';
|
||||
|
||||
abstract class SubscriptionDetailsState {}
|
||||
|
||||
class DetailsLoading extends SubscriptionDetailsState {}
|
||||
|
||||
class DetailsError extends SubscriptionDetailsState {
|
||||
final String message;
|
||||
|
||||
DetailsError(this.message);
|
||||
}
|
||||
|
||||
class DetailsContentState extends SubscriptionDetailsState {
|
||||
final Subscription subscription;
|
||||
final SubscriptionPeriod selectedPeriod;
|
||||
final List<PaymentCard> cards;
|
||||
final PaymentCard selectedCard;
|
||||
final bool isAgreed;
|
||||
final bool isAlreadyPurchased;
|
||||
final bool isSuccess;
|
||||
|
||||
DetailsContentState({
|
||||
required this.subscription,
|
||||
required this.selectedPeriod,
|
||||
required this.selectedCard,
|
||||
this.cards = const [],
|
||||
this.isAgreed = false,
|
||||
this.isAlreadyPurchased = false,
|
||||
this.isSuccess = false,
|
||||
});
|
||||
|
||||
DetailsContentState copyWith({
|
||||
SubscriptionPeriod? selectedPeriod,
|
||||
PaymentCard? selectedCard,
|
||||
bool? isAgreed,
|
||||
bool? isAlreadyPurchased,
|
||||
bool? isSuccess,
|
||||
}) {
|
||||
return DetailsContentState(
|
||||
subscription: this.subscription,
|
||||
selectedPeriod: selectedPeriod ?? this.selectedPeriod,
|
||||
selectedCard: selectedCard ?? this.selectedCard,
|
||||
isAgreed: isAgreed ?? this.isAgreed,
|
||||
isAlreadyPurchased: isAlreadyPurchased ?? this.isAlreadyPurchased,
|
||||
isSuccess: isSuccess ?? this.isSuccess,
|
||||
);
|
||||
}
|
||||
}
|
||||
import 'package:be_happy/domain/entities/payment_card.dart';
|
||||
import 'package:be_happy/domain/entities/subscription.dart';
|
||||
|
||||
import '../../domain/entities/subscription_period.dart';
|
||||
|
||||
abstract class SubscriptionDetailsState {}
|
||||
|
||||
class DetailsLoading extends SubscriptionDetailsState {}
|
||||
|
||||
class DetailsError extends SubscriptionDetailsState {
|
||||
final String message;
|
||||
|
||||
DetailsError(this.message);
|
||||
}
|
||||
|
||||
class DetailsContentState extends SubscriptionDetailsState {
|
||||
final Subscription subscription;
|
||||
final SubscriptionPeriod selectedPeriod;
|
||||
final List<PaymentCard> cards;
|
||||
final PaymentCard selectedCard;
|
||||
final bool isAgreed;
|
||||
final bool isAlreadyPurchased;
|
||||
final bool isSuccess;
|
||||
|
||||
DetailsContentState({
|
||||
required this.subscription,
|
||||
required this.selectedPeriod,
|
||||
required this.selectedCard,
|
||||
this.cards = const [],
|
||||
this.isAgreed = false,
|
||||
this.isAlreadyPurchased = false,
|
||||
this.isSuccess = false,
|
||||
});
|
||||
|
||||
DetailsContentState copyWith({
|
||||
SubscriptionPeriod? selectedPeriod,
|
||||
PaymentCard? selectedCard,
|
||||
bool? isAgreed,
|
||||
bool? isAlreadyPurchased,
|
||||
bool? isSuccess,
|
||||
}) {
|
||||
return DetailsContentState(
|
||||
subscription: this.subscription,
|
||||
selectedPeriod: selectedPeriod ?? this.selectedPeriod,
|
||||
selectedCard: selectedCard ?? this.selectedCard,
|
||||
isAgreed: isAgreed ?? this.isAgreed,
|
||||
isAlreadyPurchased: isAlreadyPurchased ?? this.isAlreadyPurchased,
|
||||
isSuccess: isSuccess ?? this.isSuccess,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,44 +1,44 @@
|
||||
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 bool isInsurance;
|
||||
final double userBalance;
|
||||
final bool useBalance ;
|
||||
|
||||
TariffSheetState({
|
||||
this.status = TariffSheetStatus.initial,
|
||||
this.tariffs = const [],
|
||||
this.selectedCard,
|
||||
this.isInsurance = false,
|
||||
this.errorMessage,
|
||||
this.userBalance = 0,
|
||||
this.useBalance = false,
|
||||
});
|
||||
|
||||
TariffSheetState copyWith({
|
||||
TariffSheetStatus? status,
|
||||
List<Tariff>? tariffs,
|
||||
PaymentCard? selectedCard,
|
||||
String? errorMessage,
|
||||
bool? isInsurance,
|
||||
double? userBalance,
|
||||
bool? useBalance,
|
||||
|
||||
}) => TariffSheetState(
|
||||
status: status ?? this.status,
|
||||
tariffs: tariffs ?? this.tariffs,
|
||||
selectedCard: selectedCard ?? this.selectedCard,
|
||||
useBalance: useBalance ?? this.useBalance,
|
||||
userBalance: userBalance ?? this.userBalance,
|
||||
isInsurance: isInsurance ?? this.isInsurance,
|
||||
errorMessage: errorMessage ?? this.errorMessage,
|
||||
);
|
||||
}
|
||||
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 bool isInsurance;
|
||||
final double userBalance;
|
||||
final bool useBalance ;
|
||||
|
||||
TariffSheetState({
|
||||
this.status = TariffSheetStatus.initial,
|
||||
this.tariffs = const [],
|
||||
this.selectedCard,
|
||||
this.isInsurance = false,
|
||||
this.errorMessage,
|
||||
this.userBalance = 0,
|
||||
this.useBalance = false,
|
||||
});
|
||||
|
||||
TariffSheetState copyWith({
|
||||
TariffSheetStatus? status,
|
||||
List<Tariff>? tariffs,
|
||||
PaymentCard? selectedCard,
|
||||
String? errorMessage,
|
||||
bool? isInsurance,
|
||||
double? userBalance,
|
||||
bool? useBalance,
|
||||
|
||||
}) => TariffSheetState(
|
||||
status: status ?? this.status,
|
||||
tariffs: tariffs ?? this.tariffs,
|
||||
selectedCard: selectedCard ?? this.selectedCard,
|
||||
useBalance: useBalance ?? this.useBalance,
|
||||
userBalance: userBalance ?? this.userBalance,
|
||||
isInsurance: isInsurance ?? this.isInsurance,
|
||||
errorMessage: errorMessage ?? this.errorMessage,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,55 +1,55 @@
|
||||
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);
|
||||
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);
|
||||
}
|
||||
@@ -1,60 +1,60 @@
|
||||
class VerifyCodeState {
|
||||
final String phoneNumber;
|
||||
final String tempToken;
|
||||
final String code;
|
||||
final int secondsLeft;
|
||||
final int attemptsLeft;
|
||||
final bool isSubmitting;
|
||||
final bool isSuccess;
|
||||
final bool isBlocked;
|
||||
final String? error;
|
||||
|
||||
VerifyCodeState({
|
||||
required this.phoneNumber,
|
||||
required this.tempToken,
|
||||
required this.code,
|
||||
required this.secondsLeft,
|
||||
required this.attemptsLeft,
|
||||
required this.isSubmitting,
|
||||
required this.isSuccess,
|
||||
required this.isBlocked,
|
||||
this.error,
|
||||
});
|
||||
|
||||
factory VerifyCodeState.initial() {
|
||||
return VerifyCodeState(
|
||||
phoneNumber: '',
|
||||
tempToken: '',
|
||||
code: '',
|
||||
secondsLeft: 60,
|
||||
attemptsLeft: 3,
|
||||
isSubmitting: false,
|
||||
isSuccess: false,
|
||||
isBlocked: false,
|
||||
);
|
||||
}
|
||||
|
||||
VerifyCodeState copyWith({
|
||||
String? phoneNumber,
|
||||
String? tempToken,
|
||||
String? code,
|
||||
int? secondsLeft,
|
||||
int? attemptsLeft,
|
||||
bool? isSubmitting,
|
||||
bool? isSuccess,
|
||||
bool? isBlocked,
|
||||
String? error,
|
||||
}) {
|
||||
return VerifyCodeState(
|
||||
phoneNumber: phoneNumber ?? this.phoneNumber,
|
||||
tempToken: tempToken ?? this.tempToken,
|
||||
code: code ?? this.code,
|
||||
secondsLeft: secondsLeft ?? this.secondsLeft,
|
||||
attemptsLeft: attemptsLeft ?? this.attemptsLeft,
|
||||
isSubmitting: isSubmitting ?? this.isSubmitting,
|
||||
isSuccess: isSuccess ?? this.isSuccess,
|
||||
isBlocked: isBlocked ?? this.isBlocked,
|
||||
error: error,
|
||||
);
|
||||
}
|
||||
class VerifyCodeState {
|
||||
final String phoneNumber;
|
||||
final String tempToken;
|
||||
final String code;
|
||||
final int secondsLeft;
|
||||
final int attemptsLeft;
|
||||
final bool isSubmitting;
|
||||
final bool isSuccess;
|
||||
final bool isBlocked;
|
||||
final String? error;
|
||||
|
||||
VerifyCodeState({
|
||||
required this.phoneNumber,
|
||||
required this.tempToken,
|
||||
required this.code,
|
||||
required this.secondsLeft,
|
||||
required this.attemptsLeft,
|
||||
required this.isSubmitting,
|
||||
required this.isSuccess,
|
||||
required this.isBlocked,
|
||||
this.error,
|
||||
});
|
||||
|
||||
factory VerifyCodeState.initial() {
|
||||
return VerifyCodeState(
|
||||
phoneNumber: '',
|
||||
tempToken: '',
|
||||
code: '',
|
||||
secondsLeft: 60,
|
||||
attemptsLeft: 3,
|
||||
isSubmitting: false,
|
||||
isSuccess: false,
|
||||
isBlocked: false,
|
||||
);
|
||||
}
|
||||
|
||||
VerifyCodeState copyWith({
|
||||
String? phoneNumber,
|
||||
String? tempToken,
|
||||
String? code,
|
||||
int? secondsLeft,
|
||||
int? attemptsLeft,
|
||||
bool? isSubmitting,
|
||||
bool? isSuccess,
|
||||
bool? isBlocked,
|
||||
String? error,
|
||||
}) {
|
||||
return VerifyCodeState(
|
||||
phoneNumber: phoneNumber ?? this.phoneNumber,
|
||||
tempToken: tempToken ?? this.tempToken,
|
||||
code: code ?? this.code,
|
||||
secondsLeft: secondsLeft ?? this.secondsLeft,
|
||||
attemptsLeft: attemptsLeft ?? this.attemptsLeft,
|
||||
isSubmitting: isSubmitting ?? this.isSubmitting,
|
||||
isSuccess: isSuccess ?? this.isSuccess,
|
||||
isBlocked: isBlocked ?? this.isBlocked,
|
||||
error: error,
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user