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),