mirror of
https://github.com/Dr-Blank/Vaani.git
synced 2026-02-16 22:39:34 +00:00
123
This commit is contained in:
parent
178f3fbdb1
commit
634ffaed8c
27 changed files with 648 additions and 1012 deletions
|
|
@ -1,8 +1,8 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||
import 'package:just_audio/just_audio.dart';
|
||||
import 'package:vaani/features/player/providers/abs_provider.dart'
|
||||
hide PlayerState;
|
||||
import 'package:vaani/features/player/core/abs_audio_player.dart';
|
||||
|
||||
class AudiobookPlayerPlayPauseButton extends HookConsumerWidget {
|
||||
const AudiobookPlayerPlayPauseButton({
|
||||
|
|
@ -21,12 +21,12 @@ class AudiobookPlayerPlayPauseButton extends HookConsumerWidget {
|
|||
);
|
||||
}
|
||||
|
||||
Widget _getIcon(AbsPlayerState playerState, BuildContext context) {
|
||||
Widget _getIcon(PlayerState playerState, BuildContext context) {
|
||||
if (playerState.playing) {
|
||||
return Icon(size: iconSize, Icons.pause);
|
||||
} else {
|
||||
switch (playerState.processingState) {
|
||||
case AbsProcessingState.loading || AbsProcessingState.buffering:
|
||||
case ProcessingState.loading || ProcessingState.buffering:
|
||||
return CircularProgressIndicator();
|
||||
default:
|
||||
return Icon(size: iconSize, Icons.play_arrow);
|
||||
|
|
@ -34,13 +34,13 @@ class AudiobookPlayerPlayPauseButton extends HookConsumerWidget {
|
|||
}
|
||||
}
|
||||
|
||||
void _actionButtonPressed(AbsPlayerState playerState, WidgetRef ref) async {
|
||||
void _actionButtonPressed(PlayerState playerState, WidgetRef ref) async {
|
||||
final player = ref.read(absPlayerProvider);
|
||||
if (playerState.playing) {
|
||||
await player.pause();
|
||||
} else {
|
||||
switch (playerState.processingState) {
|
||||
case AbsProcessingState.completed:
|
||||
case ProcessingState.completed:
|
||||
await player.seekInBook(const Duration(seconds: 0));
|
||||
await player.play();
|
||||
default:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue