feat(player): 未就绪改由进度条展示加载态

This commit is contained in:
Zhou Weidong committed 2026-10-21 10:07:34 +08:00
1 parent 76cc52ad66
commit cf4b07aa69
12 files changed
+359 -167

No files matched your search

@@ -37,10 +37,13 @@ class _FeedProgressBarState extends State<_FeedProgressBar> {
final width = constraints.maxWidth;
final source = widget.controller;
final track = source == null
? _track(0, width)
? _loadingTrack()
: ValueListenableBuilder<VideoPlayerValue>(
valueListenable: source,
builder: (context, value, _) {
if (!value.isInitialized || value.isBuffering) {
return _loadingTrack();
}
final total = value.duration.inMilliseconds;
final played = total <= 0
? 0.0
@@ -67,6 +70,23 @@ class _FeedProgressBarState extends State<_FeedProgressBar> {
);
}
Widget _loadingTrack() {
final bottom = _lineCenterFromBottom - widget.height / 2;
return SizedBox(
height: widget.hitHeight,
child: Stack(
children: [
Positioned(
left: 0,
right: 0,
bottom: bottom,
child: LoadingProgressTrack(height: widget.height),
),
],
),
);
}
void _update(double fraction) {
setState(() => _preview = fraction.clamp(0.0, 1.0).toDouble());
}