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

95 lines
3.2 KiB
Dart
Raw Normal View History

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';
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;
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);
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);
// },
// ),
Padding(
2024-05-17 11:04:20 -04:00
padding: const EdgeInsets.all(8),
child: Opacity(
opacity: elementOpacity,
child: playPauseButton,
),
),
],
),
),
2024-05-17 11:04:20 -04:00
// SizedBox(
// height: progressIndicatorHeight,
// child: Opacity(
// opacity: elementOpacity,
// child: progressIndicator,
// ),
// ),
],
);
}
}