mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-05-31 16:18:22 +08:00
opt: video page
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -7,7 +7,6 @@ import 'package:PiliPalaX/models/bangumi/info.dart' as bangumi;
|
|||||||
import 'package:PiliPalaX/models/video_detail_res.dart' as video;
|
import 'package:PiliPalaX/models/video_detail_res.dart' as video;
|
||||||
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:material_design_icons_flutter/material_design_icons_flutter.dart';
|
import 'package:material_design_icons_flutter/material_design_icons_flutter.dart';
|
||||||
import 'package:scrollable_positioned_list/scrollable_positioned_list.dart';
|
import 'package:scrollable_positioned_list/scrollable_positioned_list.dart';
|
||||||
|
|
||||||
@@ -24,6 +23,7 @@ class ListSheetContent extends StatefulWidget {
|
|||||||
this.aid,
|
this.aid,
|
||||||
required this.currentCid,
|
required this.currentCid,
|
||||||
required this.changeFucCall,
|
required this.changeFucCall,
|
||||||
|
required this.onClose,
|
||||||
});
|
});
|
||||||
|
|
||||||
final dynamic index;
|
final dynamic index;
|
||||||
@@ -33,6 +33,7 @@ class ListSheetContent extends StatefulWidget {
|
|||||||
final int? aid;
|
final int? aid;
|
||||||
final int currentCid;
|
final int currentCid;
|
||||||
final Function changeFucCall;
|
final Function changeFucCall;
|
||||||
|
final VoidCallback onClose;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<ListSheetContent> createState() => _ListSheetContentState();
|
State<ListSheetContent> createState() => _ListSheetContentState();
|
||||||
@@ -136,7 +137,7 @@ class _ListSheetContentState extends State<ListSheetContent>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
SmartDialog.showToast('切换到:$title');
|
SmartDialog.showToast('切换到:$title');
|
||||||
Get.back();
|
widget.onClose();
|
||||||
widget.changeFucCall(
|
widget.changeFucCall(
|
||||||
episode is bangumi.EpisodeItem ? episode.epId : null,
|
episode is bangumi.EpisodeItem ? episode.epId : null,
|
||||||
episode.runtimeType.toString() == "EpisodeItem"
|
episode.runtimeType.toString() == "EpisodeItem"
|
||||||
@@ -326,7 +327,7 @@ class _ListSheetContentState extends State<ListSheetContent>
|
|||||||
_mediumButton(
|
_mediumButton(
|
||||||
tooltip: '关闭',
|
tooltip: '关闭',
|
||||||
icon: Icons.close,
|
icon: Icons.close,
|
||||||
onPressed: Get.back,
|
onPressed: widget.onClose,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -214,6 +214,8 @@ class VideoDetailController extends GetxController
|
|||||||
PlayerStatus? playerStatus;
|
PlayerStatus? playerStatus;
|
||||||
StreamSubscription<Duration>? positionSubscription;
|
StreamSubscription<Duration>? positionSubscription;
|
||||||
|
|
||||||
|
PersistentBottomSheetController? bsController;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void onInit() {
|
void onInit() {
|
||||||
super.onInit();
|
super.onInit();
|
||||||
@@ -1043,15 +1045,17 @@ class VideoDetailController extends GetxController
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
plPlayerController.isFullScreen.value
|
if (plPlayerController.isFullScreen.value) {
|
||||||
? scaffoldKey.currentState?.showBottomSheet(
|
bsController = scaffoldKey.currentState?.showBottomSheet(
|
||||||
enableDrag: false,
|
enableDrag: false,
|
||||||
(context) => _postPanel(false),
|
(context) => _postPanel(false),
|
||||||
)
|
);
|
||||||
: childKey.currentState?.showBottomSheet(
|
} else {
|
||||||
enableDrag: false,
|
childKey.currentState?.showBottomSheet(
|
||||||
(context) => _postPanel(),
|
enableDrag: false,
|
||||||
);
|
(context) => _postPanel(),
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _postPanel([bool isChild = true]) => StatefulBuilder(
|
Widget _postPanel([bool isChild = true]) => StatefulBuilder(
|
||||||
@@ -1206,7 +1210,14 @@ class VideoDetailController extends GetxController
|
|||||||
iconButton(
|
iconButton(
|
||||||
context: context,
|
context: context,
|
||||||
tooltip: '关闭',
|
tooltip: '关闭',
|
||||||
onPressed: Get.back,
|
onPressed: () {
|
||||||
|
if (bsController != null) {
|
||||||
|
bsController!.close();
|
||||||
|
bsController = null;
|
||||||
|
} else {
|
||||||
|
Get.back();
|
||||||
|
}
|
||||||
|
},
|
||||||
icon: Icons.close,
|
icon: Icons.close,
|
||||||
),
|
),
|
||||||
const SizedBox(width: 16),
|
const SizedBox(width: 16),
|
||||||
|
|||||||
@@ -541,23 +541,7 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
|||||||
(horizontalScreen ||
|
(horizontalScreen ||
|
||||||
MediaQuery.of(context).orientation ==
|
MediaQuery.of(context).orientation ==
|
||||||
Orientation.portrait),
|
Orientation.portrait),
|
||||||
onPopInvokedWithResult:
|
onPopInvokedWithResult: _onPopInvokedWithResult,
|
||||||
(bool didPop, Object? result) {
|
|
||||||
if (plPlayerController?.controlsLock.value ==
|
|
||||||
true) {
|
|
||||||
plPlayerController?.onLockControl(false);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (isFullScreen) {
|
|
||||||
plPlayerController!
|
|
||||||
.triggerFullScreen(status: false);
|
|
||||||
}
|
|
||||||
if (MediaQuery.of(context).orientation ==
|
|
||||||
Orientation.landscape &&
|
|
||||||
!horizontalScreen) {
|
|
||||||
verticalScreenForTwoSeconds();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
child: videoPlayer(videoWidth, videoHeight),
|
child: videoPlayer(videoWidth, videoHeight),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
@@ -608,20 +592,7 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
|||||||
width: isFullScreen ? context.width : videoWidth,
|
width: isFullScreen ? context.width : videoWidth,
|
||||||
child: PopScope(
|
child: PopScope(
|
||||||
canPop: !isFullScreen,
|
canPop: !isFullScreen,
|
||||||
onPopInvokedWithResult: (bool didPop, Object? result) {
|
onPopInvokedWithResult: _onPopInvokedWithResult,
|
||||||
if (plPlayerController?.controlsLock.value == true) {
|
|
||||||
plPlayerController?.onLockControl(false);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (isFullScreen) {
|
|
||||||
plPlayerController!.triggerFullScreen(status: false);
|
|
||||||
}
|
|
||||||
if (MediaQuery.of(context).orientation ==
|
|
||||||
Orientation.landscape &&
|
|
||||||
!horizontalScreen) {
|
|
||||||
verticalScreenForTwoSeconds();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
child: videoPlayer(videoWidth, videoHeight),
|
child: videoPlayer(videoWidth, videoHeight),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -664,20 +635,7 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
|||||||
: videoHeight,
|
: videoHeight,
|
||||||
child: PopScope(
|
child: PopScope(
|
||||||
canPop: !isFullScreen,
|
canPop: !isFullScreen,
|
||||||
onPopInvokedWithResult: (bool didPop, Object? result) {
|
onPopInvokedWithResult: _onPopInvokedWithResult,
|
||||||
if (plPlayerController?.controlsLock.value == true) {
|
|
||||||
plPlayerController?.onLockControl(false);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (isFullScreen) {
|
|
||||||
plPlayerController!.triggerFullScreen(status: false);
|
|
||||||
}
|
|
||||||
if (MediaQuery.of(context).orientation ==
|
|
||||||
Orientation.landscape &&
|
|
||||||
!horizontalScreen) {
|
|
||||||
verticalScreenForTwoSeconds();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
child: videoPlayer(videoWidth, videoHeight),
|
child: videoPlayer(videoWidth, videoHeight),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -722,20 +680,7 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
|||||||
width: isFullScreen ? context.width : videoWidth,
|
width: isFullScreen ? context.width : videoWidth,
|
||||||
child: PopScope(
|
child: PopScope(
|
||||||
canPop: !isFullScreen,
|
canPop: !isFullScreen,
|
||||||
onPopInvokedWithResult: (bool didPop, Object? result) {
|
onPopInvokedWithResult: _onPopInvokedWithResult,
|
||||||
if (plPlayerController?.controlsLock.value == true) {
|
|
||||||
plPlayerController?.onLockControl(false);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (isFullScreen) {
|
|
||||||
plPlayerController!.triggerFullScreen(status: false);
|
|
||||||
}
|
|
||||||
if (MediaQuery.of(context).orientation ==
|
|
||||||
Orientation.landscape &&
|
|
||||||
!horizontalScreen) {
|
|
||||||
verticalScreenForTwoSeconds();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
child: videoPlayer(videoWidth, videoHeight),
|
child: videoPlayer(videoWidth, videoHeight),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -803,20 +748,7 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
|||||||
height: isFullScreen ? context.height : videoHeight,
|
height: isFullScreen ? context.height : videoHeight,
|
||||||
child: PopScope(
|
child: PopScope(
|
||||||
canPop: !isFullScreen,
|
canPop: !isFullScreen,
|
||||||
onPopInvokedWithResult: (bool didPop, Object? result) {
|
onPopInvokedWithResult: _onPopInvokedWithResult,
|
||||||
if (plPlayerController?.controlsLock.value == true) {
|
|
||||||
plPlayerController?.onLockControl(false);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (isFullScreen) {
|
|
||||||
plPlayerController!.triggerFullScreen(status: false);
|
|
||||||
}
|
|
||||||
if (MediaQuery.of(context).orientation ==
|
|
||||||
Orientation.landscape &&
|
|
||||||
!horizontalScreen) {
|
|
||||||
verticalScreenForTwoSeconds();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
child: videoPlayer(videoWidth, videoHeight),
|
child: videoPlayer(videoWidth, videoHeight),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -1408,9 +1340,18 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
|||||||
videoDetailController.videoType == SearchType.media_bangumi
|
videoDetailController.videoType == SearchType.media_bangumi
|
||||||
? bangumiIntroController.changeSeasonOrbangu
|
? bangumiIntroController.changeSeasonOrbangu
|
||||||
: videoIntroController.changeSeasonOrbangu,
|
: videoIntroController.changeSeasonOrbangu,
|
||||||
|
onClose: () {
|
||||||
|
if (videoDetailController.bsController != null) {
|
||||||
|
videoDetailController.bsController!.close();
|
||||||
|
videoDetailController.bsController = null;
|
||||||
|
} else {
|
||||||
|
Get.back();
|
||||||
|
}
|
||||||
|
},
|
||||||
);
|
);
|
||||||
if (isFullScreen) {
|
if (isFullScreen) {
|
||||||
videoDetailController.scaffoldKey.currentState?.showBottomSheet(
|
videoDetailController.bsController =
|
||||||
|
videoDetailController.scaffoldKey.currentState?.showBottomSheet(
|
||||||
(context) => listSheetContent(),
|
(context) => listSheetContent(),
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
@@ -1463,7 +1404,14 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
|||||||
size: 30,
|
size: 30,
|
||||||
icon: Icons.clear,
|
icon: Icons.clear,
|
||||||
tooltip: '关闭',
|
tooltip: '关闭',
|
||||||
onPressed: Get.back,
|
onPressed: () {
|
||||||
|
if (videoDetailController.bsController != null) {
|
||||||
|
videoDetailController.bsController!.close();
|
||||||
|
videoDetailController.bsController = null;
|
||||||
|
} else {
|
||||||
|
Get.back();
|
||||||
|
}
|
||||||
|
},
|
||||||
),
|
),
|
||||||
const SizedBox(width: 16),
|
const SizedBox(width: 16),
|
||||||
],
|
],
|
||||||
@@ -1565,7 +1513,8 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (isFullScreen) {
|
if (isFullScreen) {
|
||||||
videoDetailController.scaffoldKey.currentState?.showBottomSheet(
|
videoDetailController.bsController =
|
||||||
|
videoDetailController.scaffoldKey.currentState?.showBottomSheet(
|
||||||
(context) => listSheetContent(context, true),
|
(context) => listSheetContent(context, true),
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
@@ -1574,4 +1523,23 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void _onPopInvokedWithResult(didPop, result) {
|
||||||
|
if (videoDetailController.bsController != null) {
|
||||||
|
videoDetailController.bsController!.close();
|
||||||
|
videoDetailController.bsController = null;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (plPlayerController?.controlsLock.value == true) {
|
||||||
|
plPlayerController?.onLockControl(false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (isFullScreen) {
|
||||||
|
plPlayerController!.triggerFullScreen(status: false);
|
||||||
|
}
|
||||||
|
if (MediaQuery.of(context).orientation == Orientation.landscape &&
|
||||||
|
!horizontalScreen) {
|
||||||
|
verticalScreenForTwoSeconds();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user