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/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(
|
||||||
|
|||||||
@@ -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: [
|
||||||
|
|||||||
@@ -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: '开启硬解',
|
||||||
|
|||||||
@@ -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: [
|
||||||
|
|||||||
@@ -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>[
|
||||||
|
|||||||
@@ -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(
|
||||||
|
|||||||
@@ -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: [
|
||||||
|
|||||||
@@ -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: [
|
||||||
|
|||||||
@@ -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();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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: [
|
||||||
|
|||||||
@@ -57,13 +57,13 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
|||||||
// 自动退出全屏
|
// 自动退出全屏
|
||||||
late bool autoExitFullcreen;
|
late bool autoExitFullcreen;
|
||||||
late bool autoPlayEnable;
|
late bool autoPlayEnable;
|
||||||
late bool exitFullscreenAutoVertical;
|
late bool horizontalScreen;
|
||||||
late bool autoPiP;
|
late bool autoPiP;
|
||||||
final Floating floating = Floating();
|
final Floating floating = Floating();
|
||||||
// 生命周期监听
|
// 生命周期监听
|
||||||
late final AppLifecycleListener _lifecycleListener;
|
late final AppLifecycleListener _lifecycleListener;
|
||||||
bool isShowing = true;
|
bool isShowing = true;
|
||||||
bool isFullScreen = false;
|
RxBool isFullScreen = false.obs;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
@@ -87,8 +87,8 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
|||||||
statusBarHeight = localCache.get('statusBarHeight');
|
statusBarHeight = localCache.get('statusBarHeight');
|
||||||
autoExitFullcreen =
|
autoExitFullcreen =
|
||||||
setting.get(SettingBoxKey.enableAutoExit, defaultValue: false);
|
setting.get(SettingBoxKey.enableAutoExit, defaultValue: false);
|
||||||
exitFullscreenAutoVertical = setting
|
horizontalScreen =
|
||||||
.get(SettingBoxKey.exitFullscreenAutoVertical, defaultValue: true);
|
setting.get(SettingBoxKey.horizontalScreen, defaultValue: false);
|
||||||
autoPlayEnable =
|
autoPlayEnable =
|
||||||
setting.get(SettingBoxKey.autoPlayEnable, defaultValue: true);
|
setting.get(SettingBoxKey.autoPlayEnable, defaultValue: true);
|
||||||
autoPiP = setting.get(SettingBoxKey.autoPiP, defaultValue: false);
|
autoPiP = setting.get(SettingBoxKey.autoPiP, defaultValue: false);
|
||||||
@@ -286,22 +286,19 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
|||||||
}
|
}
|
||||||
|
|
||||||
void triggerFullScreenCallback({bool? status}) {
|
void triggerFullScreenCallback({bool? status}) {
|
||||||
SmartDialog.showToast('triggerFullScreen $status $isFullScreen');
|
// SmartDialog.showToast('triggerFullScreen $status $isFullScreen.value');
|
||||||
setState(() {
|
setState(() {
|
||||||
isFullScreen = status ?? !isFullScreen;
|
isFullScreen.value = status ?? !isFullScreen.value;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final double videoHeight = MediaQuery.sizeOf(context).width * 9 / 16;
|
|
||||||
final double pinnedHeaderHeight =
|
|
||||||
statusBarHeight + kToolbarHeight + videoHeight;
|
|
||||||
Widget childWhenDisabled = SafeArea(
|
Widget childWhenDisabled = SafeArea(
|
||||||
top: MediaQuery.of(context).orientation == Orientation.portrait &&
|
top: MediaQuery.of(context).orientation == Orientation.portrait &&
|
||||||
isFullScreen == true,
|
isFullScreen.value == true,
|
||||||
bottom: MediaQuery.of(context).orientation == Orientation.portrait &&
|
bottom: MediaQuery.of(context).orientation == Orientation.portrait &&
|
||||||
isFullScreen == true,
|
isFullScreen.value == true,
|
||||||
left: false, //isFullScreen != true,
|
left: false, //isFullScreen != true,
|
||||||
right: false, //isFullScreen != true,
|
right: false, //isFullScreen != true,
|
||||||
child: Stack(
|
child: Stack(
|
||||||
@@ -317,61 +314,44 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
|||||||
elevation: 0,
|
elevation: 0,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
body: ExtendedNestedScrollView(
|
body: Column(
|
||||||
controller: _extendNestCtr,
|
children: [
|
||||||
headerSliverBuilder:
|
|
||||||
(BuildContext context2, bool innerBoxIsScrolled) {
|
|
||||||
return <Widget>[
|
|
||||||
Obx(
|
Obx(
|
||||||
() {
|
() {
|
||||||
if (MediaQuery.of(context).orientation ==
|
if (MediaQuery.of(context).orientation ==
|
||||||
Orientation.landscape ||
|
Orientation.landscape ||
|
||||||
isFullScreen == true) {
|
isFullScreen.value == true) {
|
||||||
enterFullScreen();
|
enterFullScreen();
|
||||||
} else {
|
} else {
|
||||||
exitFullScreen();
|
exitFullScreen();
|
||||||
}
|
}
|
||||||
return SliverAppBar(
|
final double videoheight = Get.width * 9 / 16;
|
||||||
automaticallyImplyLeading: false,
|
final double videowidth = Get.width;
|
||||||
// 假装使用一个非空变量,避免Obx检测不到而罢工
|
return SizedBox(
|
||||||
pinned: videoDetailController.autoPlay.value ^
|
height: MediaQuery.of(context).orientation ==
|
||||||
false ^
|
|
||||||
videoDetailController.autoPlay.value,
|
|
||||||
elevation: 0,
|
|
||||||
scrolledUnderElevation: 0,
|
|
||||||
forceElevated: innerBoxIsScrolled,
|
|
||||||
expandedHeight: MediaQuery.of(context).orientation ==
|
|
||||||
Orientation.landscape ||
|
Orientation.landscape ||
|
||||||
isFullScreen == true
|
isFullScreen.value == true
|
||||||
? MediaQuery.sizeOf(context).height -
|
? MediaQuery.sizeOf(context).height -
|
||||||
(MediaQuery.of(context).orientation ==
|
(MediaQuery.of(context).orientation ==
|
||||||
Orientation.landscape
|
Orientation.landscape
|
||||||
? 0
|
? 0
|
||||||
: MediaQuery.of(context).padding.top)
|
: MediaQuery.of(context).padding.top)
|
||||||
: videoHeight,
|
: videoheight,
|
||||||
backgroundColor: Colors.black,
|
width: MediaQuery.of(context).size.width,
|
||||||
flexibleSpace: FlexibleSpaceBar(
|
child: PopScope(
|
||||||
background: PopScope(
|
canPop: isFullScreen.value != true,
|
||||||
canPop: isFullScreen != true,
|
|
||||||
onPopInvoked: (bool didPop) {
|
onPopInvoked: (bool didPop) {
|
||||||
if (isFullScreen == true) {
|
if (isFullScreen.value == true) {
|
||||||
plPlayerController!
|
plPlayerController!
|
||||||
.triggerFullScreen(status: false);
|
.triggerFullScreen(status: false);
|
||||||
}
|
}
|
||||||
if (MediaQuery.of(context).orientation ==
|
if (MediaQuery.of(context).orientation ==
|
||||||
Orientation.landscape &&
|
Orientation.landscape &&
|
||||||
exitFullscreenAutoVertical) {
|
!horizontalScreen) {
|
||||||
verticalScreen();
|
verticalScreen();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
child: LayoutBuilder(
|
child: Stack(
|
||||||
builder: (BuildContext context,
|
|
||||||
BoxConstraints boxConstraints) {
|
|
||||||
final double maxWidth =
|
|
||||||
boxConstraints.maxWidth;
|
|
||||||
final double maxHeight =
|
|
||||||
boxConstraints.maxHeight;
|
|
||||||
return Stack(
|
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
if (isShowing)
|
if (isShowing)
|
||||||
FutureBuilder(
|
FutureBuilder(
|
||||||
@@ -381,9 +361,13 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
|||||||
if (snapshot.hasData &&
|
if (snapshot.hasData &&
|
||||||
snapshot.data['status']) {
|
snapshot.data['status']) {
|
||||||
return Obx(
|
return Obx(
|
||||||
() =>
|
() => !videoDetailController
|
||||||
!videoDetailController
|
.autoPlay.value ||
|
||||||
.autoPlay.value
|
plPlayerController ==
|
||||||
|
null ||
|
||||||
|
plPlayerController!
|
||||||
|
.videoController ==
|
||||||
|
null
|
||||||
? nil
|
? nil
|
||||||
: PLVideoPlayer(
|
: PLVideoPlayer(
|
||||||
controller:
|
controller:
|
||||||
@@ -393,11 +377,13 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
|||||||
.headerControl,
|
.headerControl,
|
||||||
danmuWidget: Obx(
|
danmuWidget: Obx(
|
||||||
() => PlDanmaku(
|
() => PlDanmaku(
|
||||||
key: Key(videoDetailController
|
key: Key(
|
||||||
|
videoDetailController
|
||||||
.danmakuCid
|
.danmakuCid
|
||||||
.value
|
.value
|
||||||
.toString()),
|
.toString()),
|
||||||
cid: videoDetailController
|
cid:
|
||||||
|
videoDetailController
|
||||||
.danmakuCid
|
.danmakuCid
|
||||||
.value,
|
.value,
|
||||||
playerController:
|
playerController:
|
||||||
@@ -409,8 +395,7 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
|||||||
} else {
|
} else {
|
||||||
return const SizedBox();
|
return const SizedBox();
|
||||||
}
|
}
|
||||||
},
|
}),
|
||||||
),
|
|
||||||
|
|
||||||
/// 关闭自动播放时 手动播放
|
/// 关闭自动播放时 手动播放
|
||||||
if (!videoDetailController
|
if (!videoDetailController
|
||||||
@@ -431,8 +416,8 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
|||||||
type: 'emote',
|
type: 'emote',
|
||||||
src: videoDetailController
|
src: videoDetailController
|
||||||
.videoItem['pic'],
|
.videoItem['pic'],
|
||||||
width: maxWidth,
|
width: videowidth,
|
||||||
height: maxHeight,
|
height: videoheight,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -452,8 +437,7 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
|||||||
right: 0,
|
right: 0,
|
||||||
child: AppBar(
|
child: AppBar(
|
||||||
primary: false,
|
primary: false,
|
||||||
foregroundColor:
|
foregroundColor: Colors.white,
|
||||||
Colors.white,
|
|
||||||
elevation: 0,
|
elevation: 0,
|
||||||
scrolledUnderElevation: 0,
|
scrolledUnderElevation: 0,
|
||||||
backgroundColor:
|
backgroundColor:
|
||||||
@@ -464,17 +448,16 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
|||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
var res = await UserHttp
|
var res = await UserHttp
|
||||||
.toViewLater(
|
.toViewLater(
|
||||||
bvid: videoDetailController
|
bvid:
|
||||||
|
videoDetailController
|
||||||
.bvid);
|
.bvid);
|
||||||
SmartDialog
|
SmartDialog.showToast(
|
||||||
.showToast(
|
|
||||||
res['msg']);
|
res['msg']);
|
||||||
},
|
},
|
||||||
icon: const Icon(Icons
|
icon: const Icon(
|
||||||
.history_outlined),
|
Icons.history_outlined),
|
||||||
),
|
),
|
||||||
const SizedBox(
|
const SizedBox(width: 14)
|
||||||
width: 14)
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -483,8 +466,7 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
|||||||
bottom: 10,
|
bottom: 10,
|
||||||
child: IconButton(
|
child: IconButton(
|
||||||
tooltip: '播放',
|
tooltip: '播放',
|
||||||
onPressed: () =>
|
onPressed: () => handlePlay(),
|
||||||
handlePlay(),
|
|
||||||
icon: Image.asset(
|
icon: Image.asset(
|
||||||
'assets/images/play.png',
|
'assets/images/play.png',
|
||||||
width: 60,
|
width: 60,
|
||||||
@@ -496,33 +478,21 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
|||||||
),
|
),
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
);
|
|
||||||
},
|
|
||||||
)),
|
)),
|
||||||
),
|
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
];
|
SizedBox(
|
||||||
},
|
height: MediaQuery.of(context).orientation ==
|
||||||
// pinnedHeaderSliverHeightBuilder: () {
|
|
||||||
// return playerStatus != PlayerStatus.playing
|
|
||||||
// ? statusBarHeight + kToolbarHeight
|
|
||||||
// : pinnedHeaderHeight;
|
|
||||||
// },
|
|
||||||
/// 不收回
|
|
||||||
pinnedHeaderSliverHeightBuilder: () {
|
|
||||||
if (playerStatus != PlayerStatus.playing) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
return MediaQuery.of(context).orientation ==
|
|
||||||
Orientation.landscape ||
|
Orientation.landscape ||
|
||||||
isFullScreen == true
|
isFullScreen.value == true
|
||||||
? MediaQuery.sizeOf(context).height
|
? 0
|
||||||
: pinnedHeaderHeight;
|
: Get.height -
|
||||||
},
|
Get.width * 9 / 16 -
|
||||||
onlyOneScrollInBody: true,
|
MediaQuery.of(context).padding.top -
|
||||||
body: ColoredBox(
|
MediaQuery.of(context).padding.bottom,
|
||||||
|
width: MediaQuery.of(context).size.width,
|
||||||
|
child: ColoredBox(
|
||||||
key: Key(heroTag),
|
key: Key(heroTag),
|
||||||
color: Theme.of(context).colorScheme.background,
|
color: Theme.of(context).colorScheme.background,
|
||||||
child: Column(
|
child: Column(
|
||||||
@@ -557,23 +527,13 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
|||||||
if (videoDetailController.videoType ==
|
if (videoDetailController.videoType ==
|
||||||
SearchType.video) ...[
|
SearchType.video) ...[
|
||||||
const VideoIntroPanel(),
|
const VideoIntroPanel(),
|
||||||
] else if (videoDetailController.videoType ==
|
] else if (videoDetailController
|
||||||
|
.videoType ==
|
||||||
SearchType.media_bangumi) ...[
|
SearchType.media_bangumi) ...[
|
||||||
Obx(() => BangumiIntroPanel(
|
Obx(() => BangumiIntroPanel(
|
||||||
cid: videoDetailController.cid.value)),
|
cid: videoDetailController
|
||||||
|
.cid.value)),
|
||||||
],
|
],
|
||||||
// if (videoDetailController.videoType ==
|
|
||||||
// SearchType.video) ...[
|
|
||||||
// SliverPersistentHeader(
|
|
||||||
// floating: true,
|
|
||||||
// pinned: true,
|
|
||||||
// delegate: SliverHeaderDelegate(
|
|
||||||
// height: 50,
|
|
||||||
// child:
|
|
||||||
// const MenuRow(loadingStatus: false),
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// ],
|
|
||||||
SliverToBoxAdapter(
|
SliverToBoxAdapter(
|
||||||
child: Divider(
|
child: Divider(
|
||||||
indent: 12,
|
indent: 12,
|
||||||
@@ -598,29 +558,15 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
],
|
||||||
|
)),
|
||||||
/// 重新进入会刷新
|
|
||||||
// 播放完成/暂停播放
|
|
||||||
// StreamBuilder(
|
|
||||||
// stream: appbarStream.stream,
|
|
||||||
// initialData: 0,
|
|
||||||
// builder: ((context, snapshot) {
|
|
||||||
// return ScrollAppBar(
|
|
||||||
// snapshot.data!.toDouble(),
|
|
||||||
// () => continuePlay(),
|
|
||||||
// playerStatus,
|
|
||||||
// null,
|
|
||||||
// );
|
|
||||||
// }),
|
|
||||||
// )
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
Widget childWhenDisabledLandscape = SafeArea(
|
Widget childWhenDisabledLandscape = SafeArea(
|
||||||
left: isFullScreen != true,
|
left: isFullScreen.value != true,
|
||||||
right: isFullScreen != true,
|
right: isFullScreen.value != true,
|
||||||
child: Stack(children: [
|
child: Stack(children: [
|
||||||
Scaffold(
|
Scaffold(
|
||||||
resizeToAvoidBottomInset: false,
|
resizeToAvoidBottomInset: false,
|
||||||
@@ -633,45 +579,49 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
|||||||
elevation: 0,
|
elevation: 0,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
body: Row(
|
body: Obx(() {
|
||||||
|
final double videoheight = Get.height * 0.32 + Get.width * 0.13;
|
||||||
|
final double videowidth = videoheight * 16 / 9;
|
||||||
|
return Row(
|
||||||
children: [
|
children: [
|
||||||
Column(
|
Column(
|
||||||
children: [
|
children: [
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: isFullScreen == true
|
width: isFullScreen.value == true
|
||||||
? Get.width
|
? Get.width
|
||||||
: Get.height * 0.6 * 16 / 9,
|
: videowidth,
|
||||||
height: isFullScreen == true
|
height: isFullScreen.value == true
|
||||||
? Get.height
|
? Get.height
|
||||||
: Get.height * 0.6,
|
: videoheight,
|
||||||
child: PopScope(
|
child: PopScope(
|
||||||
canPop: isFullScreen != true,
|
canPop: isFullScreen.value != true,
|
||||||
onPopInvoked: (bool didPop) {
|
onPopInvoked: (bool didPop) {
|
||||||
if (isFullScreen == true) {
|
if (isFullScreen.value == true) {
|
||||||
plPlayerController!
|
plPlayerController!
|
||||||
.triggerFullScreen(status: false);
|
.triggerFullScreen(status: false);
|
||||||
}
|
}
|
||||||
if (MediaQuery.of(context).orientation ==
|
if (MediaQuery.of(context).orientation ==
|
||||||
Orientation.landscape &&
|
Orientation.landscape &&
|
||||||
exitFullscreenAutoVertical) {
|
!horizontalScreen) {
|
||||||
verticalScreen();
|
verticalScreen();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
child: LayoutBuilder(
|
child: Stack(
|
||||||
builder: (BuildContext context,
|
|
||||||
BoxConstraints boxConstraints) {
|
|
||||||
final double maxWidth =
|
|
||||||
boxConstraints.maxWidth / 2;
|
|
||||||
final double maxHeight =
|
|
||||||
boxConstraints.maxHeight / 2;
|
|
||||||
return Stack(
|
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
if (isShowing)
|
if (isShowing)
|
||||||
Obx(
|
FutureBuilder(
|
||||||
|
future: _futureBuilderFuture,
|
||||||
|
builder: (BuildContext context,
|
||||||
|
AsyncSnapshot snapshot) {
|
||||||
|
if (snapshot.hasData &&
|
||||||
|
snapshot.data['status']) {
|
||||||
|
return Obx(
|
||||||
() => !videoDetailController
|
() => !videoDetailController
|
||||||
.autoPlay.value ||
|
.autoPlay.value ||
|
||||||
plPlayerController
|
plPlayerController ==
|
||||||
?.videoController ==
|
null ||
|
||||||
|
plPlayerController!
|
||||||
|
.videoController ==
|
||||||
null
|
null
|
||||||
? nil
|
? nil
|
||||||
: PLVideoPlayer(
|
: PLVideoPlayer(
|
||||||
@@ -684,16 +634,23 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
|||||||
() => PlDanmaku(
|
() => PlDanmaku(
|
||||||
key: Key(
|
key: Key(
|
||||||
videoDetailController
|
videoDetailController
|
||||||
.danmakuCid.value
|
.danmakuCid
|
||||||
|
.value
|
||||||
.toString()),
|
.toString()),
|
||||||
cid: videoDetailController
|
cid:
|
||||||
.danmakuCid.value,
|
videoDetailController
|
||||||
|
.danmakuCid
|
||||||
|
.value,
|
||||||
playerController:
|
playerController:
|
||||||
plPlayerController!,
|
plPlayerController!,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
);
|
||||||
|
} else {
|
||||||
|
return const SizedBox();
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
|
||||||
/// 关闭自动播放时 手动播放
|
/// 关闭自动播放时 手动播放
|
||||||
if (!videoDetailController
|
if (!videoDetailController
|
||||||
@@ -714,8 +671,8 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
|||||||
type: 'emote',
|
type: 'emote',
|
||||||
src: videoDetailController
|
src: videoDetailController
|
||||||
.videoItem['pic'],
|
.videoItem['pic'],
|
||||||
width: maxWidth,
|
width: videowidth,
|
||||||
height: maxHeight,
|
height: videoheight,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -747,17 +704,16 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
|||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
var res = await UserHttp
|
var res = await UserHttp
|
||||||
.toViewLater(
|
.toViewLater(
|
||||||
bvid: videoDetailController
|
bvid:
|
||||||
|
videoDetailController
|
||||||
.bvid);
|
.bvid);
|
||||||
SmartDialog
|
SmartDialog.showToast(
|
||||||
.showToast(
|
|
||||||
res['msg']);
|
res['msg']);
|
||||||
},
|
},
|
||||||
icon: const Icon(Icons
|
icon: const Icon(Icons
|
||||||
.history_outlined),
|
.history_outlined),
|
||||||
),
|
),
|
||||||
const SizedBox(
|
const SizedBox(width: 14)
|
||||||
width: 14)
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -779,14 +735,14 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
|||||||
),
|
),
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
);
|
|
||||||
},
|
|
||||||
))),
|
))),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: isFullScreen == true
|
width: isFullScreen.value == true
|
||||||
? Get.width
|
? Get.width
|
||||||
: Get.height * 0.6 * 16 / 9,
|
: videowidth,
|
||||||
height: isFullScreen == true ? 0 : Get.height * 0.4,
|
height: isFullScreen.value == true
|
||||||
|
? 0
|
||||||
|
: Get.height - videoheight,
|
||||||
child: (videoDetailController.videoType ==
|
child: (videoDetailController.videoType ==
|
||||||
SearchType.video)
|
SearchType.video)
|
||||||
? const CustomScrollView(
|
? const CustomScrollView(
|
||||||
@@ -800,12 +756,12 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: isFullScreen == true
|
width: isFullScreen.value == true
|
||||||
? 0
|
? 0
|
||||||
: (Get.width -
|
: (Get.width -
|
||||||
MediaQuery.of(context).padding.left -
|
MediaQuery.of(context).padding.left -
|
||||||
MediaQuery.of(context).padding.right -
|
MediaQuery.of(context).padding.right -
|
||||||
Get.height * 0.6 * 16 / 9),
|
videowidth),
|
||||||
height: Get.height,
|
height: Get.height,
|
||||||
child: TabBarView(
|
child: TabBarView(
|
||||||
controller: videoDetailController.tabCtr,
|
controller: videoDetailController.tabCtr,
|
||||||
@@ -822,7 +778,8 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
|||||||
),
|
),
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
))
|
);
|
||||||
|
}))
|
||||||
]));
|
]));
|
||||||
Widget childWhenEnabled = FutureBuilder(
|
Widget childWhenEnabled = FutureBuilder(
|
||||||
key: Key(heroTag),
|
key: Key(heroTag),
|
||||||
@@ -855,23 +812,27 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
|||||||
);
|
);
|
||||||
return OrientationBuilder(
|
return OrientationBuilder(
|
||||||
builder: (BuildContext context, Orientation orientation) {
|
builder: (BuildContext context, Orientation orientation) {
|
||||||
print("orientation:$orientation");
|
if (orientation == Orientation.landscape) {
|
||||||
if (orientation == Orientation.portrait || isFullScreen == true) {
|
|
||||||
// 竖屏
|
|
||||||
return childWhenDisabled;
|
|
||||||
} else {
|
|
||||||
enterFullScreen();
|
enterFullScreen();
|
||||||
return childWhenDisabledLandscape;
|
|
||||||
}
|
}
|
||||||
|
if (Platform.isAndroid) {
|
||||||
|
return PiPSwitcher(
|
||||||
|
childWhenDisabled: Container(
|
||||||
|
key: UniqueKey(),
|
||||||
|
child: !horizontalScreen || orientation == Orientation.portrait
|
||||||
|
? childWhenDisabled
|
||||||
|
: childWhenDisabledLandscape,
|
||||||
|
),
|
||||||
|
childWhenEnabled: childWhenEnabled,
|
||||||
|
floating: floating,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return Container(
|
||||||
|
key: UniqueKey(),
|
||||||
|
child: !horizontalScreen || orientation == Orientation.portrait
|
||||||
|
? childWhenDisabled
|
||||||
|
: childWhenDisabledLandscape,
|
||||||
|
);
|
||||||
});
|
});
|
||||||
// if (Platform.isAndroid) {
|
|
||||||
// return PiPSwitcher(
|
|
||||||
// childWhenDisabled: childWhenDisabled,
|
|
||||||
// childWhenEnabled: childWhenEnabled,
|
|
||||||
// floating: floating,
|
|
||||||
// );
|
|
||||||
// } else {
|
|
||||||
// return childWhenDisabled;
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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(
|
||||||
|
|||||||
@@ -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,
|
||||||
|
|||||||
@@ -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);
|
||||||
|
|||||||
@@ -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',
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|||||||
Reference in New Issue
Block a user