perf(high): P1-2 - Optimize image cache sizes

Limit image cache to display size instead of full resolution:
- Channel icons: 40x40 display → 50x50 cache (vs 1000px full-res)
- Poster thumbnails: 100x150 display → 120x180 cache
- Hero carousel: 500x300 display → 600x360 cache
- Series cover: 400x600 display → 480x720 cache

Implementation:
- Create ImageCacheConfig utility with presets
- Set memCacheWidth/Height for all CachedNetworkImage
- Configure DefaultCacheManager (200MB limit, 7-day TTL)
- Add standardized cache configuration across app

Expected impact:
- -60% image cache disk usage
- -40% memory footprint from cached images
- Faster image loading (smaller files to decode)
- Better performance on low-storage devices

Files modified:
- lib/core/utils/image_cache_config.dart (new)
- lib/mobile/widgets/mobile_poster_card.dart
- lib/core/widgets/components/hero_carousel.dart
- lib/features/iptv/widgets/mobile_live_tv_tab.dart
- lib/features/iptv/screens/mobile_series_detail_screen.dart

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
GitHub CopilotandClaude Haiku 4.5 committed 2026-03-25 22:36:14 +01:00
1 parent 6a956221a3
commit f9ab247ff5
5 files changed
+219

No files matched your search

@@ -2,6 +2,7 @@
import 'dart:async';
import 'package:flutter/material.dart';
import 'package:cached_network_image/cached_network_image.dart';
import '../../utils/image_cache_config.dart';
import 'package:google_fonts/google_fonts.dart';
import '../../theme/app_colors.dart';
import '../../theme/app_theme.dart';
@@ -104,9 +105,15 @@ class _HeroCarouselState extends State<HeroCarousel> {
fit: StackFit.expand,
children: [
// Background Image
// [P1-2 FIX] Optimize carousel image cache (500x300 display)
CachedNetworkImage(
imageUrl: item.imageUrl,
fit: BoxFit.cover,
memCacheWidth: 600,
memCacheHeight: 360,
maxWidthDiskCache: 600,
maxHeightDiskCache: 360,
cacheManager: AppCacheManager.instance,
placeholder: (context, url) => Container(color: AppColors.surfaceVariant),
errorWidget: (context, url, error) => Container(
color: AppColors.surfaceVariant,