From 1c4e022a817ea4311728ae639d048b4f9da38f7c Mon Sep 17 00:00:00 2001 From: MSOB7YY Date: Mon, 27 Nov 2023 21:26:52 +0200 Subject: [PATCH] feat: zoomable playlist download page --- .../pages/yt_playlist_download_subpage.dart | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/lib/youtube/pages/yt_playlist_download_subpage.dart b/lib/youtube/pages/yt_playlist_download_subpage.dart index 4ab51ecf..0dfaacd3 100644 --- a/lib/youtube/pages/yt_playlist_download_subpage.dart +++ b/lib/youtube/pages/yt_playlist_download_subpage.dart @@ -215,9 +215,11 @@ class _YTPlaylistDownloadPageState extends State { 12.0; } + double hmultiplier = 0.7; + double previousScale = 0.7; + @override Widget build(BuildContext context) { - const hmultiplier = 0.9; final thumWidth = context.width * 0.3 * hmultiplier; final thumHeight = thumWidth * 9 / 16; return BackgroundWrapper( @@ -302,7 +304,7 @@ class _YTPlaylistDownloadPageState extends State { return NamidaInkWell( animationDurationMS: 200, height: Dimensions.youtubeCardItemHeight * hmultiplier, - margin: const EdgeInsets.symmetric(horizontal: 12.0, vertical: Dimensions.youtubeCardItemVerticalPadding * hmultiplier), + margin: EdgeInsets.symmetric(horizontal: 12.0, vertical: Dimensions.youtubeCardItemVerticalPadding * hmultiplier), borderRadius: 12.0, bgColor: context.theme.cardColor.withOpacity(0.3), decoration: isSelected @@ -361,7 +363,7 @@ class _YTPlaylistDownloadPageState extends State { const SizedBox(height: 6.0), Text( info?.name ?? id, - style: context.textTheme.displayMedium, + style: context.textTheme.displayMedium?.copyWith(fontSize: 15.0.multipliedFontScale * hmultiplier), maxLines: 2, overflow: TextOverflow.ellipsis, ), @@ -376,7 +378,7 @@ class _YTPlaylistDownloadPageState extends State { const SizedBox(width: 2.0), Text( info?.uploaderName ?? '', - style: context.textTheme.displaySmall, + style: context.textTheme.displaySmall?.copyWith(fontSize: 14.0.multipliedFontScale * hmultiplier), maxLines: 1, overflow: TextOverflow.ellipsis, ), @@ -508,6 +510,12 @@ class _YTPlaylistDownloadPageState extends State { ), ), ), + Positioned.fill( + child: GestureDetector( + onScaleStart: (details) => previousScale = hmultiplier, + onScaleUpdate: (details) => setState(() => hmultiplier = (details.scale * previousScale).clamp(0.5, 2.0)), + ), + ), ], ), );