fix: flutter_map latlng bounds assertion et overflow du dropdown des depôts
This commit is contained in:
@@ -53,20 +53,9 @@ class RouteMapWidget extends StatelessWidget {
|
||||
}
|
||||
|
||||
LatLngBounds? _computeBounds(List<List<LatLng>> 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
|
||||
|
||||
@@ -303,6 +303,7 @@ class _TravelCostDialogState extends State<TravelCostDialog> {
|
||||
else
|
||||
DropdownButtonFormField<DepotModel>(
|
||||
value: _selectedDepot,
|
||||
isExpanded: true,
|
||||
decoration: const InputDecoration(
|
||||
border: OutlineInputBorder(),
|
||||
prefixIcon: Icon(Icons.warehouse_outlined),
|
||||
@@ -310,17 +311,9 @@ class _TravelCostDialogState extends State<TravelCostDialog> {
|
||||
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<TravelCostDialog> {
|
||||
else
|
||||
DropdownButtonFormField<VehicleModel>(
|
||||
value: _selectedVehicle,
|
||||
isExpanded: true,
|
||||
decoration: const InputDecoration(
|
||||
border: OutlineInputBorder(),
|
||||
prefixIcon: Icon(Icons.directions_car_outlined),
|
||||
@@ -345,7 +339,9 @@ class _TravelCostDialogState extends State<TravelCostDialog> {
|
||||
.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),
|
||||
|
||||
Reference in New Issue
Block a user