fix: 播放页横屏适配修复

This commit is contained in:
orz12
2024-02-11 19:45:50 +08:00
parent 2ed7d00483
commit 0d1f73808f
16 changed files with 490 additions and 505 deletions

View File

@@ -3,6 +3,8 @@ import 'package:get/get.dart';
import 'package:pilipala/common/widgets/stat/danmu.dart'; import 'package:pilipala/common/widgets/stat/danmu.dart';
import 'package:pilipala/common/widgets/stat/view.dart'; import 'package:pilipala/common/widgets/stat/view.dart';
import '../../../../utils/utils.dart';
class IntroDetail extends StatelessWidget { class IntroDetail extends StatelessWidget {
final dynamic bangumiDetail; final dynamic bangumiDetail;
@@ -21,7 +23,7 @@ class IntroDetail extends StatelessWidget {
return Container( return Container(
color: Theme.of(context).colorScheme.background, color: Theme.of(context).colorScheme.background,
padding: const EdgeInsets.only(left: 14, right: 14), padding: const EdgeInsets.only(left: 14, right: 14),
height: context.height.abs() * 0.7, height: Utils.getSheetHeight(context),
child: Column( child: Column(
children: [ children: [
Container( Container(

View File

@@ -7,6 +7,8 @@ import 'package:pilipala/pages/video/detail/index.dart';
import 'package:pilipala/utils/storage.dart'; import 'package:pilipala/utils/storage.dart';
import 'package:scrollable_positioned_list/scrollable_positioned_list.dart'; import 'package:scrollable_positioned_list/scrollable_positioned_list.dart';
import '../../../utils/utils.dart';
class BangumiPanel extends StatefulWidget { class BangumiPanel extends StatefulWidget {
const BangumiPanel({ const BangumiPanel({
super.key, super.key,
@@ -78,7 +80,7 @@ class _BangumiPanelState extends State<BangumiPanel> {
}); });
// 在这里使用 setState 更新状态 // 在这里使用 setState 更新状态
return Container( return Container(
height: context.height.abs() * 0.7, height: Utils.getSheetHeight(context),
color: Theme.of(context).colorScheme.background, color: Theme.of(context).colorScheme.background,
child: Column( child: Column(
children: [ children: [

View File

@@ -117,10 +117,10 @@ class _PlaySettingState extends State<PlaySetting> {
defaultVal: false, defaultVal: false,
), ),
const SetSwitchItem( const SetSwitchItem(
title: '恢复竖屏', title: '横屏适配(测试)',
subTitle: '退出全屏视频时自动恢复竖屏,关闭可以保持横屏状态', subTitle: '开启该项在播放页启用横屏布局与逻辑',
setKey: SettingBoxKey.exitFullscreenAutoVertical, setKey: SettingBoxKey.horizontalScreen,
defaultVal: true, defaultVal: false,
), ),
const SetSwitchItem( const SetSwitchItem(
title: '开启硬解', title: '开启硬解',

View File

@@ -3,6 +3,8 @@ import 'package:get/get.dart';
import 'package:pilipala/common/widgets/http_error.dart'; import 'package:pilipala/common/widgets/http_error.dart';
import 'package:pilipala/utils/feed_back.dart'; import 'package:pilipala/utils/feed_back.dart';
import '../../../../../utils/utils.dart';
class FavPanel extends StatefulWidget { class FavPanel extends StatefulWidget {
const FavPanel({super.key, this.ctr}); const FavPanel({super.key, this.ctr});
final dynamic ctr; final dynamic ctr;
@@ -23,7 +25,7 @@ class _FavPanelState extends State<FavPanel> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Container( return Container(
height: context.height.abs() * 0.7, height: Utils.getSheetHeight(context),
color: Theme.of(context).colorScheme.background, color: Theme.of(context).colorScheme.background,
child: Column( child: Column(
children: [ children: [

View File

@@ -6,6 +6,8 @@ import 'package:pilipala/http/member.dart';
import 'package:pilipala/models/member/tags.dart'; import 'package:pilipala/models/member/tags.dart';
import 'package:pilipala/utils/feed_back.dart'; import 'package:pilipala/utils/feed_back.dart';
import '../../../../../utils/utils.dart';
class GroupPanel extends StatefulWidget { class GroupPanel extends StatefulWidget {
final int? mid; final int? mid;
const GroupPanel({super.key, this.mid}); const GroupPanel({super.key, this.mid});
@@ -51,7 +53,7 @@ class _GroupPanelState extends State<GroupPanel> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Container( return Container(
height: context.height.abs() * 0.7, height: Utils.getSheetHeight(context),
color: Theme.of(context).colorScheme.background, color: Theme.of(context).colorScheme.background,
child: Column( child: Column(
children: <Widget>[ children: <Widget>[

View File

@@ -18,7 +18,7 @@ class IntroDetail extends StatelessWidget {
return Container( return Container(
color: Theme.of(context).colorScheme.background, color: Theme.of(context).colorScheme.background,
padding: const EdgeInsets.only(left: 14, right: 14), padding: const EdgeInsets.only(left: 14, right: 14),
height: context.height.abs() * 0.7, height: Utils.getSheetHeight(context),
child: Column( child: Column(
children: [ children: [
InkWell( InkWell(

View File

@@ -3,6 +3,8 @@ import 'package:get/get.dart';
import 'package:pilipala/models/video_detail_res.dart'; import 'package:pilipala/models/video_detail_res.dart';
import 'package:pilipala/pages/video/detail/index.dart'; import 'package:pilipala/pages/video/detail/index.dart';
import '../../../../../utils/utils.dart';
class PagesPanel extends StatefulWidget { class PagesPanel extends StatefulWidget {
const PagesPanel({ const PagesPanel({
super.key, super.key,
@@ -94,7 +96,7 @@ class _PagesPanelState extends State<PagesPanel> {
_scrollController.jumpTo(currentIndex * 56); _scrollController.jumpTo(currentIndex * 56);
}); });
return Container( return Container(
height: context.height.abs() * 0.7, height: Utils.getSheetHeight(context),
color: Theme.of(context).colorScheme.background, color: Theme.of(context).colorScheme.background,
child: Column( child: Column(
children: [ children: [

View File

@@ -5,6 +5,8 @@ import 'package:pilipala/pages/video/detail/index.dart';
import 'package:pilipala/utils/id_utils.dart'; import 'package:pilipala/utils/id_utils.dart';
import 'package:scrollable_positioned_list/scrollable_positioned_list.dart'; import 'package:scrollable_positioned_list/scrollable_positioned_list.dart';
import '../../../../../utils/utils.dart';
class SeasonPanel extends StatefulWidget { class SeasonPanel extends StatefulWidget {
const SeasonPanel({ const SeasonPanel({
super.key, super.key,
@@ -102,7 +104,7 @@ class _SeasonPanelState extends State<SeasonPanel> {
itemScrollController.jumpTo(index: currentIndex); itemScrollController.jumpTo(index: currentIndex);
}); });
return Container( return Container(
height: context.height.abs() * 0.7, height: Utils.getSheetHeight(context),
color: Theme.of(context).colorScheme.background, color: Theme.of(context).colorScheme.background,
child: Column( child: Column(
children: [ children: [

View File

@@ -121,7 +121,7 @@ class _VideoReplyPanelState extends State<VideoReplyPanel>
void dispose() { void dispose() {
scrollController.removeListener(() {}); scrollController.removeListener(() {});
fabAnimationCtr.dispose(); fabAnimationCtr.dispose();
scrollController.dispose(); // scrollController.dispose();
super.dispose(); super.dispose();
} }

View File

@@ -7,6 +7,7 @@ import 'package:pilipala/models/common/reply_type.dart';
import 'package:pilipala/models/video/reply/item.dart'; import 'package:pilipala/models/video/reply/item.dart';
import 'package:pilipala/pages/video/detail/reply/widgets/reply_item.dart'; import 'package:pilipala/pages/video/detail/reply/widgets/reply_item.dart';
import '../../../../utils/utils.dart';
import 'controller.dart'; import 'controller.dart';
class VideoReplyReplyPanel extends StatefulWidget { class VideoReplyReplyPanel extends StatefulWidget {
@@ -71,7 +72,7 @@ class _VideoReplyReplyPanelState extends State<VideoReplyReplyPanel> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Container( 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, color: Theme.of(context).colorScheme.background,
child: Column( child: Column(
children: [ children: [

File diff suppressed because it is too large Load Diff

View File

@@ -20,7 +20,7 @@ class AiDetail extends StatelessWidget {
return Container( return Container(
color: Theme.of(context).colorScheme.background, color: Theme.of(context).colorScheme.background,
padding: const EdgeInsets.only(left: 14, right: 14), padding: const EdgeInsets.only(left: 14, right: 14),
height: context.height.abs() * 0.7, height: Utils.getSheetHeight(context),
child: Column( child: Column(
children: [ children: [
InkWell( InkWell(

View File

@@ -1070,8 +1070,8 @@ class _HeaderControlState extends State<HeaderControl> {
<void>{ <void>{
if (MediaQuery.of(context).orientation == if (MediaQuery.of(context).orientation ==
Orientation.landscape && Orientation.landscape &&
setting.get(SettingBoxKey.exitFullscreenAutoVertical, !setting.get(SettingBoxKey.horizontalScreen,
defaultValue: true)) defaultValue: false))
{ {
SystemChrome.setPreferredOrientations([ SystemChrome.setPreferredOrientations([
DeviceOrientation.portraitUp, DeviceOrientation.portraitUp,

View File

@@ -1002,7 +1002,7 @@ class PlPlayerController {
StatusBarControl.setHidden(false, animation: StatusBarAnimation.FADE); StatusBarControl.setHidden(false, animation: StatusBarAnimation.FADE);
// Get.back(); // Get.back();
exitFullScreen(); exitFullScreen();
if (setting.get(SettingBoxKey.exitFullscreenAutoVertical, defaultValue: true)) { if (!setting.get(SettingBoxKey.horizontalScreen, defaultValue: false)) {
await verticalScreen(); await verticalScreen();
} }
toggleFullScreen(false); toggleFullScreen(false);

View File

@@ -92,7 +92,7 @@ class SettingBoxKey {
enableAutoBrightness = 'enableAutoBrightness', enableAutoBrightness = 'enableAutoBrightness',
enableAutoEnter = 'enableAutoEnter', enableAutoEnter = 'enableAutoEnter',
enableAutoExit = 'enableAutoExit', enableAutoExit = 'enableAutoExit',
exitFullscreenAutoVertical = 'exitFullscreenAutoVertical', horizontalScreen = 'horizontalScreen',
p1080 = 'p1080', p1080 = 'p1080',
enableCDN = 'enableCDN', enableCDN = 'enableCDN',
autoPiP = 'autoPiP', autoPiP = 'autoPiP',

View File

@@ -9,6 +9,7 @@ import 'package:crypto/crypto.dart';
import 'package:device_info_plus/device_info_plus.dart'; import 'package:device_info_plus/device_info_plus.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.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:package_info_plus/package_info_plus.dart';
import 'package:path_provider/path_provider.dart'; import 'package:path_provider/path_provider.dart';
import 'package:url_launcher/url_launcher.dart'; import 'package:url_launcher/url_launcher.dart';
@@ -327,6 +328,16 @@ class Utils {
return '$formattedHours:$formattedMinutes'; 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( static String appSign(
Map<String, dynamic> params, String appkey, String appsec) { Map<String, dynamic> params, String appkey, String appsec) {
params['appkey'] = appkey; params['appkey'] = appkey;