From 22fdbcc14bfab204d919f09b793ab6f36c4656ee Mon Sep 17 00:00:00 2001 From: Lukas Nagel Date: Fri, 1 Nov 2024 19:07:49 +0100 Subject: [PATCH] =?UTF-8?q?=E2=9A=A1=EF=B8=8F=20Improved=20season=20detail?= =?UTF-8?q?=20performance=20a=20lot?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/views/detail_views/season_detail.dart | 9 +++++++-- lib/views/detail_views/show_detail.dart | 9 +++++++-- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/lib/views/detail_views/season_detail.dart b/lib/views/detail_views/season_detail.dart index 334137b..1affd60 100644 --- a/lib/views/detail_views/season_detail.dart +++ b/lib/views/detail_views/season_detail.dart @@ -88,6 +88,12 @@ class SeasonDetailView extends StatelessWidget { // Episode list items var element = items[index - 1]; // Adjust index for episode + String imageUrl = Globals.PictureNotFoundUrl; + + if (element.backdropUrl != null) { + imageUrl = "${element.backdropUrl}?width=300"; + } + return Padding( padding: const EdgeInsets.fromLTRB(12, 0, 12, 0), child: Material( @@ -114,8 +120,7 @@ class SeasonDetailView extends StatelessWidget { width: 125, fit: BoxFit.cover, image: CachedNetworkImageProvider( - element.backdropUrl ?? - Globals.PictureNotFoundUrl, + imageUrl, headers: BaseApi.getHeaders(), ), ), diff --git a/lib/views/detail_views/show_detail.dart b/lib/views/detail_views/show_detail.dart index 2d6b2d2..a712b6c 100644 --- a/lib/views/detail_views/show_detail.dart +++ b/lib/views/detail_views/show_detail.dart @@ -85,6 +85,12 @@ class ShowDetailView extends StatelessWidget { ); } + String imageUrl = Globals.PictureNotFoundUrl; + + if (itemModel.backdropUrl != null) { + imageUrl = "${itemModel.backdropUrl!}?height=300"; + } + return SingleChildScrollView( child: Column( crossAxisAlignment: CrossAxisAlignment.start, @@ -103,8 +109,7 @@ class ShowDetailView extends StatelessWidget { }, blendMode: BlendMode.dstIn, child: CustomImage( - imageUrl: - itemModel.backdropUrl ?? Globals.PictureNotFoundUrl, + imageUrl: imageUrl, height: 300, width: double.infinity, fit: BoxFit.cover,