mirror of
https://github.com/zarzet/SpotiFLAC-Mobile.git
synced 2026-04-12 06:38:32 +02:00
- Move explore JSON decode/encode to compute() isolate to avoid blocking main thread - Memoize search sort results (artists/albums/playlists/tracks) in HomeTab; invalidate on new query - Extract _DownloadedOrRemoteCover StatefulWidget with proper embedded-cover lifecycle management - Replace O(playlists x tracks) in-memory playlist picker check with SQL loadPlaylistPickerSummaries query - Add FutureProvider.family (libraryPlaylistPickerSummariesProvider) invalidated on all playlist mutations - Memoize _buildQueueHistoryStats, localPathMatchKeys, and localSingleItems in QueueTab - Add coverCacheWidthForViewport util; apply memCacheWidth/cacheWidth based on real DPR across all album/playlist/track screens - Convert sync file ops in TrackMetadataScreen to async; use mtime+size as validation token - Fetch Deezer album nb_tracks in parallel via fetchAlbumTrackCounts
13 lines
356 B
Dart
13 lines
356 B
Dart
import 'package:flutter/widgets.dart';
|
|
|
|
int coverCacheWidthForViewport(
|
|
BuildContext context, {
|
|
double widthMultiplier = 1.0,
|
|
int min = 320,
|
|
int max = 2048,
|
|
}) {
|
|
final dpr = MediaQuery.devicePixelRatioOf(context);
|
|
final logicalWidth = MediaQuery.sizeOf(context).width * widthMultiplier;
|
|
return (logicalWidth * dpr).round().clamp(min, max);
|
|
}
|