From e0deb841230b92e8199e1c651b4d983d8ae51832 Mon Sep 17 00:00:00 2001 From: rang <378694192@qq.com> Date: Tue, 21 Oct 2025 14:43:48 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=B8=8B=E8=BD=BD=E5=90=8D?= =?UTF-8?q?=E7=A7=B0=E6=98=BE=E7=A4=BA=E4=B8=BA=E4=B9=A6=E7=B1=8D=E5=90=8D?= =?UTF-8?q?=E7=A7=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../downloads/view/downloads_page.dart | 7 ++- .../player/view/audiobook_player.dart | 54 ------------------- .../player/view/player_when_expanded.dart | 3 +- .../player/view/player_when_minimized.dart | 1 - 4 files changed, 7 insertions(+), 58 deletions(-) diff --git a/lib/features/downloads/view/downloads_page.dart b/lib/features/downloads/view/downloads_page.dart index 7c5dbfb..e05c391 100644 --- a/lib/features/downloads/view/downloads_page.dart +++ b/lib/features/downloads/view/downloads_page.dart @@ -1,5 +1,6 @@ import 'package:flutter/material.dart'; import 'package:hooks_riverpod/hooks_riverpod.dart'; +import 'package:vaani/api/library_item_provider.dart'; import 'package:vaani/features/downloads/providers/download_manager.dart'; class DownloadsPage extends HookConsumerWidget { @@ -7,7 +8,7 @@ class DownloadsPage extends HookConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { - final manager = ref.read(simpleDownloadManagerProvider); + // final manager = ref.read(simpleDownloadManagerProvider); final downloadHistory = ref.watch(downloadHistoryProvider()); return Scaffold( @@ -25,8 +26,10 @@ class DownloadsPage extends HookConsumerWidget { itemBuilder: (context, index) { final group = uniqueGroups.elementAt(index); final groupRecords = records.where((e) => e.group == group); + final item = ref.watch(libraryItemProvider(group)).valueOrNull; + return ExpansionTile( - title: Text(group ?? 'No Group'), + title: Text(item?.media.metadata.title ?? group), children: groupRecords .map( (e) => ListTile( diff --git a/lib/features/player/view/audiobook_player.dart b/lib/features/player/view/audiobook_player.dart index 913ee7d..8afeca3 100644 --- a/lib/features/player/view/audiobook_player.dart +++ b/lib/features/player/view/audiobook_player.dart @@ -235,57 +235,3 @@ class AudiobookChapterProgressBar extends HookConsumerWidget { // ! TODO remove onTap void onTap() {} - -class ProportionalAdjuster { - final double minValue; - final double maxValue; - - ProportionalAdjuster({this.minValue = 0.0, this.maxValue = 1.0}); - - double adjust(double value, double ratio, {AdjustMethod method = AdjustMethod.linear}) { - switch (method) { - case AdjustMethod.linear: - return _linearAdjust(value, ratio); - case AdjustMethod.exponential: - return _exponentialAdjust(value, ratio); - case AdjustMethod.smooth: - return _smoothAdjust(value, ratio); - } - } - - double _linearAdjust(double value, double ratio) { - if (value <= minValue) return minValue; - if (value >= maxValue) return maxValue; - - double newValue; - if (ratio > 1) { - newValue = value + (maxValue - value) * (ratio - 1); - } else { - newValue = value * ratio; - } - - return newValue.clamp(minValue, maxValue); - } - - double _exponentialAdjust(double value, double ratio) { - if (value <= minValue) return minValue; - if (value >= maxValue) return maxValue; - - double newValue; - if (ratio > 1) { - newValue = maxValue - (maxValue - value) / ratio; - } else { - newValue = value * ratio; - } - - return newValue.clamp(minValue, maxValue); - } - - double _smoothAdjust(double value, double progress) { - progress = progress.clamp(0.0, 1.0); - double target = value > (minValue + maxValue) / 2 ? maxValue : minValue; - return value + (target - value) * progress; - } -} - -enum AdjustMethod { linear, exponential, smooth } diff --git a/lib/features/player/view/player_when_expanded.dart b/lib/features/player/view/player_when_expanded.dart index 7e9d67c..a1a473d 100644 --- a/lib/features/player/view/player_when_expanded.dart +++ b/lib/features/player/view/player_when_expanded.dart @@ -133,7 +133,7 @@ class PlayerWhenExpanded extends HookConsumerWidget { opacity: earlyPercentage, child: Padding( padding: EdgeInsets.only( - top: AppElementSizes.paddingLarge * earlyPercentage, + top: AppElementSizes.paddingRegular * earlyPercentage, // horizontal: 16.0, ), // child: SizedBox( @@ -204,6 +204,7 @@ class PlayerWhenExpanded extends HookConsumerWidget { opacity: earlyPercentage, child: SizedBox( width: imageSize, + height: AppElementSizes.iconSizeRegular, child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ diff --git a/lib/features/player/view/player_when_minimized.dart b/lib/features/player/view/player_when_minimized.dart index 5a26afb..858aec1 100644 --- a/lib/features/player/view/player_when_minimized.dart +++ b/lib/features/player/view/player_when_minimized.dart @@ -129,7 +129,6 @@ class PlayerWhenMinimized extends HookConsumerWidget { ), ], ), - const Spacer(), SizedBox( height: barHeight, child: LinearProgressIndicator(