From 555629760d4d18e043aac893f5c3db3fa57b3309 Mon Sep 17 00:00:00 2001 From: ElPoyo Date: Thu, 4 Jun 2026 15:05:08 +0200 Subject: [PATCH] =?UTF-8?q?fix:=20flutter=5Fmap=20latlng=20bounds=20assert?= =?UTF-8?q?ion=20et=20overflow=20du=20dropdown=20des=20dep=C3=B4ts?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../widgets/common/route_map_widget.dart | 17 +++------------- .../event_form/travel_cost_dialog.dart | 20 ++++++++----------- 2 files changed, 11 insertions(+), 26 deletions(-) diff --git a/em2rp/lib/views/widgets/common/route_map_widget.dart b/em2rp/lib/views/widgets/common/route_map_widget.dart index 51b927f..39e15c7 100644 --- a/em2rp/lib/views/widgets/common/route_map_widget.dart +++ b/em2rp/lib/views/widgets/common/route_map_widget.dart @@ -53,20 +53,9 @@ class RouteMapWidget extends StatelessWidget { } LatLngBounds? _computeBounds(List> allPoints) { - double? minLat, maxLat, minLng, maxLng; - for (final pts in allPoints) { - for (final p in pts) { - minLat = minLat == null ? p.latitude : p.latitude < minLat ? p.latitude : minLat; - maxLat = maxLat == null ? p.latitude : p.latitude > maxLat ? p.latitude : maxLat; - minLng = minLng == null ? p.longitude : p.longitude < minLng ? p.longitude : minLng; - maxLng = maxLng == null ? p.longitude : p.longitude > maxLng ? p.longitude : maxLng; - } - } - if (minLat == null) return null; - return LatLngBounds( - LatLng(minLat - 0.02, minLng! - 0.02), - LatLng(maxLat! + 0.02, maxLng! + 0.02), - ); + final flat = allPoints.expand((e) => e).toList(); + if (flat.isEmpty) return null; + return LatLngBounds.fromPoints(flat); } @override diff --git a/em2rp/lib/views/widgets/event_form/travel_cost_dialog.dart b/em2rp/lib/views/widgets/event_form/travel_cost_dialog.dart index ba80c0c..22ed375 100644 --- a/em2rp/lib/views/widgets/event_form/travel_cost_dialog.dart +++ b/em2rp/lib/views/widgets/event_form/travel_cost_dialog.dart @@ -303,6 +303,7 @@ class _TravelCostDialogState extends State { else DropdownButtonFormField( value: _selectedDepot, + isExpanded: true, decoration: const InputDecoration( border: OutlineInputBorder(), prefixIcon: Icon(Icons.warehouse_outlined), @@ -310,17 +311,9 @@ class _TravelCostDialogState extends State { items: _depots .map((d) => DropdownMenuItem( value: d, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisSize: MainAxisSize.min, - children: [ - Text(d.name, - style: const TextStyle(fontWeight: FontWeight.w600)), - Text(d.address, - style: const TextStyle( - fontSize: 11, color: Colors.grey), - overflow: TextOverflow.ellipsis), - ], + child: Text( + '${d.name} — ${d.address}', + overflow: TextOverflow.ellipsis, ), )) .toList(), @@ -337,6 +330,7 @@ class _TravelCostDialogState extends State { else DropdownButtonFormField( value: _selectedVehicle, + isExpanded: true, decoration: const InputDecoration( border: OutlineInputBorder(), prefixIcon: Icon(Icons.directions_car_outlined), @@ -345,7 +339,9 @@ class _TravelCostDialogState extends State { .map((v) => DropdownMenuItem( value: v, child: Text( - '${v.name} — ${v.consumptionPer100km} ${v.consumptionUnit} | Cat. péage ${v.tollCategoryId}'), + '${v.name} — ${v.consumptionPer100km} ${v.consumptionUnit} | Cat. péage ${v.tollCategoryId}', + overflow: TextOverflow.ellipsis, + ), )) .toList(), onChanged: (v) => setState(() => _selectedVehicle = v),