feature: Auto next-up preview, skip to next in queue. (#96)

Co-authored-by: PartyDonut <PartyDonut@users.noreply.github.com>
This commit is contained in:
PartyDonut 2024-11-01 15:52:54 +01:00 committed by GitHub
parent f72ae9e3ca
commit 66f2b6cd4e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 971 additions and 137 deletions

View file

@ -55,8 +55,8 @@ class _PhotoViewerControllsState extends ConsumerState<PhotoViewerControls> with
double dragUpDelta = 0.0;
final controller = TextEditingController();
late final timerController =
RestarableTimerController(ref.read(photoViewSettingsProvider).timer, const Duration(milliseconds: 32), () {
late final timerController = RestarableTimerController(
ref.read(photoViewSettingsProvider).timer, const Duration(milliseconds: 32), onTimeout: () {
if (widget.pageController.page == widget.itemCount - 1) {
widget.pageController.animateToPage(0, duration: const Duration(milliseconds: 250), curve: Curves.easeInOut);
} else {
@ -314,6 +314,13 @@ class _PhotoViewerControllsState extends ConsumerState<PhotoViewerControls> with
),
ProgressFloatingButton(
controller: timerController,
onLongPress: (duration) {
if (duration != null) {
ref
.read(photoViewSettingsProvider.notifier)
.update((state) => state.copyWith(timer: duration));
}
},
),
].addPadding(const EdgeInsets.symmetric(horizontal: 8)),
),