Files
SpotiFLAC-Mobile/lib/widgets/mornye_player_artwork.dart
T
zarzet e61ff64adc feat(mornye): cache motion covers and refine player and search
Save album motion videos in app storage during downloads and prefer offline playback with an aspect-aware layout. Add cache management for saved videos.

Center active lyrics on opening, expand lyrics during manual scrolling, and adjust landscape header spacing. Group search rows and skeletons with dividers and remove redundant result icons.

Validation: Flutter analysis clean; 723 tests passed, 4 skipped; iOS simulator build installed.
2026-09-19 17:26:26 +07:00

48 lines
1.4 KiB
Dart

import 'package:audio_service/audio_service.dart';
import 'package:flutter/material.dart';
import 'package:spotiflac_android/widgets/motion_header_banner.dart';
import 'package:spotiflac_android/widgets/player_artwork.dart';
class MornyePlayerArtwork extends StatelessWidget {
const MornyePlayerArtwork({
super.key,
required this.mediaItem,
this.videoUrl,
this.onAspectRatioChanged,
this.onError,
});
final MediaItem mediaItem;
final String? videoUrl;
final ValueChanged<double>? onAspectRatioChanged;
final VoidCallback? onError;
@override
Widget build(BuildContext context) {
final fallback = Align(
alignment: Alignment.topCenter,
child: AspectRatio(
aspectRatio: 1,
child: PlayerArtwork(
artUri: mediaItem.artUri?.toString(),
colorScheme: Theme.of(context).colorScheme,
cacheWidth:
(MediaQuery.sizeOf(context).width *
MediaQuery.devicePixelRatioOf(context))
.round(),
),
),
);
if (MediaQuery.disableAnimationsOf(context)) return fallback;
return videoUrl == null
? fallback
: MotionHeaderBanner(
key: ValueKey(videoUrl),
videoUrl: videoUrl!,
fallback: fallback,
onAspectRatioChanged: onAspectRatioChanged,
onError: onError,
);
}
}