fix(player): 完善进度预览清屏与下拉刷新
This commit is contained in:
1 parent
9b1afbdb36
commit
f8500bbaca
15 files changed
+949
-251
No files matched your search
@@ -170,11 +170,28 @@ class _SeekProgressBarState extends State<SeekProgressBar> {
|
||||
setState(() => _buffering = buffering);
|
||||
}
|
||||
|
||||
void _endPointerDrag() {
|
||||
if (!_dragging) {
|
||||
_pointerMoved = false;
|
||||
_pointerStart = null;
|
||||
_dragStartFraction = null;
|
||||
return;
|
||||
}
|
||||
final duration = widget.valueListenable?.value.duration ?? Duration.zero;
|
||||
final fraction = _previewFraction.value ?? _dragStartFraction ?? 0;
|
||||
unawaited(_finish(fraction, duration));
|
||||
}
|
||||
|
||||
Future<void> _finish(double fraction, Duration duration) async {
|
||||
final startedAt = _dragStartFraction;
|
||||
_dragStartFraction = null;
|
||||
if (widget.locked || !_dragging || startedAt == null) return;
|
||||
setState(() => _dragging = false);
|
||||
_dragging = false;
|
||||
if (!mounted) {
|
||||
widget.onScrubEnd?.call();
|
||||
return;
|
||||
}
|
||||
setState(() {});
|
||||
_pointerMoved = false;
|
||||
_pointerStart = null;
|
||||
widget.thumbnailService?.cancelPending();
|
||||
@@ -287,20 +304,8 @@ class _SeekProgressBarState extends State<SeekProgressBar> {
|
||||
_pointerMoved = true;
|
||||
}
|
||||
},
|
||||
onPointerUp: (_) {
|
||||
if (!_dragging) {
|
||||
_pointerMoved = false;
|
||||
_pointerStart = null;
|
||||
_dragStartFraction = null;
|
||||
}
|
||||
},
|
||||
onPointerCancel: (_) {
|
||||
if (!_dragging) {
|
||||
_pointerMoved = false;
|
||||
_pointerStart = null;
|
||||
_dragStartFraction = null;
|
||||
}
|
||||
},
|
||||
onPointerUp: (_) => _endPointerDrag(),
|
||||
onPointerCancel: (_) => _endPointerDrag(),
|
||||
child: Slider(
|
||||
value: fraction,
|
||||
// 轨道与上方文案共用同一层水平内边距,避免 Slider 默认内缩。
|
||||
|
||||
Reference in new issue
Block a user