Skip to content

A cross platform Audiobookshelf client for Android and iOS

Dart

Improve series sheet download progress feedback (#41)

Kevin GATERA1f4eae078882
diff --git a/lib/widgets/series_books_sheet.dart b/lib/widgets/series_books_sheet.dart
index 4a84d293..824f77df 100644
--- a/lib/widgets/series_books_sheet.dart
+++ b/lib/widgets/series_books_sheet.dart
@@ -233,6 +233,8 @@ class _SeriesBooksSheetState extends State<SeriesBooksSheet> {
const SizedBox(width: 8),
Expanded(
child: Text(widget.seriesName,
+ maxLines: 2,
+ overflow: TextOverflow.ellipsis,
style: tt.titleLarge
?.copyWith(fontWeight: FontWeight.w600)),
),
@@ -396,6 +398,10 @@ class _SeriesBooksSheetState extends State<SeriesBooksSheet> {
final progress = lib.getProgress(bookId);
final isFinished = lib.getProgressData(bookId)?['isFinished'] == true;
final isDownloaded = DownloadService().isDownloaded(bookId);
+ final isDownloading = DownloadService().isDownloading(bookId);
+ final downloadPct = (DownloadService().downloadProgress(bookId) * 100)
+ .clamp(0, 100)
+ .round();
String? coverUrl;
if (bookId.isNotEmpty &&
@@ -474,6 +480,27 @@ class _SeriesBooksSheetState extends State<SeriesBooksSheet> {
fontWeight: FontWeight.w800)),
),
),
+ if (!isDownloaded && isDownloading)
+ Positioned(
+ top: 4,
+ right: 4,
+ child: Container(
+ padding: const EdgeInsets.symmetric(
+ horizontal: 6, vertical: 2),
+ decoration: BoxDecoration(
+ color: Colors.black54,
+ borderRadius: BorderRadius.circular(6),
+ ),
+ child: Text(
+ '$downloadPct%',
+ style: TextStyle(
+ color: cs.primary,
+ fontSize: 10,
+ fontWeight: FontWeight.w700,
+ ),
+ ),
+ ),
+ ),
// Progress bar at bottom
if (progress > 0 && !isFinished)
Positioned(