mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
mod: 全屏添加时间;修复没有标题
This commit is contained in:
@@ -56,6 +56,7 @@ class _HeaderControlState extends State<HeaderControl> {
|
|||||||
late VideoDetailData videoDetail;
|
late VideoDetailData videoDetail;
|
||||||
late StreamSubscription<bool> fullScreenStatusListener;
|
late StreamSubscription<bool> fullScreenStatusListener;
|
||||||
late bool horizontalScreen;
|
late bool horizontalScreen;
|
||||||
|
RxString now = ''.obs;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
@@ -68,6 +69,7 @@ class _HeaderControlState extends State<HeaderControl> {
|
|||||||
videoIntroController = Get.put(VideoIntroController(), tag: heroTag);
|
videoIntroController = Get.put(VideoIntroController(), tag: heroTag);
|
||||||
horizontalScreen =
|
horizontalScreen =
|
||||||
setting.get(SettingBoxKey.horizontalScreen, defaultValue: false);
|
setting.get(SettingBoxKey.horizontalScreen, defaultValue: false);
|
||||||
|
startClock();
|
||||||
}
|
}
|
||||||
|
|
||||||
void listenFullScreenStatus() {
|
void listenFullScreenStatus() {
|
||||||
@@ -1037,11 +1039,20 @@ class _HeaderControlState extends State<HeaderControl> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
startClock() {
|
||||||
|
Timer.periodic(const Duration(seconds: 1), (Timer t) {
|
||||||
|
if (!mounted) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
now.value = DateTime.now().toString().split(' ')[1].substring(0, 8);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final _ = widget.controller!;
|
final _ = widget.controller!;
|
||||||
final bool isLandscape =
|
// final bool isLandscape =
|
||||||
MediaQuery.of(context).orientation == Orientation.landscape;
|
// MediaQuery.of(context).orientation == Orientation.landscape;
|
||||||
return AppBar(
|
return AppBar(
|
||||||
backgroundColor: Colors.transparent,
|
backgroundColor: Colors.transparent,
|
||||||
foregroundColor: Colors.white,
|
foregroundColor: Colors.white,
|
||||||
@@ -1077,13 +1088,20 @@ class _HeaderControlState extends State<HeaderControl> {
|
|||||||
)),
|
)),
|
||||||
if ((videoIntroController.videoDetail.value.title != null) &&
|
if ((videoIntroController.videoDetail.value.title != null) &&
|
||||||
(isFullScreen ||
|
(isFullScreen ||
|
||||||
(!isFullScreen && isLandscape && !horizontalScreen))) ...[
|
(!isFullScreen &&
|
||||||
|
MediaQuery.of(context).orientation ==
|
||||||
|
Orientation.landscape &&
|
||||||
|
!horizontalScreen))) ...[
|
||||||
Column(
|
Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
ConstrainedBox(
|
ConstrainedBox(
|
||||||
constraints: BoxConstraints(
|
constraints: BoxConstraints(
|
||||||
maxWidth: isLandscape ? 400 : 140, maxHeight: 25),
|
maxWidth: MediaQuery.of(context).orientation ==
|
||||||
|
Orientation.landscape
|
||||||
|
? 400
|
||||||
|
: 140,
|
||||||
|
maxHeight: 25),
|
||||||
child: Marquee(
|
child: Marquee(
|
||||||
text: videoIntroController.videoDetail.value.title!,
|
text: videoIntroController.videoDetail.value.title!,
|
||||||
style: const TextStyle(
|
style: const TextStyle(
|
||||||
@@ -1115,7 +1133,7 @@ class _HeaderControlState extends State<HeaderControl> {
|
|||||||
),
|
),
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
)
|
),
|
||||||
] else ...[
|
] else ...[
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: 42,
|
width: 42,
|
||||||
@@ -1138,6 +1156,25 @@ class _HeaderControlState extends State<HeaderControl> {
|
|||||||
)),
|
)),
|
||||||
],
|
],
|
||||||
const Spacer(),
|
const Spacer(),
|
||||||
|
if ((isFullScreen &&
|
||||||
|
MediaQuery.of(context).orientation ==
|
||||||
|
Orientation.landscape) ||
|
||||||
|
(!isFullScreen &&
|
||||||
|
MediaQuery.of(context).orientation == Orientation.landscape &&
|
||||||
|
!horizontalScreen)) ...[
|
||||||
|
// const Spacer(),
|
||||||
|
// show current datetime
|
||||||
|
Obx(
|
||||||
|
() => Text(
|
||||||
|
now.value,
|
||||||
|
style: const TextStyle(
|
||||||
|
color: Colors.white,
|
||||||
|
fontSize: 13,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(width: 15,),
|
||||||
|
],
|
||||||
// ComBtn(
|
// ComBtn(
|
||||||
// icon: const Icon(
|
// icon: const Icon(
|
||||||
// FontAwesomeIcons.cropSimple,
|
// FontAwesomeIcons.cropSimple,
|
||||||
|
|||||||
Reference in New Issue
Block a user