mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
@@ -110,21 +110,17 @@ class _MainAppState extends State<MainApp>
|
||||
|
||||
@override
|
||||
Future<void> onWindowMoved() async {
|
||||
if (!await windowManager.isMaximized()) {
|
||||
final Offset offset = await windowManager.getPosition();
|
||||
_setting.put(SettingBoxKey.windowPosition, [
|
||||
offset.dx,
|
||||
offset.dy,
|
||||
]);
|
||||
}
|
||||
final Offset offset = await windowManager.getPosition();
|
||||
_setting.put(SettingBoxKey.windowPosition, [offset.dx, offset.dy]);
|
||||
}
|
||||
|
||||
@override
|
||||
Future<void> onWindowResized() async {
|
||||
final Rect bounds = await windowManager.getBounds();
|
||||
_setting
|
||||
..put(SettingBoxKey.windowSize, [bounds.width, bounds.height])
|
||||
..put(SettingBoxKey.windowPosition, [bounds.left, bounds.top]);
|
||||
_setting.putAll({
|
||||
SettingBoxKey.windowSize: [bounds.width, bounds.height],
|
||||
SettingBoxKey.windowPosition: [bounds.left, bounds.top],
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
|
||||
@@ -1622,9 +1622,9 @@ class HeaderControlState extends TripleState<HeaderControl> {
|
||||
data: sliderTheme,
|
||||
child: Slider(
|
||||
min: 0,
|
||||
max: 3,
|
||||
max: 5,
|
||||
value: strokeWidth,
|
||||
divisions: 6,
|
||||
divisions: 10,
|
||||
label: '$strokeWidth',
|
||||
onChanged: updateStrokeWidth,
|
||||
onChangeEnd: (_) => plPlayerController
|
||||
|
||||
@@ -374,16 +374,29 @@ class PlPlayerController {
|
||||
|
||||
late final Rx<SubtitleViewConfiguration> subtitleConfig = _getSubConfig.obs;
|
||||
|
||||
SubtitleViewConfiguration get _getSubConfig => SubtitleViewConfiguration(
|
||||
style: subTitleStyle,
|
||||
padding: EdgeInsets.only(
|
||||
left: subtitlePaddingH.toDouble(),
|
||||
right: subtitlePaddingH.toDouble(),
|
||||
bottom: subtitlePaddingB.toDouble(),
|
||||
),
|
||||
textScaleFactor: 1,
|
||||
strokeWidth: subtitleBgOpaticy == 0 ? subtitleStrokeWidth : null,
|
||||
);
|
||||
SubtitleViewConfiguration get _getSubConfig {
|
||||
final subTitleStyle = this.subTitleStyle;
|
||||
return SubtitleViewConfiguration(
|
||||
style: subTitleStyle,
|
||||
strokeStyle: subtitleBgOpaticy == 0
|
||||
? subTitleStyle.copyWith(
|
||||
color: null,
|
||||
background: null,
|
||||
backgroundColor: null,
|
||||
foreground: Paint()
|
||||
..color = Colors.black
|
||||
..style = PaintingStyle.stroke
|
||||
..strokeWidth = subtitleStrokeWidth,
|
||||
)
|
||||
: null,
|
||||
padding: EdgeInsets.only(
|
||||
left: subtitlePaddingH.toDouble(),
|
||||
right: subtitlePaddingH.toDouble(),
|
||||
bottom: subtitlePaddingB.toDouble(),
|
||||
),
|
||||
textScaleFactor: 1,
|
||||
);
|
||||
}
|
||||
|
||||
void updateSubtitleStyle() {
|
||||
subtitleConfig.value = _getSubConfig;
|
||||
|
||||
@@ -1009,107 +1009,6 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
||||
_gestureType = null;
|
||||
}
|
||||
|
||||
void onVerticalDragStart(DragStartDetails details) {
|
||||
if (plPlayerController.controlsLock.value) return;
|
||||
if (details.localPosition.dy < 40) return;
|
||||
if (details.localPosition.dx < 40) return;
|
||||
if (details.localPosition.dx > maxWidth - 40) return;
|
||||
if (details.localPosition.dy > maxHeight - 40) return;
|
||||
_initialFocalPoint = details.localPosition;
|
||||
_gestureType = null;
|
||||
}
|
||||
|
||||
void onVerticalDragUpdate(DragUpdateDetails details) {
|
||||
if (plPlayerController.controlsLock.value) return;
|
||||
if (!plPlayerController.enableSlideVolumeBrightness &&
|
||||
!plPlayerController.enableSlideFS) {
|
||||
return;
|
||||
}
|
||||
final double tapPosition = details.localPosition.dx;
|
||||
final double sectionWidth = maxWidth / 3;
|
||||
late GestureType gestureType;
|
||||
if (tapPosition < sectionWidth) {
|
||||
if (Utils.isDesktop || !plPlayerController.enableSlideVolumeBrightness) {
|
||||
return;
|
||||
}
|
||||
// 左边区域
|
||||
gestureType = GestureType.left;
|
||||
} else if (tapPosition < sectionWidth * 2) {
|
||||
if (!plPlayerController.enableSlideFS) {
|
||||
return;
|
||||
}
|
||||
// 全屏
|
||||
gestureType = GestureType.center;
|
||||
} else {
|
||||
if (!plPlayerController.enableSlideVolumeBrightness) {
|
||||
return;
|
||||
}
|
||||
// 右边区域
|
||||
gestureType = GestureType.right;
|
||||
}
|
||||
|
||||
if (_gestureType != null && _gestureType != gestureType) {
|
||||
return;
|
||||
}
|
||||
_gestureType = gestureType;
|
||||
|
||||
if (_gestureType == GestureType.left) {
|
||||
// 左边区域 👈
|
||||
final double level = maxHeight * 3;
|
||||
final double brightness =
|
||||
_brightnessValue.value - details.delta.dy / level;
|
||||
final double result = brightness.clamp(0.0, 1.0);
|
||||
setBrightness(result);
|
||||
} else if (_gestureType == GestureType.center) {
|
||||
// 全屏
|
||||
const double threshold = 2.5; // 滑动阈值
|
||||
double cumulativeDy = details.localPosition.dy - _initialFocalPoint.dy;
|
||||
|
||||
void fullScreenTrigger(bool status) {
|
||||
plPlayerController.triggerFullScreen(status: status);
|
||||
}
|
||||
|
||||
if (cumulativeDy > threshold) {
|
||||
_gestureType = GestureType.center_down;
|
||||
if (isFullScreen ^ plPlayerController.fullScreenGestureReverse) {
|
||||
fullScreenTrigger(
|
||||
plPlayerController.fullScreenGestureReverse,
|
||||
);
|
||||
}
|
||||
// if (kDebugMode) debugPrint('center_down:$cumulativeDy');
|
||||
} else if (cumulativeDy < -threshold) {
|
||||
_gestureType = GestureType.center_up;
|
||||
if (!isFullScreen ^ plPlayerController.fullScreenGestureReverse) {
|
||||
fullScreenTrigger(
|
||||
!plPlayerController.fullScreenGestureReverse,
|
||||
);
|
||||
}
|
||||
// if (kDebugMode) debugPrint('center_up:$cumulativeDy');
|
||||
}
|
||||
} else if (_gestureType == GestureType.right) {
|
||||
// 右边区域
|
||||
final double level = maxHeight * 0.5;
|
||||
EasyThrottle.throttle(
|
||||
'setVolume',
|
||||
const Duration(milliseconds: 20),
|
||||
() {
|
||||
final double volume = clampDouble(
|
||||
plPlayerController.volume.value - details.delta.dy / level,
|
||||
0.0,
|
||||
1.0,
|
||||
);
|
||||
setVolume(volume);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
void onVerticalDragEnd(DragEndDetails details) {
|
||||
interacting = false;
|
||||
_initialFocalPoint = Offset.zero;
|
||||
_gestureType = null;
|
||||
}
|
||||
|
||||
void onDoubleTapDown(TapDownDetails details) {
|
||||
if (plPlayerController.controlsLock.value) {
|
||||
return;
|
||||
@@ -1283,9 +1182,6 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
||||
onInteractionEnd: _onInteractionEnd,
|
||||
flipX: plPlayerController.flipX.value,
|
||||
flipY: plPlayerController.flipY.value,
|
||||
onVerticalDragStart: onVerticalDragStart,
|
||||
onVerticalDragUpdate: onVerticalDragUpdate,
|
||||
onVerticalDragEnd: onVerticalDragEnd,
|
||||
onTap: () => plPlayerController.controls =
|
||||
!plPlayerController.showControls.value,
|
||||
onDoubleTapDown: onDoubleTapDown,
|
||||
|
||||
@@ -117,7 +117,7 @@ abstract class LoginUtils {
|
||||
GrpcReq.updateHeaders(null);
|
||||
|
||||
await Future.wait([
|
||||
web.CookieManager().deleteAllCookies(),
|
||||
if (!Platform.isWindows) web.CookieManager().deleteAllCookies(),
|
||||
GStorage.userInfo.delete('userInfoCache'),
|
||||
]);
|
||||
|
||||
|
||||
@@ -1195,7 +1195,7 @@ packages:
|
||||
description:
|
||||
path: media_kit_video
|
||||
ref: "version_1.2.5"
|
||||
resolved-ref: "484d040a05133343eb01752ce48bfe545219a80a"
|
||||
resolved-ref: "3ab061c314d0a7f57e8cd6ea610cc1977686fdc1"
|
||||
url: "https://github.com/bggRGjQaUbCoE/media-kit.git"
|
||||
source: git
|
||||
version: "1.2.5"
|
||||
|
||||
Reference in New Issue
Block a user