fix: corrections build - _showOverlay supprime, passageDate Ulys ajoute, withValues deprecation

This commit is contained in:
ElPoyo
2026-06-04 14:32:03 +02:00
parent e14b333a67
commit 1bf5c8061f
6 changed files with 30 additions and 14 deletions
+2
View File
@@ -7,3 +7,5 @@ SMTP_PASS="aL8@Rx8xqFrNij$a"
# URL de l'application # URL de l'application
APP_URL="https://app.em2events.fr" APP_URL="https://app.em2events.fr"
API_MAPS="AIzaSyDt2d-T9YRmHO3-QEq1uWomdqVbJqXfO04"
+22 -7
View File
@@ -72,11 +72,13 @@ async function getUlysTollLegs(encodedPolyline) {
// ───────────────────────────────────────────── // ─────────────────────────────────────────────
async function getUlysRate(vehicleCategory, passages) { async function getUlysRate(vehicleCategory, passages) {
try { try {
const now = new Date().toISOString();
const payload = { const payload = {
vehicleCategory: String(vehicleCategory), vehicleCategory: String(vehicleCategory),
paymentOption: 2, paymentOption: 2,
tollPassages: passages.map((p) => ({ tollPassages: passages.map((p) => ({
toll: { operatorId: p.operatorId, tollId: p.tollId }, toll: { operatorId: p.operatorId, tollId: p.tollId },
passageDate: now,
})), })),
}; };
const body = JSON.stringify(payload); const body = JSON.stringify(payload);
@@ -119,17 +121,30 @@ async function calculateTollCost(encodedPolyline, vehicleCategory) {
const tollGates = []; const tollGates = [];
for (const feature of legsData.features) { for (const feature of legsData.features) {
const props = feature.properties || {}; const props = feature.properties || {};
const id = props.id_gare || props.id || props.gareId;
if (id && id.length >= 5) { // La réponse Ulys peut utiliser différents noms de champs
// On cherche l'identifiant de la gare dans tous les champs connus
const id =
props.id_gare ||
props.idGare ||
props.id ||
props.gareId ||
props.gare_id ||
props.tollStationId;
if (!id) continue;
const idStr = String(id);
if (idStr.length < 5) continue;
tollGates.push({ tollGates.push({
id, id: idStr,
operatorId: id.substring(0, 2), operatorId: idStr.substring(0, 2),
tollId: id.substring(2, 5), tollId: idStr.substring(2, 5),
name: props.nom || props.name || id, name: props.nom || props.name || props.label || idStr,
}); });
} }
}
logger.info(`[Travel] Ulys /legs found ${tollGates.length} toll gates`);
if (tollGates.length === 0) return 0; if (tollGates.length === 0) return 0;
// Greedy: trouver les segments fermés + barrières ouvertes // Greedy: trouver les segments fermés + barrières ouvertes
@@ -199,7 +199,7 @@ class _DepotManagementState extends State<DepotManagement> {
final d = depots[i]; final d = depots[i];
return ListTile( return ListTile(
leading: CircleAvatar( leading: CircleAvatar(
backgroundColor: AppColors.rouge.withOpacity(0.1), backgroundColor: AppColors.rouge.withValues(alpha: 0.1),
child: Icon(Icons.warehouse_outlined, color: AppColors.rouge), child: Icon(Icons.warehouse_outlined, color: AppColors.rouge),
), ),
title: Text(d.name, title: Text(d.name,
@@ -83,7 +83,7 @@ class _FuelPricesManagementState extends State<FuelPricesManagement> {
return Row( return Row(
children: [ children: [
CircleAvatar( CircleAvatar(
backgroundColor: color.withOpacity(0.1), backgroundColor: color.withValues(alpha: 0.1),
child: Icon(icon, color: color), child: Icon(icon, color: color),
), ),
const SizedBox(width: 16), const SizedBox(width: 16),
@@ -553,7 +553,7 @@ class _TravelCostDialogState extends State<TravelCostDialog> {
Container( Container(
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 10), padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 10),
decoration: BoxDecoration( decoration: BoxDecoration(
color: color.withOpacity(0.08), color: color.withValues(alpha: 0.08),
borderRadius: const BorderRadius.vertical(top: Radius.circular(10)), borderRadius: const BorderRadius.vertical(top: Radius.circular(10)),
), ),
child: Row( child: Row(
@@ -114,7 +114,6 @@ class _AddressAutocompleteFieldState extends State<AddressAutocompleteField> {
), ),
); );
overlay.insert(_overlayEntry!); overlay.insert(_overlayEntry!);
setState(() => _showOverlay = true);
} }
double _getFieldWidth() { double _getFieldWidth() {
@@ -125,7 +124,7 @@ class _AddressAutocompleteFieldState extends State<AddressAutocompleteField> {
void _removeOverlay() { void _removeOverlay() {
_overlayEntry?.remove(); _overlayEntry?.remove();
_overlayEntry = null; _overlayEntry = null;
if (mounted) setState(() => _showOverlay = false); if (mounted) setState(() {});
} }
@override @override