diff --git a/lib/common/widgets/marquee.dart b/lib/common/widgets/marquee.dart index be4021070..08fa208ee 100644 --- a/lib/common/widgets/marquee.dart +++ b/lib/common/widgets/marquee.dart @@ -399,12 +399,12 @@ class _MarqueeSimulation extends Simulation { class ContextSingleTicker implements TickerProvider { Ticker? _ticker; BuildContext context; - final bool autoStart; + final bool Function()? autoStart; - ContextSingleTicker(this.context, {this.autoStart = true}); + ContextSingleTicker(this.context, {this.autoStart}); void initStart() { - if (autoStart) { + if (autoStart?.call() ?? true) { _ticker?.start(); } } diff --git a/lib/pages/dynamics/widgets/additional_panel.dart b/lib/pages/dynamics/widgets/additional_panel.dart index e4a5eeaf0..fcb97a0ad 100644 --- a/lib/pages/dynamics/widgets/additional_panel.dart +++ b/lib/pages/dynamics/widgets/additional_panel.dart @@ -149,7 +149,7 @@ Widget addWidget( builder: (context) { final btn = reserve.button!; final isReserved = btn.status == btn.type; - final bool canJump = btn.jumpUrl != null; + final bool canJump = btn.jumpUrl?.isNotEmpty == true; return FilledButton.tonal( style: FilledButton.styleFrom( foregroundColor: canJump diff --git a/lib/pages/video/controller.dart b/lib/pages/video/controller.dart index b8f7726c9..aa71fa1c7 100644 --- a/lib/pages/video/controller.dart +++ b/lib/pages/video/controller.dart @@ -1185,7 +1185,7 @@ class VideoDetailController extends GetxController ); if (!isFileSource) { - if (plPlayerController.enableSponsorBlock) { + if (plPlayerController.enableBlock) { initSkip(); } @@ -1707,7 +1707,7 @@ class VideoDetailController extends GetxController } // sponsor block - if (plPlayerController.enableSponsorBlock) { + if (plPlayerController.enableBlock) { _lastPos = null; positionSubscription?.cancel(); positionSubscription = null; @@ -1799,7 +1799,7 @@ class VideoDetailController extends GetxController @pragma('vm:notify-debugger-on-exception') bool onSkipSegment() { try { - if (plPlayerController.enableSponsorBlock) { + if (plPlayerController.enableBlock) { if (listData.lastOrNull case SegmentModel item) { onSkip(item, isSeek: false); onRemoveItem(listData.indexOf(item), item); diff --git a/lib/pages/video/view.dart b/lib/pages/video/view.dart index 8189f5a02..498a6b99f 100644 --- a/lib/pages/video/view.dart +++ b/lib/pages/video/view.dart @@ -1613,7 +1613,7 @@ class _VideoDetailPageVState extends State }), manualPlayerWidget, - if (videoDetailController.plPlayerController.enableSponsorBlock || + if (videoDetailController.plPlayerController.enableBlock || videoDetailController.continuePlayingPart) Positioned( left: 16, diff --git a/lib/pages/video/widgets/header_control.dart b/lib/pages/video/widgets/header_control.dart index e771268bd..a0a7e807d 100644 --- a/lib/pages/video/widgets/header_control.dart +++ b/lib/pages/video/widgets/header_control.dart @@ -61,9 +61,14 @@ import 'package:intl/intl.dart' show DateFormat; import 'package:material_design_icons_flutter/material_design_icons_flutter.dart'; mixin TimeBatteryMixin on State { + PlPlayerController get plPlayerController; ContextSingleTicker? provider; - ContextSingleTicker get effectiveProvider => - provider ??= ContextSingleTicker(context, autoStart: false); + ContextSingleTicker get effectiveProvider => provider ??= ContextSingleTicker( + context, + autoStart: () => + plPlayerController.showControls.value && + !plPlayerController.controlsLock.value, + ); bool get isPortrait; bool get isFullScreen; @@ -102,10 +107,7 @@ mixin TimeBatteryMixin on State { bool _showCurrTime = false; void showCurrTimeIfNeeded(bool isFullScreen) { _showCurrTime = !isPortrait && (isFullScreen || !horizontalScreen); - if (_showCurrTime) { - now.value = _format.format(DateTime.now()); - getBatteryLevelIfNeeded(); - } else { + if (!_showCurrTime) { stopClock(); } } @@ -2415,6 +2417,7 @@ class HeaderControlState extends State ); } + late final _titleKey = GlobalKey(); late final isFileSource = videoDetailCtr.isFileSource; @override @@ -2449,6 +2452,7 @@ class HeaderControlState extends State videoDetail.title!; } return MarqueeText( + key: _titleKey, title, spacing: 30, velocity: 30, @@ -2581,7 +2585,7 @@ class HeaderControlState extends State ), ), ], - if (plPlayerController.enableSponsorBlock == true) + if (plPlayerController.enableSponsorBlock) SizedBox( width: 42, height: 34, diff --git a/lib/plugin/pl_player/controller.dart b/lib/plugin/pl_player/controller.dart index cc296b056..f3a8aefe6 100644 --- a/lib/plugin/pl_player/controller.dart +++ b/lib/plugin/pl_player/controller.dart @@ -399,7 +399,8 @@ class PlPlayerController { late final pgcSkipType = Pref.pgcSkipType; late final enablePgcSkip = Pref.pgcSkipType != SkipType.disable; // sponsor block - late final bool enableSponsorBlock = Pref.enableSponsorBlock || enablePgcSkip; + late final bool enableSponsorBlock = Pref.enableSponsorBlock; + late final bool enableBlock = enableSponsorBlock || enablePgcSkip; late final double blockLimit = Pref.blockLimit; late final blockSettings = Pref.blockSettings; late final List blockColor = Pref.blockColor; diff --git a/lib/plugin/pl_player/view.dart b/lib/plugin/pl_player/view.dart index 08442da8d..f27151857 100644 --- a/lib/plugin/pl_player/view.dart +++ b/lib/plugin/pl_player/view.dart @@ -1787,7 +1787,7 @@ class _PLVideoPlayerState extends State 0, ), ), - if (plPlayerController.enableSponsorBlock && + if (plPlayerController.enableBlock && videoDetailController.segmentProgressList.isNotEmpty) Positioned( left: 0, diff --git a/lib/plugin/pl_player/widgets/bottom_control.dart b/lib/plugin/pl_player/widgets/bottom_control.dart index a20d43ea1..ff91a54d0 100644 --- a/lib/plugin/pl_player/widgets/bottom_control.dart +++ b/lib/plugin/pl_player/widgets/bottom_control.dart @@ -132,7 +132,7 @@ class BottomControl extends StatelessWidget { alignment: Alignment.bottomCenter, children: [ progressBar(), - if (controller.enableSponsorBlock && + if (controller.enableBlock && videoDetailController.segmentProgressList.isNotEmpty) Positioned( left: 0,