new project stable version
This commit is contained in:
56
lib/presentation/state/active_ride_state.dart
Normal file
56
lib/presentation/state/active_ride_state.dart
Normal file
@@ -0,0 +1,56 @@
|
||||
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}';
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user