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

@@ -7,6 +7,7 @@ import '../../../providers/mobile_xtream_providers.dart';
import '../../../providers/mobile_settings_providers.dart';
import 'native_player_screen.dart';
import '../../../../core/theme/app_colors.dart';
import '../../../../core/utils/image_cache_config.dart';
class MobileSeriesDetailScreen extends ConsumerStatefulWidget {
final Series series;
@@ -137,9 +138,15 @@ class _MobileSeriesDetailScreenState
fit: StackFit.expand,
children: [
if (_seriesInfo!.cover != null)
// [P1-2 FIX] Optimize series cover image cache (400x600 display)
CachedNetworkImage(
imageUrl: _seriesInfo!.cover!,
fit: BoxFit.cover,
memCacheWidth: 480,
memCacheHeight: 720,
maxWidthDiskCache: 480,
maxHeightDiskCache: 720,
cacheManager: AppCacheManager.instance,
errorWidget: (_, __, ___) =>
Container(color: Colors.grey.shade900),
),