Vaani/lib/features/player/view/player_when_minimized.dart

156 lines
5.8 KiB
Dart
Raw Normal View History

2025-11-13 17:53:23 +08:00
// import 'package:flutter/material.dart';
// import 'package:flutter_hooks/flutter_hooks.dart';
// import 'package:go_router/go_router.dart';
// import 'package:hooks_riverpod/hooks_riverpod.dart';
// import 'package:vaani/constants/sizes.dart';
// import 'package:vaani/features/player/providers/audiobook_player.dart';
// import 'package:vaani/features/player/providers/currently_playing_provider.dart';
// import 'package:vaani/features/player/view/audiobook_player.dart';
// import 'package:vaani/router/router.dart';
2025-11-13 17:53:23 +08:00
// class PlayerWhenMinimized extends HookConsumerWidget {
// const PlayerWhenMinimized({
// super.key,
// required this.availWidth,
// required this.maxImgSize,
// required this.imgWidget,
// required this.playPauseController,
// required this.percentageMiniplayer,
// });
2025-11-13 17:53:23 +08:00
// final double availWidth;
// final double maxImgSize;
// final Widget imgWidget;
// final AnimationController playPauseController;
2024-05-19 08:53:21 -04:00
2025-11-13 17:53:23 +08:00
// /// 0 - 1, from minimized to when switched to expanded player
// ///
// /// by the time 1 is reached only image should be visible in the center of the widget
// final double percentageMiniplayer;
2025-11-13 17:53:23 +08:00
// @override
// Widget build(BuildContext context, WidgetRef ref) {
// final player = ref.watch(audiobookPlayerProvider);
// final currentChapter = ref.watch(currentPlayingChapterProvider);
2025-10-22 17:58:29 +08:00
2025-11-13 17:53:23 +08:00
// final vanishingPercentage = 1 - percentageMiniplayer;
// // final progress =
// // useStream(player.slowPositionStreamInBook, initialData: Duration.zero);
// final progress =
// useStream(player.positionStream, initialData: Duration.zero);
2024-05-19 08:53:21 -04:00
2025-11-13 17:53:23 +08:00
// final bookMetaExpanded = ref.watch(currentBookMetadataProvider);
2024-05-19 08:53:21 -04:00
2025-11-13 17:53:23 +08:00
// var barHeight = vanishingPercentage * 3;
2025-10-20 14:20:11 +08:00
2025-11-13 17:53:23 +08:00
// return Stack(
// alignment: Alignment.topCenter,
// children: [
// Row(
// children: [
// // image
// Padding(
// padding: EdgeInsets.only(
// left: ((availWidth - maxImgSize) / 2) * percentageMiniplayer,
// ),
// child: InkWell(
// onTap: () {
// // navigate to item page
// context.pushNamed(
// Routes.libraryItem.name,
// pathParameters: {
// Routes.libraryItem.pathParamName!:
// player.book!.libraryItemId,
// },
// );
// },
// child: ConstrainedBox(
// constraints: BoxConstraints(
// maxWidth: maxImgSize,
// ),
// child: imgWidget,
// ),
// ),
// ),
// // author and title of the book
// Expanded(
// child: Padding(
// padding: const EdgeInsets.only(left: 8),
// child: Column(
// crossAxisAlignment: CrossAxisAlignment.start,
// mainAxisAlignment: MainAxisAlignment.center,
// mainAxisSize: MainAxisSize.min,
// children: [
// // AutoScrollText(
// Text(
// '${bookMetaExpanded?.title ?? ''} - ${currentChapter?.title ?? ''}',
// maxLines: 1, overflow: TextOverflow.ellipsis,
// // velocity:
// // const Velocity(pixelsPerSecond: Offset(16, 0)),
// style: Theme.of(context).textTheme.bodyLarge,
// ),
// Text(
// bookMetaExpanded?.authorName ?? '',
// maxLines: 1,
// overflow: TextOverflow.ellipsis,
// style: Theme.of(context).textTheme.bodyMedium!.copyWith(
// color: Theme.of(context)
// .colorScheme
// .onSurface
// .withValues(alpha: 0.7),
// ),
// ),
// ],
// ),
// ),
// ),
// // IconButton(
// // icon: const Icon(Icons.fullscreen),
// // onPressed: () {
// // controller.animateToHeight(state: PanelState.MAX);
// // },
// // ),
2025-10-20 17:20:08 +08:00
2025-11-13 17:53:23 +08:00
// // rewind button
// Opacity(
// opacity: vanishingPercentage,
// child: Padding(
// padding: const EdgeInsets.only(left: 8),
// child: IconButton(
// icon: const Icon(
// Icons.replay_30,
// size: AppElementSizes.iconSizeSmall,
// ),
// onPressed: () {},
// ),
// ),
// ),
2025-10-20 17:20:08 +08:00
2025-11-13 17:53:23 +08:00
// // play/pause button
// Opacity(
// opacity: vanishingPercentage,
// child: Padding(
// padding: const EdgeInsets.only(right: 8),
// child: AudiobookPlayerPlayPauseButton(
// playPauseController: playPauseController,
// ),
// ),
// ),
// ],
// ),
// SizedBox(
// height: barHeight,
// child: LinearProgressIndicator(
// // value: (progress.data ?? Duration.zero).inSeconds /
// // player.book!.duration.inSeconds,
// value: (progress.data ?? Duration.zero).inSeconds /
// (player.duration?.inSeconds ?? 1),
// color: Theme.of(context).colorScheme.onPrimaryContainer,
// backgroundColor: Theme.of(context).colorScheme.primaryContainer,
// ),
// ),
// ],
// );
// }
// }