2024-05-15 02:27:05 -04:00
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
|
|
|
|
import 'package:whispering_pages/features/player/providers/audiobook_player.dart';
|
2024-05-17 11:04:20 -04:00
|
|
|
import 'package:whispering_pages/features/player/providers/player_form.dart';
|
2024-05-15 02:27:05 -04:00
|
|
|
|
|
|
|
|
class PlayerWhenMinimized extends HookConsumerWidget {
|
|
|
|
|
const PlayerWhenMinimized({
|
|
|
|
|
super.key,
|
|
|
|
|
required this.maxImgSize,
|
|
|
|
|
required this.imgWidget,
|
|
|
|
|
required this.elementOpacity,
|
|
|
|
|
required this.playPauseButton,
|
|
|
|
|
required this.progressIndicator,
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
final double maxImgSize;
|
|
|
|
|
final Widget imgWidget;
|
|
|
|
|
final double elementOpacity;
|
2024-05-17 11:04:20 -04:00
|
|
|
final Widget playPauseButton;
|
2024-05-15 02:27:05 -04:00
|
|
|
final Widget progressIndicator;
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context, WidgetRef ref) {
|
|
|
|
|
final player = ref.watch(audiobookPlayerProvider);
|
2024-05-17 11:04:20 -04:00
|
|
|
final controller = ref.watch(miniplayerControllerProvider);
|
2024-05-15 02:27:05 -04:00
|
|
|
return Column(
|
|
|
|
|
children: [
|
|
|
|
|
Expanded(
|
|
|
|
|
child: Row(
|
|
|
|
|
children: [
|
|
|
|
|
ConstrainedBox(
|
|
|
|
|
constraints: BoxConstraints(maxHeight: maxImgSize),
|
|
|
|
|
child: imgWidget,
|
|
|
|
|
),
|
|
|
|
|
Expanded(
|
|
|
|
|
child: Padding(
|
|
|
|
|
padding: const EdgeInsets.only(left: 10),
|
|
|
|
|
child: Opacity(
|
|
|
|
|
opacity: elementOpacity,
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
|
mainAxisSize: MainAxisSize.min,
|
|
|
|
|
children: [
|
|
|
|
|
Text(
|
|
|
|
|
player.book?.metadata.title ?? '',
|
|
|
|
|
style: Theme.of(context)
|
|
|
|
|
.textTheme
|
|
|
|
|
.bodyMedium!
|
|
|
|
|
.copyWith(fontSize: 16),
|
|
|
|
|
),
|
|
|
|
|
Text(
|
|
|
|
|
'audioObject.subtitle',
|
|
|
|
|
style:
|
|
|
|
|
Theme.of(context).textTheme.bodyMedium!.copyWith(
|
|
|
|
|
color: Theme.of(context)
|
|
|
|
|
.textTheme
|
|
|
|
|
.bodyMedium!
|
|
|
|
|
.color!
|
|
|
|
|
.withOpacity(0.55),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
2024-05-17 11:04:20 -04:00
|
|
|
// IconButton(
|
|
|
|
|
// icon: const Icon(Icons.fullscreen),
|
|
|
|
|
// onPressed: () {
|
|
|
|
|
// controller.animateToHeight(state: PanelState.MAX);
|
|
|
|
|
// },
|
|
|
|
|
// ),
|
2024-05-15 02:27:05 -04:00
|
|
|
Padding(
|
2024-05-17 11:04:20 -04:00
|
|
|
padding: const EdgeInsets.all(8),
|
2024-05-15 02:27:05 -04:00
|
|
|
child: Opacity(
|
|
|
|
|
opacity: elementOpacity,
|
|
|
|
|
child: playPauseButton,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
2024-05-17 11:04:20 -04:00
|
|
|
// SizedBox(
|
|
|
|
|
// height: progressIndicatorHeight,
|
|
|
|
|
// child: Opacity(
|
|
|
|
|
// opacity: elementOpacity,
|
|
|
|
|
// child: progressIndicator,
|
|
|
|
|
// ),
|
|
|
|
|
// ),
|
2024-05-15 02:27:05 -04:00
|
|
|
],
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|