mirror of
https://github.com/Dr-Blank/Vaani.git
synced 2026-02-09 19:09:34 +00:00
downloads and offline playback
This commit is contained in:
parent
1c95d1e4bb
commit
c24541f1cd
38 changed files with 1590 additions and 109 deletions
|
|
@ -98,7 +98,7 @@ class AudiobookPlayer extends HookConsumerWidget {
|
|||
// add a delay before closing the player
|
||||
// to allow the user to see the player closing
|
||||
Future.delayed(const Duration(milliseconds: 300), () {
|
||||
player.setSourceAudioBook(null);
|
||||
player.setSourceAudiobook(null);
|
||||
});
|
||||
},
|
||||
curve: Curves.easeOut,
|
||||
|
|
|
|||
|
|
@ -17,6 +17,8 @@ import 'widgets/audiobook_player_seek_button.dart';
|
|||
import 'widgets/audiobook_player_seek_chapter_button.dart';
|
||||
import 'widgets/player_speed_adjust_button.dart';
|
||||
|
||||
var pendingPlayerModals = 0;
|
||||
|
||||
class PlayerWhenExpanded extends HookConsumerWidget {
|
||||
const PlayerWhenExpanded({
|
||||
super.key,
|
||||
|
|
@ -270,6 +272,7 @@ class SleepTimerButton extends HookConsumerWidget {
|
|||
message: 'Sleep Timer',
|
||||
child: InkWell(
|
||||
onTap: () async {
|
||||
pendingPlayerModals++;
|
||||
// show the sleep timer dialog
|
||||
final resultingDuration = await showDurationPicker(
|
||||
context: context,
|
||||
|
|
@ -279,6 +282,7 @@ class SleepTimerButton extends HookConsumerWidget {
|
|||
.sleepTimerSettings
|
||||
.defaultDuration,
|
||||
);
|
||||
pendingPlayerModals--;
|
||||
if (resultingDuration != null) {
|
||||
// if 0 is selected, cancel the timer
|
||||
if (resultingDuration.inSeconds == 0) {
|
||||
|
|
|
|||
|
|
@ -1,8 +1,12 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||
import 'package:logging/logging.dart';
|
||||
import 'package:whispering_pages/features/player/providers/audiobook_player.dart';
|
||||
import 'package:whispering_pages/features/player/view/player_when_expanded.dart';
|
||||
import 'package:whispering_pages/features/player/view/widgets/speed_selector.dart';
|
||||
|
||||
final _logger = Logger('PlayerSpeedAdjustButton');
|
||||
|
||||
class PlayerSpeedAdjustButton extends HookConsumerWidget {
|
||||
const PlayerSpeedAdjustButton({
|
||||
super.key,
|
||||
|
|
@ -14,8 +18,10 @@ class PlayerSpeedAdjustButton extends HookConsumerWidget {
|
|||
final notifier = ref.watch(audiobookPlayerProvider.notifier);
|
||||
return TextButton(
|
||||
child: Text('${player.speed}x'),
|
||||
onPressed: () {
|
||||
showModalBottomSheet(
|
||||
onPressed: () async {
|
||||
pendingPlayerModals++;
|
||||
_logger.fine('opening speed selector');
|
||||
await showModalBottomSheet<bool>(
|
||||
context: context,
|
||||
barrierLabel: 'Select Speed',
|
||||
constraints: const BoxConstraints(
|
||||
|
|
@ -29,6 +35,8 @@ class PlayerSpeedAdjustButton extends HookConsumerWidget {
|
|||
);
|
||||
},
|
||||
);
|
||||
pendingPlayerModals--;
|
||||
_logger.fine('Closing speed selector');
|
||||
},
|
||||
);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue