Add symbol for offline available sheets

This commit is contained in:
2026-07-03 17:46:50 +02:00
parent e3ee24e06b
commit baf20e1ca8
5 changed files with 19 additions and 0 deletions
+4
View File
@@ -125,6 +125,10 @@ class _HomePageState extends State<HomePage> with RouteAware {
_sheets = await _sortSheetsByRecency(result.sheets);
_isOnline = result.isOnline;
for (var sheet in _sheets) {
sheet.availableOffline = await _apiClient!.isPdfFileCached(sheet.uuid);
}
return result;
}
@@ -1,5 +1,6 @@
import 'package:flutter/material.dart';
import 'package:flutter/foundation.dart';
import '../../../core/models/sheet.dart';
/// A list tile displaying a single sheet's information.
@@ -24,6 +25,10 @@ class SheetListItem extends StatelessWidget {
subtitle: Text(sheet.composer),
onTap: onTap,
onLongPress: onLongPress,
trailing: Visibility(
visible: !kIsWeb && sheet.availableOffline,
child: Icon(Icons.download_done, color: Colors.green),
),
);
}
}
@@ -98,6 +98,7 @@ class _SheetViewerPageState extends State<SheetViewerPage>
// Native: use file cache
final file = await widget.apiClient.getPdfFileCached(widget.sheet.uuid);
_document = await PdfDocument.openFile(file.path);
widget.sheet.availableOffline = true;
}
setState(() {