mirror of
https://github.com/zarzet/SpotiFLAC-Mobile.git
synced 2026-07-29 15:28:48 +02:00
- single-track convert sheet now reuses BatchConvertSheet (confirmLabelBuilder + sourceIsLossless params) instead of a full inline copy - provider priority page migrated to PrioritySettingsScaffold; shared showDiscardChangesDialog and ReorderablePriorityItem replace per-page copies - home tab search rows unified into one _SearchResultRowItem; _parseTrack copies rebuilt on Track.fromBackendMap with only the load-bearing local overrides kept; loading/error scaffold extracted - PlayerArtwork widget shared by now-playing and mini player - LocalOrNetworkCoverImage dispatches file vs network cover in one place (playlist picker, queue nav, library folder)
59 lines
1.5 KiB
Dart
59 lines
1.5 KiB
Dart
import 'dart:io';
|
|
|
|
import 'package:cached_network_image/cached_network_image.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:spotiflac_android/services/cover_cache_manager.dart';
|
|
|
|
class PlayerArtwork extends StatelessWidget {
|
|
final String? artUri;
|
|
final ColorScheme colorScheme;
|
|
final int? cacheWidth;
|
|
final double iconSize;
|
|
|
|
const PlayerArtwork({
|
|
super.key,
|
|
required this.artUri,
|
|
required this.colorScheme,
|
|
this.cacheWidth,
|
|
this.iconSize = 40,
|
|
});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final placeholder = Container(
|
|
color: colorScheme.surfaceContainerHighest,
|
|
child: Icon(
|
|
Icons.music_note,
|
|
size: iconSize,
|
|
color: colorScheme.onSurfaceVariant,
|
|
),
|
|
);
|
|
|
|
final uri = artUri;
|
|
if (uri == null || uri.isEmpty) return placeholder;
|
|
|
|
if (uri.startsWith('http')) {
|
|
return CachedNetworkImage(
|
|
imageUrl: uri,
|
|
fit: BoxFit.cover,
|
|
cacheManager: CoverCacheManager.instance,
|
|
memCacheWidth: cacheWidth,
|
|
fadeInDuration: const Duration(milliseconds: 150),
|
|
fadeOutDuration: const Duration(milliseconds: 0),
|
|
placeholder: (_, _) => placeholder,
|
|
errorWidget: (_, _, _) => placeholder,
|
|
);
|
|
}
|
|
if (uri.startsWith('file://')) {
|
|
final path = Uri.parse(uri).toFilePath();
|
|
return Image.file(
|
|
File(path),
|
|
fit: BoxFit.cover,
|
|
cacheWidth: cacheWidth,
|
|
errorBuilder: (_, _, _) => placeholder,
|
|
);
|
|
}
|
|
return placeholder;
|
|
}
|
|
}
|