Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mod: pip tap logic and appearance #694

Merged
merged 2 commits into from
Feb 5, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions lib/pages/player/player_item.dart
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ class _PlayerItemState extends State<PlayerItem>
}

void _handleDoubleTap() {
if (Utils.isDesktop()) {
if (Utils.isDesktop() && !videoPageController.isPip) {
handleFullscreen();
} else {
playerController.playOrPause();
Expand Down Expand Up @@ -685,7 +685,9 @@ class _PlayerItemState extends State<PlayerItem>
// F键被按下
if (event.logicalKey ==
LogicalKeyboardKey.keyF) {
handleFullscreen();
if (!videoPageController.isPip) {
handleFullscreen();
}
}
// D键盘被按下
if (event.logicalKey ==
Expand Down
21 changes: 11 additions & 10 deletions lib/pages/player/smallest_player_item_panel.dart
Original file line number Diff line number Diff line change
Expand Up @@ -651,16 +651,17 @@ class _SmallestPlayerItemPanelState extends State<SmallestPlayerItemPanel> {
],
),
),
if (!videoPageController.isPip)
IconButton(
color: Colors.white,
icon: Icon(videoPageController.isFullscreen
? Icons.fullscreen_exit_rounded
: Icons.fullscreen_rounded),
onPressed: () {
widget.handleFullscreen();
},
),
(!videoPageController.isPip)
? IconButton(
color: Colors.white,
icon: Icon(videoPageController.isFullscreen
? Icons.fullscreen_exit_rounded
: Icons.fullscreen_rounded),
onPressed: () {
widget.handleFullscreen();
},
)
: const Text(' '),
],
),
),
Expand Down
8 changes: 4 additions & 4 deletions lib/pages/video/video_controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,19 @@ abstract class _VideoPageController with Store {
@observable
int currentRoad = 0;

// 全屏状态
/// 全屏状态
@observable
bool isFullscreen = false;

// PIP状态
/// 画中画状态
@observable
bool isPip = false;

// 播放列表显示状态
/// 播放列表显示状态
@observable
bool showTabBody = true;

// 上次观看位置
/// 上次观看位置
@observable
int historyOffset = 0;

Expand Down
2 changes: 0 additions & 2 deletions lib/utils/utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -476,15 +476,13 @@ class Utils {
// 进入桌面设备小窗模式
static Future<void> enterDesktopPIPWindow() async {
await windowManager.setAlwaysOnTop(true);
await windowManager.setResizable(false);
await windowManager.setSize(const Size(480, 270));
}

// 退出桌面设备小窗模式
static Future<void> exitDesktopPIPWindow() async {
bool isLowResolution = await Utils.isLowResolution();
await windowManager.setAlwaysOnTop(false);
await windowManager.setResizable(true);
await windowManager.setSize(isLowResolution ? const Size(800, 600) : const Size(1280, 860));
await windowManager.center();
}
Expand Down
Loading