progress visibility on item page

This commit is contained in:
Dr-Blank 2024-06-16 22:24:32 -04:00
parent be7f5daa88
commit 865a662b56
No known key found for this signature in database
GPG key ID: 7452CC63F210A266
21 changed files with 1009 additions and 765 deletions

View file

@ -127,7 +127,7 @@ class AudiobookPlayer extends AudioPlayer {
}).toList(),
),
).catchError((error) {
debugPrint('Error: $error');
debugPrint('AudiobookPlayer Error: $error');
});
}

View file

@ -1,6 +1,7 @@
import 'package:riverpod_annotation/riverpod_annotation.dart';
import 'package:shelfsdk/audiobookshelf_api.dart';
import 'package:whispering_pages/features/player/providers/audiobook_player.dart';
import 'package:whispering_pages/shared/extensions/model_conversions.dart';
part 'currently_playing_provider.g.dart';
@ -26,7 +27,7 @@ BookChapter? currentPlayingChapter(CurrentPlayingChapterRef ref) {
BookMetadataExpanded? currentBookMetadata(CurrentBookMetadataRef ref) {
final player = ref.watch(audiobookPlayerProvider);
if (player.book == null) return null;
return BookMetadataExpanded.fromJson(player.book!.metadata.toJson());
return player.book!.metadata.asBookMetadataExpanded;
}
// /// volume of the player [0, 1]

View file

@ -43,7 +43,7 @@ final currentPlayingChapterProvider =
typedef CurrentPlayingChapterRef = AutoDisposeProviderRef<BookChapter?>;
String _$currentBookMetadataHash() =>
r'02b462a051fce5bcbdad6fdb708b60256fbb588c';
r'9088debba151894b61f2dcba1bba12a89244b9b1';
/// provides the book metadata of the currently playing book
///

View file

@ -1,5 +1,3 @@
import 'dart:async';
import 'package:duration_picker/duration_picker.dart';
import 'package:flutter/material.dart';
import 'package:flutter_hooks/flutter_hooks.dart';
@ -356,16 +354,3 @@ extension DurationFormat on Duration {
}
}
}
void useInterval(VoidCallback callback, Duration delay) {
final savedCallback = useRef(callback);
savedCallback.value = callback;
useEffect(
() {
final timer = Timer.periodic(delay, (_) => savedCallback.value());
return timer.cancel;
},
[delay],
);
}