fix(recommend): 恢复进度拖动前浮层状态
This commit is contained in:
1 parent
c478eebb0e
commit
b6666290ba
7 files changed
+47
-43
No files matched your search
@@ -18,6 +18,7 @@ abstract final class AppColors {
|
||||
static const scrim = Color(0xD1000000);
|
||||
static const controlScrim = Color(0x80000000);
|
||||
static const controlSoftScrim = Color(0x42000000);
|
||||
static const timeBubbleScrim = Color(0xB3000000);
|
||||
static const scrubPreviewScrim = Color(0xDE000000);
|
||||
static const overlaySoft = Color(0x66000000);
|
||||
static const overlayBar = Color(0x4D000000);
|
||||
|
||||
@@ -119,7 +119,6 @@ class _PlayerPageState extends State<PlayerPage>
|
||||
double _playbackSpeed = 1.0;
|
||||
bool _boosting = false;
|
||||
bool _scrubbing = false;
|
||||
bool _clearScreenFromScrub = false;
|
||||
double? _speedBeforeBoost;
|
||||
bool? _chromeBeforeBoost;
|
||||
|
||||
@@ -315,26 +314,24 @@ class _PlayerPageState extends State<PlayerPage>
|
||||
widget.onScrubVisibilityChanged?.call(value);
|
||||
}
|
||||
|
||||
void _finishFeedScrub() {
|
||||
void _finishFeedScrub(bool wasVisible) {
|
||||
setState(() {
|
||||
_scrubbing = false;
|
||||
_chromeVisible = false;
|
||||
_clearScreenFromScrub = true;
|
||||
_chromeVisible = wasVisible;
|
||||
});
|
||||
widget.onScrubVisibilityChanged?.call(!wasVisible);
|
||||
}
|
||||
|
||||
void _cancelFeedScrub() {
|
||||
logic.cancelScrub();
|
||||
_scrubbing = false;
|
||||
_chromeVisible = true;
|
||||
_clearScreenFromScrub = false;
|
||||
}
|
||||
|
||||
void _restoreFeedChrome() {
|
||||
setState(() {
|
||||
_scrubbing = false;
|
||||
_chromeVisible = true;
|
||||
_clearScreenFromScrub = false;
|
||||
});
|
||||
widget.onScrubVisibilityChanged?.call(false);
|
||||
}
|
||||
@@ -749,11 +746,7 @@ class _PlayerPageState extends State<PlayerPage>
|
||||
? null
|
||||
: () => _openUnlockSheet(context, index, episode),
|
||||
),
|
||||
if (widget.homeMode &&
|
||||
!_chromeVisible &&
|
||||
!_boosting &&
|
||||
!_scrubbing &&
|
||||
!_clearScreenFromScrub)
|
||||
if (widget.homeMode && !_chromeVisible && !_boosting && !_scrubbing)
|
||||
Positioned(
|
||||
right: 12,
|
||||
bottom: 56,
|
||||
|
||||
@@ -89,7 +89,7 @@ class HomeFeedOverlay extends StatefulWidget {
|
||||
final VoidCallback onBoostEnd;
|
||||
final VoidCallback onMore;
|
||||
final VoidCallback? onScrubStart;
|
||||
final VoidCallback? onScrubEnd;
|
||||
final ValueChanged<bool>? onScrubEnd;
|
||||
final ValueChanged<bool>? onScrubVisibilityChanged;
|
||||
final ValueChanged<Duration>? onSeek;
|
||||
final int cancelScrubRequest;
|
||||
@@ -102,14 +102,13 @@ class HomeFeedOverlay extends StatefulWidget {
|
||||
|
||||
class _HomeFeedOverlayState extends State<HomeFeedOverlay> {
|
||||
bool _scrubbing = false;
|
||||
bool _clearAfterScrub = false;
|
||||
bool _wasVisibleBeforeScrub = true;
|
||||
|
||||
@override
|
||||
void didUpdateWidget(covariant HomeFeedOverlay oldWidget) {
|
||||
super.didUpdateWidget(oldWidget);
|
||||
if (oldWidget.cancelScrubRequest != widget.cancelScrubRequest) {
|
||||
_scrubbing = false;
|
||||
_clearAfterScrub = false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -138,7 +137,7 @@ class _HomeFeedOverlayState extends State<HomeFeedOverlay> {
|
||||
),
|
||||
if (widget.boosting)
|
||||
Positioned(left: 0, right: 0, bottom: 20, child: _boostHint())
|
||||
else if (widget.visible && !_scrubbing && !_clearAfterScrub)
|
||||
else if (widget.visible && !_scrubbing)
|
||||
Positioned(
|
||||
left: _pageHorizontal,
|
||||
right: _railRight,
|
||||
@@ -176,31 +175,19 @@ class _HomeFeedOverlayState extends State<HomeFeedOverlay> {
|
||||
}
|
||||
|
||||
void _startScrub() {
|
||||
if (!_scrubbing || _clearAfterScrub) {
|
||||
setState(() {
|
||||
_scrubbing = true;
|
||||
_clearAfterScrub = false;
|
||||
});
|
||||
}
|
||||
_wasVisibleBeforeScrub = widget.visible;
|
||||
if (!_scrubbing) setState(() => _scrubbing = true);
|
||||
widget.onScrubVisibilityChanged?.call(true);
|
||||
widget.onScrubStart?.call();
|
||||
}
|
||||
|
||||
void _endScrub() {
|
||||
if (_scrubbing || !_clearAfterScrub) {
|
||||
setState(() {
|
||||
_scrubbing = false;
|
||||
_clearAfterScrub = true;
|
||||
});
|
||||
}
|
||||
widget.onScrubEnd?.call();
|
||||
final wasVisible = _wasVisibleBeforeScrub;
|
||||
if (_scrubbing) setState(() => _scrubbing = false);
|
||||
widget.onScrubEnd?.call(wasVisible);
|
||||
}
|
||||
|
||||
void _handleSurfaceTap() {
|
||||
if (_clearAfterScrub) {
|
||||
setState(() => _clearAfterScrub = false);
|
||||
widget.onScrubVisibilityChanged?.call(false);
|
||||
}
|
||||
widget.onTogglePlay();
|
||||
}
|
||||
|
||||
|
||||
@@ -150,7 +150,7 @@ class _FeedProgressBarState extends State<_FeedProgressBar> {
|
||||
if (showPreview)
|
||||
Positioned(
|
||||
left: _timeBubbleLeft(width, _preview!),
|
||||
bottom: widget.hitHeight + 8,
|
||||
bottom: _lineCenterFromBottom + 16,
|
||||
child: _ScrubTimeBubble(
|
||||
key: const Key('scrub-preview-time-bubble'),
|
||||
position: previewPosition,
|
||||
@@ -377,9 +377,9 @@ class _ScrubTimeBubble extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
width: _timeBubbleWidth,
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 6),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 6, vertical: 3),
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.overlayMedium,
|
||||
color: AppColors.timeBubbleScrim,
|
||||
borderRadius: BorderRadius.circular(6),
|
||||
),
|
||||
child: Text(
|
||||
|
||||
Reference in new issue
Block a user