fix: corrections build - _showOverlay supprime, passageDate Ulys ajoute, withValues deprecation
This commit is contained in:
@@ -7,3 +7,5 @@ SMTP_PASS="aL8@Rx8xqFrNij$a"
|
||||
# URL de l'application
|
||||
APP_URL="https://app.em2events.fr"
|
||||
|
||||
API_MAPS="AIzaSyDt2d-T9YRmHO3-QEq1uWomdqVbJqXfO04"
|
||||
|
||||
|
||||
@@ -72,11 +72,13 @@ async function getUlysTollLegs(encodedPolyline) {
|
||||
// ─────────────────────────────────────────────
|
||||
async function getUlysRate(vehicleCategory, passages) {
|
||||
try {
|
||||
const now = new Date().toISOString();
|
||||
const payload = {
|
||||
vehicleCategory: String(vehicleCategory),
|
||||
paymentOption: 2,
|
||||
tollPassages: passages.map((p) => ({
|
||||
toll: { operatorId: p.operatorId, tollId: p.tollId },
|
||||
passageDate: now,
|
||||
})),
|
||||
};
|
||||
const body = JSON.stringify(payload);
|
||||
@@ -119,17 +121,30 @@ async function calculateTollCost(encodedPolyline, vehicleCategory) {
|
||||
const tollGates = [];
|
||||
for (const feature of legsData.features) {
|
||||
const props = feature.properties || {};
|
||||
const id = props.id_gare || props.id || props.gareId;
|
||||
if (id && id.length >= 5) {
|
||||
tollGates.push({
|
||||
id,
|
||||
operatorId: id.substring(0, 2),
|
||||
tollId: id.substring(2, 5),
|
||||
name: props.nom || props.name || id,
|
||||
});
|
||||
}
|
||||
|
||||
// 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({
|
||||
id: idStr,
|
||||
operatorId: idStr.substring(0, 2),
|
||||
tollId: idStr.substring(2, 5),
|
||||
name: props.nom || props.name || props.label || idStr,
|
||||
});
|
||||
}
|
||||
|
||||
logger.info(`[Travel] Ulys /legs found ${tollGates.length} toll gates`);
|
||||
if (tollGates.length === 0) return 0;
|
||||
|
||||
// Greedy: trouver les segments fermés + barrières ouvertes
|
||||
|
||||
@@ -199,7 +199,7 @@ class _DepotManagementState extends State<DepotManagement> {
|
||||
final d = depots[i];
|
||||
return ListTile(
|
||||
leading: CircleAvatar(
|
||||
backgroundColor: AppColors.rouge.withOpacity(0.1),
|
||||
backgroundColor: AppColors.rouge.withValues(alpha: 0.1),
|
||||
child: Icon(Icons.warehouse_outlined, color: AppColors.rouge),
|
||||
),
|
||||
title: Text(d.name,
|
||||
|
||||
@@ -83,7 +83,7 @@ class _FuelPricesManagementState extends State<FuelPricesManagement> {
|
||||
return Row(
|
||||
children: [
|
||||
CircleAvatar(
|
||||
backgroundColor: color.withOpacity(0.1),
|
||||
backgroundColor: color.withValues(alpha: 0.1),
|
||||
child: Icon(icon, color: color),
|
||||
),
|
||||
const SizedBox(width: 16),
|
||||
|
||||
@@ -553,7 +553,7 @@ class _TravelCostDialogState extends State<TravelCostDialog> {
|
||||
Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 10),
|
||||
decoration: BoxDecoration(
|
||||
color: color.withOpacity(0.08),
|
||||
color: color.withValues(alpha: 0.08),
|
||||
borderRadius: const BorderRadius.vertical(top: Radius.circular(10)),
|
||||
),
|
||||
child: Row(
|
||||
|
||||
@@ -114,7 +114,6 @@ class _AddressAutocompleteFieldState extends State<AddressAutocompleteField> {
|
||||
),
|
||||
);
|
||||
overlay.insert(_overlayEntry!);
|
||||
setState(() => _showOverlay = true);
|
||||
}
|
||||
|
||||
double _getFieldWidth() {
|
||||
@@ -125,7 +124,7 @@ class _AddressAutocompleteFieldState extends State<AddressAutocompleteField> {
|
||||
void _removeOverlay() {
|
||||
_overlayEntry?.remove();
|
||||
_overlayEntry = null;
|
||||
if (mounted) setState(() => _showOverlay = false);
|
||||
if (mounted) setState(() {});
|
||||
}
|
||||
|
||||
@override
|
||||
|
||||
Reference in New Issue
Block a user