fix(player): 修正封面比例与首帧切换闪烁
This commit is contained in:
1 parent
04f034817c
commit
a3a79f7068
5 files changed
+148
-7
No files matched your search
@@ -12,6 +12,9 @@ import '../../../core/theme/app_colors.dart';
|
||||
import '../../../core/widgets/remote_image.dart';
|
||||
import 'scrub_preview_card.dart';
|
||||
|
||||
const double _posterAspectRatio = 3 / 4;
|
||||
const double _posterBlurSigma = 18;
|
||||
|
||||
/// 封面立即可见,雪碧图首帧解码完成后再覆盖封面。
|
||||
Widget? playerOpeningFrame(String? thumbnailsUrl, {String? posterUrl}) {
|
||||
final url = thumbnailsUrl?.trim() ?? '';
|
||||
@@ -82,11 +85,33 @@ class _PlayerOpeningFrameState extends State<PlayerOpeningFrame> {
|
||||
children: [
|
||||
const ColoredBox(color: AppColors.mediaBlack),
|
||||
if (posterUrl != null)
|
||||
RemoteImage(
|
||||
posterUrl,
|
||||
key: const Key('player-opening-poster'),
|
||||
fit: BoxFit.cover,
|
||||
fallbackColor: AppColors.mediaBlack,
|
||||
Positioned.fill(
|
||||
child: ImageFiltered(
|
||||
key: const Key('player-opening-poster-blur'),
|
||||
imageFilter: ui.ImageFilter.blur(
|
||||
sigmaX: _posterBlurSigma,
|
||||
sigmaY: _posterBlurSigma,
|
||||
),
|
||||
child: RemoteImage(
|
||||
posterUrl,
|
||||
key: const Key('player-opening-poster-backdrop'),
|
||||
fit: BoxFit.cover,
|
||||
fallbackColor: AppColors.mediaBlack,
|
||||
),
|
||||
),
|
||||
),
|
||||
if (posterUrl != null)
|
||||
Center(
|
||||
child: AspectRatio(
|
||||
key: const Key('player-opening-poster-stage'),
|
||||
aspectRatio: _posterAspectRatio,
|
||||
child: RemoteImage(
|
||||
posterUrl,
|
||||
key: const Key('player-opening-poster'),
|
||||
fit: BoxFit.cover,
|
||||
fallbackColor: AppColors.mediaBlack,
|
||||
),
|
||||
),
|
||||
),
|
||||
if (frame != null)
|
||||
SpriteCropPreview(
|
||||
|
||||
Reference in new issue
Block a user