Files
be_happy_public/lib/presentation/state/active_ride_state.dart
2026-05-29 11:40:55 +03:00

65 lines
1.6 KiB
Dart

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}';
}
}