نسخة كاملة من مستودع سيرو عند ecfe7568 لتكون أساس تطبيق «انطلق». نُسخ المتعقَّب في git فقط (12,509 ملفاً / 302 م.ب) بـ git archive، لا `cp -r` — فاستُثنيت تلقائياً مخلفات البناء (build · node_modules · .dart_tool · .gradle · Pods ≈ 10.7 غ.ب) وكل ما يستثنيه .gitignore. هذا الكوميت **بلا أي تعديل عمداً** حتى يكون كل ما يليه فرقاً مقروءاً مقابل سيرو الأصلي. سيرو نفسه لم يُمسّ. ⚠️ لا يبني بعد: `.env` و`lib/env/env.g.dart` غير متعقَّبين في سيرو (وهذا صحيح — أسرار لكل مستأجر). كل تطبيق فلاتر هنا يحتاج .env خاصاً بانطلق ثم توليد env.g.dart عبر build_runner. لا تُنسخ أسرار سيرو. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
87 lines
2.4 KiB
Dart
87 lines
2.4 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:intaleq_maps/intaleq_maps.dart';
|
|
|
|
class NavigationStep {
|
|
final String instruction;
|
|
final String maneuver;
|
|
final double distance;
|
|
final String duration;
|
|
final LatLng startLocation;
|
|
final LatLng endLocation;
|
|
final String htmlInstructions;
|
|
|
|
NavigationStep({
|
|
required this.instruction,
|
|
required this.maneuver,
|
|
required this.distance,
|
|
required this.duration,
|
|
required this.startLocation,
|
|
required this.endLocation,
|
|
required this.htmlInstructions,
|
|
});
|
|
|
|
factory NavigationStep.fromJson(Map<String, dynamic> json) {
|
|
return NavigationStep(
|
|
instruction: json['html_instructions'] ?? '',
|
|
maneuver: json['maneuver'] ?? 'straight',
|
|
distance: (json['distance']['value'] ?? 0).toDouble(),
|
|
duration: json['duration']['text'] ?? '',
|
|
startLocation: LatLng(
|
|
json['start_location']['lat'].toDouble(),
|
|
json['start_location']['lng'].toDouble(),
|
|
),
|
|
endLocation: LatLng(
|
|
json['end_location']['lat'].toDouble(),
|
|
json['end_location']['lng'].toDouble(),
|
|
),
|
|
htmlInstructions: json['html_instructions'] ?? '',
|
|
);
|
|
}
|
|
|
|
// Get clean instruction text (remove HTML tags)
|
|
String get cleanInstruction {
|
|
return instruction
|
|
.replaceAll(RegExp(r'<[^>]*>'), '')
|
|
.replaceAll(' ', ' ');
|
|
}
|
|
|
|
// Get instruction icon based on maneuver
|
|
IconData get instructionIcon {
|
|
switch (maneuver.toLowerCase()) {
|
|
case 'turn-left':
|
|
return Icons.turn_left;
|
|
case 'turn-right':
|
|
return Icons.turn_right;
|
|
case 'turn-slight-left':
|
|
return Icons.turn_slight_left;
|
|
case 'turn-slight-right':
|
|
return Icons.turn_slight_right;
|
|
case 'turn-sharp-left':
|
|
return Icons.turn_sharp_left;
|
|
case 'turn-sharp-right':
|
|
return Icons.turn_sharp_right;
|
|
case 'uturn-left':
|
|
case 'uturn-right':
|
|
return Icons.u_turn_left;
|
|
case 'straight':
|
|
return Icons.straight;
|
|
case 'ramp-left':
|
|
return Icons.ramp_left;
|
|
case 'ramp-right':
|
|
return Icons.ramp_right;
|
|
case 'merge':
|
|
return Icons.merge;
|
|
case 'fork-left':
|
|
case 'fork-right':
|
|
return Icons.call_split;
|
|
case 'ferry':
|
|
return Icons.directions_boat;
|
|
case 'roundabout-left':
|
|
case 'roundabout-right':
|
|
return Icons.roundabout_left;
|
|
default:
|
|
return Icons.navigation;
|
|
}
|
|
}
|
|
}
|