mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-06-15 23:10:09 +08:00
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -1613,7 +1613,7 @@ class _VideoDetailPageVState extends State<VideoDetailPageV>
|
||||
}),
|
||||
manualPlayerWidget,
|
||||
|
||||
if (videoDetailController.plPlayerController.enableSponsorBlock ||
|
||||
if (videoDetailController.plPlayerController.enableBlock ||
|
||||
videoDetailController.continuePlayingPart)
|
||||
Positioned(
|
||||
left: 16,
|
||||
|
||||
@@ -61,9 +61,14 @@ import 'package:intl/intl.dart' show DateFormat;
|
||||
import 'package:material_design_icons_flutter/material_design_icons_flutter.dart';
|
||||
|
||||
mixin TimeBatteryMixin<T extends StatefulWidget> on State<T> {
|
||||
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<T extends StatefulWidget> on State<T> {
|
||||
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<HeaderControl>
|
||||
);
|
||||
}
|
||||
|
||||
late final _titleKey = GlobalKey();
|
||||
late final isFileSource = videoDetailCtr.isFileSource;
|
||||
|
||||
@override
|
||||
@@ -2449,6 +2452,7 @@ class HeaderControlState extends State<HeaderControl>
|
||||
videoDetail.title!;
|
||||
}
|
||||
return MarqueeText(
|
||||
key: _titleKey,
|
||||
title,
|
||||
spacing: 30,
|
||||
velocity: 30,
|
||||
@@ -2581,7 +2585,7 @@ class HeaderControlState extends State<HeaderControl>
|
||||
),
|
||||
),
|
||||
],
|
||||
if (plPlayerController.enableSponsorBlock == true)
|
||||
if (plPlayerController.enableSponsorBlock)
|
||||
SizedBox(
|
||||
width: 42,
|
||||
height: 34,
|
||||
|
||||
@@ -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<Color> blockColor = Pref.blockColor;
|
||||
|
||||
@@ -1787,7 +1787,7 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
||||
0,
|
||||
),
|
||||
),
|
||||
if (plPlayerController.enableSponsorBlock &&
|
||||
if (plPlayerController.enableBlock &&
|
||||
videoDetailController.segmentProgressList.isNotEmpty)
|
||||
Positioned(
|
||||
left: 0,
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user