mirror of
https://github.com/Dr-Blank/Vaani.git
synced 2026-02-17 23:09:36 +00:00
增加跳过片头片尾,上一章下一章移动到AudioPlayer对象中
This commit is contained in:
parent
e06c834d0e
commit
620a1eb7a2
29 changed files with 1080 additions and 179 deletions
|
|
@ -3,11 +3,12 @@ import 'package:flutter_hooks/flutter_hooks.dart';
|
|||
import 'package:go_router/go_router.dart';
|
||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||
import 'package:vaani/api/api_provider.dart';
|
||||
import 'package:vaani/generated/l10n.dart';
|
||||
import 'package:vaani/main.dart';
|
||||
import 'package:vaani/router/router.dart';
|
||||
import 'package:vaani/settings/api_settings_provider.dart';
|
||||
import 'package:vaani/settings/app_settings_provider.dart'
|
||||
show appSettingsProvider;
|
||||
import 'package:vaani/settings/app_settings_provider.dart' show appSettingsProvider;
|
||||
import 'package:vaani/settings/constants.dart';
|
||||
|
||||
import '../shared/widgets/shelves/home_shelf.dart';
|
||||
|
||||
|
|
@ -21,11 +22,12 @@ class HomePage extends HookConsumerWidget {
|
|||
final scrollController = useScrollController();
|
||||
final appSettings = ref.watch(appSettingsProvider);
|
||||
final homePageSettings = appSettings.homePageSettings;
|
||||
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: GestureDetector(
|
||||
child: Text(
|
||||
'Vaani',
|
||||
AppMetadata.appName,
|
||||
style: Theme.of(context).textTheme.headlineLarge,
|
||||
),
|
||||
onTap: () {
|
||||
|
|
@ -48,7 +50,7 @@ class HomePage extends HookConsumerWidget {
|
|||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
const Text('No shelves to display'),
|
||||
Text(S.of(context).bookShelveEmptyText),
|
||||
// try again button
|
||||
ElevatedButton(
|
||||
onPressed: () {
|
||||
|
|
@ -57,7 +59,7 @@ class HomePage extends HookConsumerWidget {
|
|||
);
|
||||
ref.invalidate(personalizedViewProvider);
|
||||
},
|
||||
child: const Text('Try again'),
|
||||
child: Text(S.of(context).bookShelveEmpty),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
|
@ -70,16 +72,23 @@ class HomePage extends HookConsumerWidget {
|
|||
// check if showPlayButton is enabled for the shelf
|
||||
// using the id of the shelf
|
||||
final showPlayButton = switch (shelf.id) {
|
||||
'continue-listening' =>
|
||||
homePageSettings.showPlayButtonOnContinueListeningShelf,
|
||||
'continue-series' =>
|
||||
homePageSettings.showPlayButtonOnContinueSeriesShelf,
|
||||
'listen-again' =>
|
||||
homePageSettings.showPlayButtonOnListenAgainShelf,
|
||||
'continue-listening' => homePageSettings.showPlayButtonOnContinueListeningShelf,
|
||||
'continue-series' => homePageSettings.showPlayButtonOnContinueSeriesShelf,
|
||||
'listen-again' => homePageSettings.showPlayButtonOnListenAgainShelf,
|
||||
_ => homePageSettings.showPlayButtonOnAllRemainingShelves,
|
||||
};
|
||||
final showLabel = switch (shelf.label) {
|
||||
"Continue Listening" => S.of(context).homeBookContinueListening,
|
||||
"Continue Series" => S.of(context).homeBookContinueSeries,
|
||||
"Recently Added" => S.of(context).homeBookRecentlyAdded,
|
||||
"Recommended" => S.of(context).homeBookRecommended,
|
||||
"Discover" => S.of(context).homeBookDiscover,
|
||||
"Listen Again" => S.of(context).homeBookListenAgain,
|
||||
"Newest Authors" => S.of(context).homeBookNewestAuthors,
|
||||
_ => shelf.label
|
||||
};
|
||||
return HomeShelf(
|
||||
title: shelf.label,
|
||||
title: showLabel,
|
||||
shelf: shelf,
|
||||
showPlayButton: showPlayButton,
|
||||
);
|
||||
|
|
@ -102,8 +111,7 @@ class HomePage extends HookConsumerWidget {
|
|||
},
|
||||
loading: () => const HomePageSkeleton(),
|
||||
error: (error, stack) {
|
||||
if (apiSettings.activeUser == null ||
|
||||
apiSettings.activeServer == null) {
|
||||
if (apiSettings.activeUser == null || apiSettings.activeServer == null) {
|
||||
return Center(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue