mirror of
https://github.com/Dr-Blank/Vaani.git
synced 2026-02-16 14:29:35 +00:00
添加语言切换
This commit is contained in:
parent
e0deb84123
commit
e06c834d0e
21 changed files with 1416 additions and 281 deletions
|
|
@ -99,8 +99,7 @@ class BookOnShelf extends HookConsumerWidget {
|
|||
onTap: handleTapOnBook,
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
child: Padding(
|
||||
padding:
|
||||
const EdgeInsets.only(bottom: 8.0, right: 4.0, left: 4.0),
|
||||
padding: const EdgeInsets.only(bottom: 8.0, right: 4.0, left: 4.0),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
|
|
@ -112,9 +111,7 @@ class BookOnShelf extends HookConsumerWidget {
|
|||
alignment: Alignment.bottomRight,
|
||||
children: [
|
||||
Hero(
|
||||
tag: HeroTagPrefixes.bookCover +
|
||||
item.id +
|
||||
heroTagSuffix,
|
||||
tag: HeroTagPrefixes.bookCover + item.id + heroTagSuffix,
|
||||
child: ClipRRect(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
child: AnimatedSwitcher(
|
||||
|
|
@ -128,17 +125,13 @@ class BookOnShelf extends HookConsumerWidget {
|
|||
var imageWidget = Image.memory(
|
||||
image,
|
||||
fit: BoxFit.fill,
|
||||
cacheWidth: (height *
|
||||
1.2 *
|
||||
MediaQuery.of(context)
|
||||
.devicePixelRatio)
|
||||
.round(),
|
||||
cacheWidth:
|
||||
(height * 1.2 * MediaQuery.of(context).devicePixelRatio)
|
||||
.round(),
|
||||
);
|
||||
return Container(
|
||||
decoration: BoxDecoration(
|
||||
color: Theme.of(context)
|
||||
.colorScheme
|
||||
.onPrimaryContainer,
|
||||
color: Theme.of(context).colorScheme.onPrimaryContainer,
|
||||
),
|
||||
child: imageWidget,
|
||||
);
|
||||
|
|
@ -213,8 +206,7 @@ class _BookOnShelfPlayButton extends HookConsumerWidget {
|
|||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
final me = ref.watch(meProvider);
|
||||
final player = ref.watch(audiobookPlayerProvider);
|
||||
final isCurrentBookSetInPlayer =
|
||||
player.book?.libraryItemId == libraryItemId;
|
||||
final isCurrentBookSetInPlayer = player.book?.libraryItemId == libraryItemId;
|
||||
final isPlayingThisBook = player.playing && isCurrentBookSetInPlayer;
|
||||
|
||||
final userProgress = me.valueOrNull?.mediaProgress
|
||||
|
|
@ -242,8 +234,7 @@ class _BookOnShelfPlayButton extends HookConsumerWidget {
|
|||
return Theme(
|
||||
// if current book is set in player, get theme from the cover image
|
||||
data: ThemeData(
|
||||
colorScheme:
|
||||
coverColorScheme.valueOrNull ?? Theme.of(context).colorScheme,
|
||||
colorScheme: coverColorScheme.valueOrNull ?? Theme.of(context).colorScheme,
|
||||
),
|
||||
child: Padding(
|
||||
padding: EdgeInsets.all(strokeWidth / 2 + 2),
|
||||
|
|
@ -258,10 +249,7 @@ class _BookOnShelfPlayButton extends HookConsumerWidget {
|
|||
child: CircularProgressIndicator(
|
||||
value: userProgress.progress,
|
||||
strokeWidth: strokeWidth,
|
||||
backgroundColor: Theme.of(context)
|
||||
.colorScheme
|
||||
.onPrimary
|
||||
.withValues(alpha: 0.8),
|
||||
backgroundColor: Theme.of(context).colorScheme.onPrimary.withValues(alpha: 0.8),
|
||||
valueColor: AlwaysStoppedAnimation<Color>(
|
||||
Theme.of(context).colorScheme.primary,
|
||||
),
|
||||
|
|
@ -279,15 +267,11 @@ class _BookOnShelfPlayButton extends HookConsumerWidget {
|
|||
const Size(size, size),
|
||||
),
|
||||
backgroundColor: WidgetStateProperty.all(
|
||||
Theme.of(context)
|
||||
.colorScheme
|
||||
.onPrimary
|
||||
.withValues(alpha: 0.9),
|
||||
Theme.of(context).colorScheme.onPrimary.withValues(alpha: 0.9),
|
||||
),
|
||||
),
|
||||
onPressed: () async {
|
||||
final book =
|
||||
await ref.watch(libraryItemProvider(libraryItemId).future);
|
||||
final book = await ref.watch(libraryItemProvider(libraryItemId).future);
|
||||
|
||||
libraryItemPlayButtonOnPressed(
|
||||
ref: ref,
|
||||
|
|
@ -324,10 +308,8 @@ class BookCoverSkeleton extends StatelessWidget {
|
|||
child: SizedBox(
|
||||
width: 150,
|
||||
child: Shimmer.fromColors(
|
||||
baseColor:
|
||||
Theme.of(context).colorScheme.surface.withValues(alpha: 0.3),
|
||||
highlightColor:
|
||||
Theme.of(context).colorScheme.onSurface.withValues(alpha: 0.1),
|
||||
baseColor: Theme.of(context).colorScheme.surface.withValues(alpha: 0.3),
|
||||
highlightColor: Theme.of(context).colorScheme.onSurface.withValues(alpha: 0.1),
|
||||
child: Container(
|
||||
color: Theme.of(context).colorScheme.surface,
|
||||
),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue