Skip to content

Commit

Permalink
⚡️ Improved season detail performance a lot
Browse files Browse the repository at this point in the history
  • Loading branch information
LNA-DEV committed Nov 1, 2024
1 parent f33ab54 commit 22fdbcc
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
9 changes: 7 additions & 2 deletions lib/views/detail_views/season_detail.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -114,8 +120,7 @@ class SeasonDetailView extends StatelessWidget {
width: 125,
fit: BoxFit.cover,
image: CachedNetworkImageProvider(
element.backdropUrl ??
Globals.PictureNotFoundUrl,
imageUrl,
headers: BaseApi.getHeaders(),
),
),
Expand Down
9 changes: 7 additions & 2 deletions lib/views/detail_views/show_detail.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand Down

0 comments on commit 22fdbcc

Please sign in to comment.