mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
fix: 播放页横屏适配修复
This commit is contained in:
@@ -3,6 +3,8 @@ import 'package:get/get.dart';
|
||||
import 'package:pilipala/common/widgets/stat/danmu.dart';
|
||||
import 'package:pilipala/common/widgets/stat/view.dart';
|
||||
|
||||
import '../../../../utils/utils.dart';
|
||||
|
||||
|
||||
class IntroDetail extends StatelessWidget {
|
||||
final dynamic bangumiDetail;
|
||||
@@ -21,7 +23,7 @@ class IntroDetail extends StatelessWidget {
|
||||
return Container(
|
||||
color: Theme.of(context).colorScheme.background,
|
||||
padding: const EdgeInsets.only(left: 14, right: 14),
|
||||
height: context.height.abs() * 0.7,
|
||||
height: Utils.getSheetHeight(context),
|
||||
child: Column(
|
||||
children: [
|
||||
Container(
|
||||
|
||||
@@ -7,6 +7,8 @@ import 'package:pilipala/pages/video/detail/index.dart';
|
||||
import 'package:pilipala/utils/storage.dart';
|
||||
import 'package:scrollable_positioned_list/scrollable_positioned_list.dart';
|
||||
|
||||
import '../../../utils/utils.dart';
|
||||
|
||||
class BangumiPanel extends StatefulWidget {
|
||||
const BangumiPanel({
|
||||
super.key,
|
||||
@@ -78,7 +80,7 @@ class _BangumiPanelState extends State<BangumiPanel> {
|
||||
});
|
||||
// 在这里使用 setState 更新状态
|
||||
return Container(
|
||||
height: context.height.abs() * 0.7,
|
||||
height: Utils.getSheetHeight(context),
|
||||
color: Theme.of(context).colorScheme.background,
|
||||
child: Column(
|
||||
children: [
|
||||
|
||||
@@ -117,10 +117,10 @@ class _PlaySettingState extends State<PlaySetting> {
|
||||
defaultVal: false,
|
||||
),
|
||||
const SetSwitchItem(
|
||||
title: '恢复竖屏',
|
||||
subTitle: '退出全屏视频时自动恢复竖屏,关闭可以保持横屏状态',
|
||||
setKey: SettingBoxKey.exitFullscreenAutoVertical,
|
||||
defaultVal: true,
|
||||
title: '横屏适配(测试)',
|
||||
subTitle: '开启该项在播放页启用横屏布局与逻辑',
|
||||
setKey: SettingBoxKey.horizontalScreen,
|
||||
defaultVal: false,
|
||||
),
|
||||
const SetSwitchItem(
|
||||
title: '开启硬解',
|
||||
|
||||
@@ -3,6 +3,8 @@ import 'package:get/get.dart';
|
||||
import 'package:pilipala/common/widgets/http_error.dart';
|
||||
import 'package:pilipala/utils/feed_back.dart';
|
||||
|
||||
import '../../../../../utils/utils.dart';
|
||||
|
||||
class FavPanel extends StatefulWidget {
|
||||
const FavPanel({super.key, this.ctr});
|
||||
final dynamic ctr;
|
||||
@@ -23,7 +25,7 @@ class _FavPanelState extends State<FavPanel> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
height: context.height.abs() * 0.7,
|
||||
height: Utils.getSheetHeight(context),
|
||||
color: Theme.of(context).colorScheme.background,
|
||||
child: Column(
|
||||
children: [
|
||||
|
||||
@@ -6,6 +6,8 @@ import 'package:pilipala/http/member.dart';
|
||||
import 'package:pilipala/models/member/tags.dart';
|
||||
import 'package:pilipala/utils/feed_back.dart';
|
||||
|
||||
import '../../../../../utils/utils.dart';
|
||||
|
||||
class GroupPanel extends StatefulWidget {
|
||||
final int? mid;
|
||||
const GroupPanel({super.key, this.mid});
|
||||
@@ -51,7 +53,7 @@ class _GroupPanelState extends State<GroupPanel> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
height: context.height.abs() * 0.7,
|
||||
height: Utils.getSheetHeight(context),
|
||||
color: Theme.of(context).colorScheme.background,
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
|
||||
@@ -18,7 +18,7 @@ class IntroDetail extends StatelessWidget {
|
||||
return Container(
|
||||
color: Theme.of(context).colorScheme.background,
|
||||
padding: const EdgeInsets.only(left: 14, right: 14),
|
||||
height: context.height.abs() * 0.7,
|
||||
height: Utils.getSheetHeight(context),
|
||||
child: Column(
|
||||
children: [
|
||||
InkWell(
|
||||
|
||||
@@ -3,6 +3,8 @@ import 'package:get/get.dart';
|
||||
import 'package:pilipala/models/video_detail_res.dart';
|
||||
import 'package:pilipala/pages/video/detail/index.dart';
|
||||
|
||||
import '../../../../../utils/utils.dart';
|
||||
|
||||
class PagesPanel extends StatefulWidget {
|
||||
const PagesPanel({
|
||||
super.key,
|
||||
@@ -94,7 +96,7 @@ class _PagesPanelState extends State<PagesPanel> {
|
||||
_scrollController.jumpTo(currentIndex * 56);
|
||||
});
|
||||
return Container(
|
||||
height: context.height.abs() * 0.7,
|
||||
height: Utils.getSheetHeight(context),
|
||||
color: Theme.of(context).colorScheme.background,
|
||||
child: Column(
|
||||
children: [
|
||||
|
||||
@@ -5,6 +5,8 @@ import 'package:pilipala/pages/video/detail/index.dart';
|
||||
import 'package:pilipala/utils/id_utils.dart';
|
||||
import 'package:scrollable_positioned_list/scrollable_positioned_list.dart';
|
||||
|
||||
import '../../../../../utils/utils.dart';
|
||||
|
||||
class SeasonPanel extends StatefulWidget {
|
||||
const SeasonPanel({
|
||||
super.key,
|
||||
@@ -102,7 +104,7 @@ class _SeasonPanelState extends State<SeasonPanel> {
|
||||
itemScrollController.jumpTo(index: currentIndex);
|
||||
});
|
||||
return Container(
|
||||
height: context.height.abs() * 0.7,
|
||||
height: Utils.getSheetHeight(context),
|
||||
color: Theme.of(context).colorScheme.background,
|
||||
child: Column(
|
||||
children: [
|
||||
|
||||
@@ -121,7 +121,7 @@ class _VideoReplyPanelState extends State<VideoReplyPanel>
|
||||
void dispose() {
|
||||
scrollController.removeListener(() {});
|
||||
fabAnimationCtr.dispose();
|
||||
scrollController.dispose();
|
||||
// scrollController.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ import 'package:pilipala/models/common/reply_type.dart';
|
||||
import 'package:pilipala/models/video/reply/item.dart';
|
||||
import 'package:pilipala/pages/video/detail/reply/widgets/reply_item.dart';
|
||||
|
||||
import '../../../../utils/utils.dart';
|
||||
import 'controller.dart';
|
||||
|
||||
class VideoReplyReplyPanel extends StatefulWidget {
|
||||
@@ -71,7 +72,7 @@ class _VideoReplyReplyPanelState extends State<VideoReplyReplyPanel> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
height: widget.source == 'videoDetail' ? context.height.abs() * 0.7 : null,
|
||||
height: widget.source == 'videoDetail' ? Utils.getSheetHeight(context) : null,
|
||||
color: Theme.of(context).colorScheme.background,
|
||||
child: Column(
|
||||
children: [
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -20,7 +20,7 @@ class AiDetail extends StatelessWidget {
|
||||
return Container(
|
||||
color: Theme.of(context).colorScheme.background,
|
||||
padding: const EdgeInsets.only(left: 14, right: 14),
|
||||
height: context.height.abs() * 0.7,
|
||||
height: Utils.getSheetHeight(context),
|
||||
child: Column(
|
||||
children: [
|
||||
InkWell(
|
||||
|
||||
@@ -1070,8 +1070,8 @@ class _HeaderControlState extends State<HeaderControl> {
|
||||
<void>{
|
||||
if (MediaQuery.of(context).orientation ==
|
||||
Orientation.landscape &&
|
||||
setting.get(SettingBoxKey.exitFullscreenAutoVertical,
|
||||
defaultValue: true))
|
||||
!setting.get(SettingBoxKey.horizontalScreen,
|
||||
defaultValue: false))
|
||||
{
|
||||
SystemChrome.setPreferredOrientations([
|
||||
DeviceOrientation.portraitUp,
|
||||
|
||||
@@ -1002,7 +1002,7 @@ class PlPlayerController {
|
||||
StatusBarControl.setHidden(false, animation: StatusBarAnimation.FADE);
|
||||
// Get.back();
|
||||
exitFullScreen();
|
||||
if (setting.get(SettingBoxKey.exitFullscreenAutoVertical, defaultValue: true)) {
|
||||
if (!setting.get(SettingBoxKey.horizontalScreen, defaultValue: false)) {
|
||||
await verticalScreen();
|
||||
}
|
||||
toggleFullScreen(false);
|
||||
|
||||
@@ -92,7 +92,7 @@ class SettingBoxKey {
|
||||
enableAutoBrightness = 'enableAutoBrightness',
|
||||
enableAutoEnter = 'enableAutoEnter',
|
||||
enableAutoExit = 'enableAutoExit',
|
||||
exitFullscreenAutoVertical = 'exitFullscreenAutoVertical',
|
||||
horizontalScreen = 'horizontalScreen',
|
||||
p1080 = 'p1080',
|
||||
enableCDN = 'enableCDN',
|
||||
autoPiP = 'autoPiP',
|
||||
|
||||
@@ -9,6 +9,7 @@ import 'package:crypto/crypto.dart';
|
||||
import 'package:device_info_plus/device_info_plus.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:package_info_plus/package_info_plus.dart';
|
||||
import 'package:path_provider/path_provider.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
@@ -327,6 +328,16 @@ class Utils {
|
||||
return '$formattedHours:$formattedMinutes';
|
||||
}
|
||||
|
||||
static double getSheetHeight(BuildContext context) {
|
||||
double height = context.height.abs();
|
||||
double width = context.width.abs();
|
||||
if (height > width) {
|
||||
return height * 0.7;
|
||||
}
|
||||
//横屏状态
|
||||
return height;
|
||||
}
|
||||
|
||||
static String appSign(
|
||||
Map<String, dynamic> params, String appkey, String appsec) {
|
||||
params['appkey'] = appkey;
|
||||
|
||||
Reference in New Issue
Block a user