I think fixes downloads

This commit is contained in:
stopflock
2025-08-07 13:54:38 -05:00
parent 6d366eede2
commit 67c11969d5
3 changed files with 11 additions and 8 deletions

3
devtools_options.yaml Normal file
View File

@@ -0,0 +1,3 @@
description: This file stores settings for Dart & Flutter DevTools.
documentation: https://docs.flutter.dev/tools/devtools/extensions#configure-extension-enablement-states
extensions:

View File

@@ -131,10 +131,7 @@ class _DownloadAreaDialogState extends State<DownloadAreaDialog> {
} }
final minZoom = OfflineAreaService().findDynamicMinZoom(bounds); final minZoom = OfflineAreaService().findDynamicMinZoom(bounds);
final maxZoom = _zoom.toInt(); final maxZoom = _zoom.toInt();
final allTiles = OfflineAreaService().computeTileList(bounds, minZoom, maxZoom); final nTiles = OfflineAreaService().computeTileList(bounds, minZoom, maxZoom).length;
final worldTiles = OfflineAreaService().computeTileList(
OfflineAreaService().globalWorldBounds(), 1, 4);
final nTiles = allTiles.length + worldTiles.length;
const kbPerTile = 6.5; // Empirically ~6.5kB average for OSM tiles at z=1-19 const kbPerTile = 6.5; // Empirically ~6.5kB average for OSM tiles at z=1-19
final totalMb = (nTiles * kbPerTile) / 1024.0; final totalMb = (nTiles * kbPerTile) / 1024.0;
setState(() { setState(() {

View File

@@ -193,10 +193,13 @@ class OfflineAreaService {
await saveAreasToDisk(); await saveAreasToDisk();
try { try {
// STEP 1: Tiles (incl. global z=1..4) // STEP 1: Tiles: user areas get only their bbox/zooms; world area gets only global z=1..4
final tileTasks = computeTileList(bounds, minZoom, maxZoom); Set<List<int>> allTiles;
final globalTiles = computeTileList(globalWorldBounds(), 1, 4); if (area.isPermanent) {
final allTiles = {...tileTasks, ...globalTiles}; allTiles = computeTileList(globalWorldBounds(), 1, 4);
} else {
allTiles = computeTileList(bounds, minZoom, maxZoom);
}
area.tilesTotal = allTiles.length; area.tilesTotal = allTiles.length;
int done = 0; int done = 0;