fix(player): 播放页改为非阻塞加载

This commit is contained in:
Zhou Weidong committed 2026-10-26 17:43:57 +08:00
1 parent e8f192ccf8
commit ee4e573f4f
7 files changed
+239 -455

No files matched your search

@@ -0,0 +1,55 @@
// Author: fruit.com.cn
import 'package:flutter/material.dart';
import '../../../core/theme/app_colors.dart';
import '../../../core/theme/app_dimens.dart';
class PlayerLoadingOverlay extends StatelessWidget {
const PlayerLoadingOverlay({
super.key,
required this.opacity,
required this.onFadeEnd,
});
final double opacity;
final VoidCallback onFadeEnd;
@override
Widget build(BuildContext context) {
return IgnorePointer(
key: const Key('player-entry-loading-overlay'),
child: AnimatedOpacity(
opacity: opacity,
duration: const Duration(milliseconds: 140),
curve: Curves.easeOut,
onEnd: onFadeEnd,
child: ColoredBox(
color: AppColors.mediaBlack,
child: Center(
child: Container(
key: const Key('player-loading-surface'),
width: AppDimens.refreshIndicatorSize,
height: AppDimens.refreshIndicatorSize,
decoration: BoxDecoration(
color: AppColors.refreshIndicatorSurface,
borderRadius: BorderRadius.circular(
AppDimens.refreshIndicatorRadius,
),
),
alignment: Alignment.center,
child: const SizedBox.square(
dimension: AppDimens.refreshSpinnerSize,
child: CircularProgressIndicator(
key: Key('player-entry-loading'),
color: Colors.white,
strokeWidth: AppDimens.refreshSpinnerStroke,
),
),
),
),
),
),
);
}
}
@@ -58,7 +58,7 @@ class PlayerRenderStack extends StatefulWidget {
final PageController pageController;
final Map<PlayerRenderSlotRole, PlayerRenderSlotData> slots;
final VoidCallback? onCurrentVideoVisible;
final ValueChanged<int?>? onCurrentVideoVisible;
final bool showNeighbors;
@override
@@ -202,7 +202,7 @@ class _PlayerRenderStackState extends State<PlayerRenderStack> {
warmSlotReused: slot.warmSlotReused,
waitForPlaybackFrame: slot.waitForPlaybackFrame,
onVideoVisible: slot.role == PlayerRenderSlotRole.current
? widget.onCurrentVideoVisible
? () => widget.onCurrentVideoVisible?.call(slot.index)
: null,
),
),