61 lines
1.6 KiB
Dart
61 lines
1.6 KiB
Dart
import 'package:intaleq_maps/intaleq_maps.dart';
|
|
|
|
class RouteData {
|
|
final List<LatLng> coordinates;
|
|
final List<Map<String, dynamic>> steps;
|
|
final double distanceM;
|
|
final double durationS;
|
|
final String points;
|
|
final String routeName;
|
|
final List<String> tags;
|
|
final String? slopeWarning;
|
|
final bool hasSteepSlope;
|
|
final double maxInclinePercent;
|
|
final double maxDeclinePercent;
|
|
final double totalAscentMeters;
|
|
final double totalDescentMeters;
|
|
final double fuelLiters;
|
|
final double fuelSavingsPercent;
|
|
final int ecoScore;
|
|
final bool isEcoFriendly;
|
|
|
|
RouteData({
|
|
required this.coordinates,
|
|
required this.steps,
|
|
required this.distanceM,
|
|
required this.durationS,
|
|
required this.points,
|
|
this.routeName = 'المسار المباشر الأسرع',
|
|
this.tags = const [],
|
|
this.slopeWarning,
|
|
this.hasSteepSlope = false,
|
|
this.maxInclinePercent = 0.0,
|
|
this.maxDeclinePercent = 0.0,
|
|
this.totalAscentMeters = 0.0,
|
|
this.totalDescentMeters = 0.0,
|
|
this.fuelLiters = 0.0,
|
|
this.fuelSavingsPercent = 0.0,
|
|
this.ecoScore = 0,
|
|
this.isEcoFriendly = false,
|
|
});
|
|
|
|
bool get isFastest => tags.contains('FASTEST');
|
|
|
|
String get formattedDistance {
|
|
if (distanceM >= 1000) {
|
|
return '${(distanceM / 1000).toStringAsFixed(1)} كم';
|
|
}
|
|
return '${distanceM.round()} م';
|
|
}
|
|
|
|
String get formattedDuration {
|
|
final int minutes = (durationS / 60).round();
|
|
if (minutes >= 60) {
|
|
final int hours = minutes ~/ 60;
|
|
final int remainingMinutes = minutes % 60;
|
|
return '$hours س $remainingMinutes د';
|
|
}
|
|
return '$minutes دقيقة';
|
|
}
|
|
}
|