Files
be_happy_public/lib/presentation/state/active_ride_state.dart
2026-05-12 12:02:40 +03:00

57 lines
1.4 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;
const ActiveRideState({
this.status = ActiveRideStatus.initial,
this.order,
this.errorMessage,
this.elapsedTime = Duration.zero,
this.speed = 0.0,
this.distance = 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,
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,
isPaused: isPaused ?? this.isPaused,
inZone: inZone ?? this.inZone,
);
}
@override
String toString() {
return 'ActiveRideState{status: $status, cost: $cost, isPaused: $isPaused}';
}
}