mirror of
https://github.com/R0m1k3/xtremobile.git
synced 2026-10-19 21:28:31 +02:00
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:
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),
|
||||
),
|
||||
|
||||
@@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
import 'package:cached_network_image/cached_network_image.dart';
|
||||
import '../../../../core/utils/image_cache_config.dart';
|
||||
import 'dart:io';
|
||||
import '../../../providers/mobile_xtream_providers.dart';
|
||||
import '../../../providers/mobile_settings_providers.dart';
|
||||
@@ -622,11 +623,17 @@ class _MobileChannelCardState extends ConsumerState<_MobileChannelCard> {
|
||||
child: Stack(
|
||||
children: [
|
||||
// Logo
|
||||
// [P1-2 FIX] Optimize channel icon cache (40x40 display)
|
||||
Center(
|
||||
child: iconUrl != null
|
||||
? CachedNetworkImage(
|
||||
imageUrl: iconUrl,
|
||||
fit: BoxFit.contain,
|
||||
memCacheWidth: 50,
|
||||
memCacheHeight: 50,
|
||||
maxWidthDiskCache: 50,
|
||||
maxHeightDiskCache: 50,
|
||||
cacheManager: AppCacheManager.instance,
|
||||
errorWidget: (_, __, ___) => const Icon(
|
||||
Icons.tv,
|
||||
color: Colors.white38,
|
||||
|
||||
Reference in new issue
Block a user