mirror of
https://github.com/Dr-Blank/Vaani.git
synced 2026-02-16 14:29:35 +00:00
增加跳过片头片尾,上一章下一章移动到AudioPlayer对象中
This commit is contained in:
parent
e06c834d0e
commit
620a1eb7a2
29 changed files with 1080 additions and 179 deletions
|
|
@ -2,8 +2,8 @@ import 'package:flutter/material.dart';
|
|||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||
import 'package:shelfsdk/audiobookshelf_api.dart' show Library;
|
||||
import 'package:vaani/api/library_provider.dart';
|
||||
import 'package:vaani/settings/api_settings_provider.dart'
|
||||
show apiSettingsProvider;
|
||||
import 'package:vaani/generated/l10n.dart';
|
||||
import 'package:vaani/settings/api_settings_provider.dart' show apiSettingsProvider;
|
||||
import 'package:vaani/shared/icons/abs_icons.dart';
|
||||
import 'dart:io' show Platform;
|
||||
|
||||
|
|
@ -33,7 +33,7 @@ class LibrarySwitchChip extends HookConsumerWidget {
|
|||
: libraries.first.icon,
|
||||
),
|
||||
), // Replace with your icon
|
||||
label: const Text('Change Library'),
|
||||
label: Text(S.of(context).libraryChange),
|
||||
// Enable only if libraries are loaded and not empty
|
||||
onPressed: libraries.isNotEmpty
|
||||
? () => showLibrarySwitcher(
|
||||
|
|
@ -69,7 +69,7 @@ void showLibrarySwitcher(
|
|||
showDialog(
|
||||
context: context,
|
||||
builder: (dialogContext) => AlertDialog(
|
||||
title: const Text('Select Library'),
|
||||
title: Text(S.of(context).librarySelect),
|
||||
content: SizedBox(
|
||||
// Constrain size for dialogs
|
||||
width: 300, // Adjust as needed
|
||||
|
|
@ -83,11 +83,11 @@ void showLibrarySwitcher(
|
|||
ref.invalidate(librariesProvider);
|
||||
Navigator.pop(dialogContext);
|
||||
},
|
||||
child: const Text('Refresh'),
|
||||
child: Text(S.of(context).refresh),
|
||||
),
|
||||
TextButton(
|
||||
onPressed: () => Navigator.pop(dialogContext),
|
||||
child: const Text('Cancel'),
|
||||
child: Text(S.of(context).cancel),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
|
@ -99,8 +99,7 @@ void showLibrarySwitcher(
|
|||
// Make it scrollable and control height
|
||||
isScrollControlled: true,
|
||||
constraints: BoxConstraints(
|
||||
maxHeight:
|
||||
MediaQuery.of(context).size.height * 0.6, // Max 60% of screen
|
||||
maxHeight: MediaQuery.of(context).size.height * 0.6, // Max 60% of screen
|
||||
),
|
||||
builder: (sheetContext) => Padding(
|
||||
// Add padding within the bottom sheet
|
||||
|
|
@ -108,8 +107,8 @@ void showLibrarySwitcher(
|
|||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min, // Take minimum necessary height
|
||||
children: [
|
||||
const Text(
|
||||
'Select Library',
|
||||
Text(
|
||||
S.of(context).librarySelect,
|
||||
style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold),
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
|
|
@ -121,7 +120,7 @@ void showLibrarySwitcher(
|
|||
const SizedBox(height: 10),
|
||||
ElevatedButton.icon(
|
||||
icon: const Icon(Icons.refresh),
|
||||
label: const Text('Refresh'),
|
||||
label: Text(S.of(context).refresh),
|
||||
onPressed: () {
|
||||
// Invalidate the provider to trigger a refetch
|
||||
ref.invalidate(librariesProvider);
|
||||
|
|
@ -157,14 +156,14 @@ class _LibrarySelectionContent extends ConsumerWidget {
|
|||
Icon(Icons.error_outline, color: errorColor),
|
||||
const SizedBox(height: 10),
|
||||
Text(
|
||||
'Error loading libraries: $error',
|
||||
S.of(context).libraryLoadError('$error'),
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(color: errorColor),
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
ElevatedButton.icon(
|
||||
icon: const Icon(Icons.refresh),
|
||||
label: const Text('Retry'),
|
||||
label: Text(S.of(context).retry),
|
||||
onPressed: () {
|
||||
// Invalidate the provider to trigger a refetch
|
||||
ref.invalidate(librariesProvider);
|
||||
|
|
@ -179,10 +178,10 @@ class _LibrarySelectionContent extends ConsumerWidget {
|
|||
data: (libraries) {
|
||||
// Handle case where data loaded successfully but is empty
|
||||
if (libraries.isEmpty) {
|
||||
return const Center(
|
||||
return Center(
|
||||
child: Padding(
|
||||
padding: EdgeInsets.all(16.0),
|
||||
child: Text('No libraries available.'),
|
||||
child: Text(S.of(context).libraryEmpty),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import 'package:vaani/api/api_provider.dart';
|
|||
import 'package:vaani/api/library_provider.dart' show librariesProvider;
|
||||
import 'package:vaani/features/player/view/mini_player_bottom_padding.dart';
|
||||
import 'package:vaani/features/you/view/widgets/library_switch_chip.dart';
|
||||
import 'package:vaani/generated/l10n.dart';
|
||||
import 'package:vaani/router/router.dart';
|
||||
import 'package:vaani/settings/constants.dart';
|
||||
import 'package:vaani/shared/utils.dart';
|
||||
|
|
@ -25,7 +26,7 @@ class YouPage extends HookConsumerWidget {
|
|||
// title: const Text('You'),
|
||||
actions: [
|
||||
IconButton(
|
||||
tooltip: 'Logs',
|
||||
tooltip: S.of(context).logs,
|
||||
icon: const Icon(Icons.bug_report),
|
||||
onPressed: () {
|
||||
context.pushNamed(Routes.logs.name);
|
||||
|
|
@ -38,7 +39,7 @@ class YouPage extends HookConsumerWidget {
|
|||
// },
|
||||
// ),
|
||||
IconButton(
|
||||
tooltip: 'Settings',
|
||||
tooltip: S.of(context).settings,
|
||||
icon: const Icon(Icons.settings),
|
||||
onPressed: () {
|
||||
context.pushNamed(Routes.settings.name);
|
||||
|
|
@ -61,14 +62,13 @@ class YouPage extends HookConsumerWidget {
|
|||
children: [
|
||||
ActionChip(
|
||||
avatar: const Icon(Icons.switch_account_outlined),
|
||||
label: const Text('Switch Account'),
|
||||
label: Text(S.of(context).accountSwitch),
|
||||
onPressed: () {
|
||||
context.pushNamed(Routes.userManagement.name);
|
||||
},
|
||||
),
|
||||
librariesAsyncValue.when(
|
||||
data: (libraries) =>
|
||||
LibrarySwitchChip(libraries: libraries),
|
||||
data: (libraries) => LibrarySwitchChip(libraries: libraries),
|
||||
loading: () => const ActionChip(
|
||||
avatar: SizedBox(
|
||||
width: 18,
|
||||
|
|
@ -88,13 +88,13 @@ class YouPage extends HookConsumerWidget {
|
|||
// Maybe show error details or allow retry
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content:
|
||||
Text('Failed to load libraries: $error'),
|
||||
content: Text('Failed to load libraries: $error'),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
), // ActionChip(
|
||||
),
|
||||
// ActionChip(
|
||||
// avatar: const Icon(Icons.logout),
|
||||
// label: const Text('Logout'),
|
||||
// onPressed: () {
|
||||
|
|
@ -113,7 +113,7 @@ class YouPage extends HookConsumerWidget {
|
|||
const SizedBox(height: 16),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.playlist_play),
|
||||
title: const Text('My Playlists'),
|
||||
title: Text(S.of(context).playlistsMine),
|
||||
onTap: () {
|
||||
// Handle navigation to playlists
|
||||
showNotImplementedToast(context);
|
||||
|
|
@ -121,7 +121,7 @@ class YouPage extends HookConsumerWidget {
|
|||
),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.web),
|
||||
title: const Text('Web Version'),
|
||||
title: Text(S.of(context).webVersion),
|
||||
onTap: () {
|
||||
handleLaunchUrl(
|
||||
// get url from api and launch it
|
||||
|
|
@ -131,7 +131,7 @@ class YouPage extends HookConsumerWidget {
|
|||
),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.help),
|
||||
title: const Text('Help'),
|
||||
title: Text(S.of(context).help),
|
||||
onTap: () {
|
||||
// Handle navigation to help website
|
||||
showNotImplementedToast(context);
|
||||
|
|
@ -141,8 +141,7 @@ class YouPage extends HookConsumerWidget {
|
|||
icon: const Icon(Icons.info),
|
||||
applicationName: AppMetadata.appName,
|
||||
applicationVersion: AppMetadata.version,
|
||||
applicationLegalese:
|
||||
'Made with ❤️ by ${AppMetadata.author}',
|
||||
applicationLegalese: 'Made with ❤️ by ${AppMetadata.author}',
|
||||
aboutBoxChildren: [
|
||||
// link to github repo
|
||||
ListTile(
|
||||
|
|
@ -217,8 +216,7 @@ class UserBar extends HookConsumerWidget {
|
|||
Text(
|
||||
api.baseUrl.toString(),
|
||||
style: textTheme.bodyMedium?.copyWith(
|
||||
color:
|
||||
themeData.colorScheme.onSurface.withValues(alpha: 0.6),
|
||||
color: themeData.colorScheme.onSurface.withValues(alpha: 0.6),
|
||||
),
|
||||
),
|
||||
],
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue