mirror of
https://github.com/Dr-Blank/Vaani.git
synced 2026-02-18 07:19:34 +00:00
123
This commit is contained in:
parent
634ffaed8c
commit
edd5a01482
9 changed files with 997 additions and 950 deletions
|
|
@ -1,12 +1,14 @@
|
|||
import 'dart:math';
|
||||
|
||||
import 'package:audio_video_progress_bar/audio_video_progress_bar.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||
import 'package:shelfsdk/audiobookshelf_api.dart';
|
||||
import 'package:vaani/constants/sizes.dart';
|
||||
import 'package:vaani/features/item_viewer/view/library_item_hero_section.dart';
|
||||
import 'package:vaani/features/player/providers/abs_provider.dart';
|
||||
import 'package:vaani/features/player/view/player_expanded.dart'
|
||||
show PlayerExpandedImage;
|
||||
import 'package:vaani/features/player/view/player_minimized.dart';
|
||||
import 'package:vaani/features/player/view/widgets/audiobook_player_seek_button.dart';
|
||||
import 'package:vaani/features/player/view/widgets/audiobook_player_seek_chapter_button.dart';
|
||||
import 'package:vaani/features/player/view/widgets/chapter_selection_button.dart';
|
||||
|
|
@ -16,6 +18,7 @@ import 'package:vaani/features/player/view/widgets/player_speed_adjust_button.da
|
|||
import 'package:vaani/features/skip_start_end/view/skip_start_end_button.dart';
|
||||
import 'package:vaani/features/sleep_timer/view/sleep_timer_button.dart';
|
||||
import 'package:vaani/globals.dart';
|
||||
import 'package:vaani/shared/extensions/model_conversions.dart';
|
||||
|
||||
var pendingPlayerModals = 0;
|
||||
|
||||
|
|
@ -40,7 +43,7 @@ class PlayerExpandedDesktop extends HookConsumerWidget {
|
|||
final availWidth = MediaQuery.of(context).size.width;
|
||||
// the image width when the player is expanded
|
||||
final imageSize = min(playerMaxHeight * 0.5, availWidth * 0.9);
|
||||
|
||||
final itemBookMetadata = book.metadata.asBookMetadataExpanded;
|
||||
return Stack(
|
||||
alignment: Alignment.bottomCenter,
|
||||
children: [
|
||||
|
|
@ -62,18 +65,7 @@ class PlayerExpandedDesktop extends HookConsumerWidget {
|
|||
// add a shadow to the image elevation hovering effect
|
||||
child: PlayerExpandedImage(imageSize),
|
||||
),
|
||||
// _buildControls(imageSize),
|
||||
// SizedBox(
|
||||
// width: imageSize,
|
||||
// child: Padding(
|
||||
// padding: EdgeInsets.only(
|
||||
// left: AppElementSizes.paddingRegular,
|
||||
// right: AppElementSizes.paddingRegular,
|
||||
// ),
|
||||
// child: const AudiobookChapterProgressBar(),
|
||||
// ),
|
||||
// ),
|
||||
_buildSettings(imageSize),
|
||||
_buildBookDetails(imageSize, itemBookMetadata),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
|
@ -113,9 +105,19 @@ class PlayerExpandedDesktop extends HookConsumerWidget {
|
|||
),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: playerMinimizedHeight,
|
||||
child: _buildBottom(),
|
||||
Column(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: [
|
||||
Padding(
|
||||
padding: EdgeInsets.symmetric(
|
||||
horizontal: AppElementSizes.paddingRegular,
|
||||
),
|
||||
child: const AudiobookChapterProgressBar(
|
||||
timeLabelLocation: TimeLabelLocation.sides,
|
||||
),
|
||||
),
|
||||
Container(child: _buildBottom()),
|
||||
],
|
||||
),
|
||||
],
|
||||
);
|
||||
|
|
@ -123,67 +125,57 @@ class PlayerExpandedDesktop extends HookConsumerWidget {
|
|||
|
||||
Widget _buildBottom() {
|
||||
return Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
SizedBox(
|
||||
width: 180,
|
||||
Spacer(),
|
||||
Expanded(
|
||||
child: Row(
|
||||
children: [
|
||||
const AudiobookPlayerSeekChapterButton(isForward: false),
|
||||
const AudiobookPlayerSeekButton(isForward: false),
|
||||
// play/pause button
|
||||
const AudiobookPlayerPlayPauseButton(),
|
||||
const AudiobookPlayerSeekButton(isForward: true),
|
||||
const AudiobookPlayerSeekChapterButton(isForward: true),
|
||||
],
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: Padding(
|
||||
padding: EdgeInsets.only(
|
||||
left: AppElementSizes.paddingRegular,
|
||||
right: AppElementSizes.paddingRegular,
|
||||
),
|
||||
child: const AudiobookChapterProgressBar(),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: [
|
||||
const PlayerSpeedAdjustButton(),
|
||||
const SleepTimerButton(),
|
||||
SkipChapterStartEndButton(),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildControls(double width) {
|
||||
return SizedBox(
|
||||
Widget _buildBookDetails(
|
||||
double width, BookMetadataExpanded? itemBookMetadata) {
|
||||
return Container(
|
||||
padding: EdgeInsets.all(AppElementSizes.paddingLarge),
|
||||
width: width,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
child: Column(
|
||||
children: [
|
||||
// previous chapter
|
||||
const AudiobookPlayerSeekChapterButton(isForward: false),
|
||||
// buttonSkipBackwards
|
||||
const AudiobookPlayerSeekButton(isForward: false),
|
||||
const AudiobookPlayerPlayPauseButton(),
|
||||
// // buttonSkipForwards
|
||||
const AudiobookPlayerSeekButton(isForward: true),
|
||||
// // next chapter
|
||||
const AudiobookPlayerSeekChapterButton(isForward: true),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildSettings(double width) {
|
||||
return SizedBox(
|
||||
width: width,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
children: [
|
||||
const AudiobookPlayerSeekButton(isForward: false),
|
||||
const AudiobookPlayerSeekButton(isForward: true),
|
||||
// speed control
|
||||
const PlayerSpeedAdjustButton(),
|
||||
const Spacer(),
|
||||
// sleep timer
|
||||
const SleepTimerButton(),
|
||||
const Spacer(),
|
||||
// 跳过片头片尾
|
||||
SkipChapterStartEndButton(),
|
||||
// authors info if available
|
||||
BookAuthors(
|
||||
itemBookMetadata: itemBookMetadata,
|
||||
bookDetailsCached: null,
|
||||
),
|
||||
// narrators info if available
|
||||
BookNarrators(
|
||||
itemBookMetadata: itemBookMetadata,
|
||||
bookDetailsCached: null,
|
||||
),
|
||||
// series info if available
|
||||
BookSeries(
|
||||
itemBookMetadata: itemBookMetadata,
|
||||
bookDetailsCached: null,
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue