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
|
||||
|
||||
Reference in New Issue
Block a user