mirror of
https://github.com/zarzet/SpotiFLAC-Mobile.git
synced 2026-09-29 21:02:09 +02:00
Add a selectable Mornye theme with shared glass controls, dialogs, sheets, notifications, and collection headers while retaining Material components. Update player artwork, lyrics transitions and highlighting, synchronized rolling time labels, volume controls, and compact navigation. Unify metadata, Library, search, and extension surfaces; preserve restored artwork and report extension load failures. Validation: full Flutter analyzer clean; 713 tests passed and 4 skipped; pinned Dart formatting and diff checks passed; signed ARM64 and ARM32 release APKs built and verified.
63 lines
1.7 KiB
Dart
63 lines
1.7 KiB
Dart
import 'dart:io';
|
|
|
|
import 'package:cached_network_image/cached_network_image.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:path/path.dart' as p;
|
|
import 'package:spotiflac_android/services/cover_cache_manager.dart';
|
|
|
|
class PlayerArtwork extends StatelessWidget {
|
|
/// An HTTP(S) URL, file URI, or absolute local artwork path.
|
|
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://') || p.isAbsolute(uri)) {
|
|
final path = uri.startsWith('file://')
|
|
? Uri.parse(uri).toFilePath()
|
|
: uri;
|
|
return Image.file(
|
|
File(path),
|
|
fit: BoxFit.cover,
|
|
cacheWidth: cacheWidth,
|
|
errorBuilder: (_, _, _) => placeholder,
|
|
);
|
|
}
|
|
return placeholder;
|
|
}
|
|
}
|