fix dup world area, storage estimate

This commit is contained in:
stopflock committed 2025-08-07 09:22:17 -05:00
1 parent fff1096870
commit b1d29e443d
3 files changed
+76 -10

No files matched your search

+1 -1
View File
@@ -135,7 +135,7 @@ class _DownloadAreaDialogState extends State<DownloadAreaDialog> {
final worldTiles = OfflineAreaService().computeTileList(
OfflineAreaService().globalWorldBounds(), 1, 4);
final nTiles = allTiles.length + worldTiles.length;
const kbPerTile = 25; // Average PNG tile size
const kbPerTile = 6.5; // Empirically ~6.5kB average for OSM tiles at z=1-19
final totalMb = (nTiles * kbPerTile) / 1024.0;
setState(() {
_minZoom = minZoom;
+22 -5
View File
@@ -420,10 +420,8 @@ class _OfflineAreasSectionState extends State<_OfflineAreasSection> {
} else {
subtitle += '\nTiles: ${area.tilesTotal}';
}
subtitle += ' | Size: $diskStr';
if (area.status == OfflineAreaStatus.complete) {
subtitle += ' | Cameras: ${area.cameras.length}';
}
subtitle += '\nSize: $diskStr';
subtitle += '\nCameras: ${area.cameras.length}';
return Card(
child: ListTile(
leading: Icon(area.status == OfflineAreaStatus.complete
@@ -477,7 +475,26 @@ class _OfflineAreasSectionState extends State<_OfflineAreasSection> {
}
},
),
if (area.status != OfflineAreaStatus.downloading)
if (area.isPermanent)
IconButton(
icon: const Icon(Icons.refresh, color: Colors.blue),
tooltip: 'Refresh/re-download world tiles',
onPressed: () async {
// Trigger re-download for permanent area
await service.downloadArea(
id: area.id,
bounds: area.bounds,
minZoom: area.minZoom,
maxZoom: area.maxZoom,
directory: area.directory,
name: area.name,
onProgress: (progress) {},
onComplete: (status) {},
);
setState(() {});
},
)
else if (area.status != OfflineAreaStatus.downloading)
IconButton(
icon: const Icon(Icons.delete, color: Colors.red),
tooltip: 'Delete offline area',