mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
fix: 横竖屏适配标题滚动显示,图标调整,监听器加取消
This commit is contained in:
@@ -296,10 +296,10 @@ class VideoContent extends StatelessWidget {
|
|||||||
maxLines: videoItem.videos > 1 ? 1 : 2,
|
maxLines: videoItem.videos > 1 ? 1 : 2,
|
||||||
overflow: TextOverflow.ellipsis,
|
overflow: TextOverflow.ellipsis,
|
||||||
),
|
),
|
||||||
if (videoItem.showTitle != null) ...[
|
if (videoItem.isFullScreen != null) ...[
|
||||||
const SizedBox(height: 2),
|
const SizedBox(height: 2),
|
||||||
Text(
|
Text(
|
||||||
videoItem.showTitle,
|
videoItem.isFullScreen,
|
||||||
textAlign: TextAlign.start,
|
textAlign: TextAlign.start,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: Theme.of(context).textTheme.labelMedium!.fontSize,
|
fontSize: Theme.of(context).textTheme.labelMedium!.fontSize,
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import 'dart:async';
|
||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
import 'dart:math';
|
import 'dart:math';
|
||||||
|
|
||||||
@@ -20,6 +21,7 @@ import 'package:PiliPalaX/http/danmaku.dart';
|
|||||||
import 'package:PiliPalaX/services/shutdown_timer_service.dart';
|
import 'package:PiliPalaX/services/shutdown_timer_service.dart';
|
||||||
import '../../../../models/video_detail_res.dart';
|
import '../../../../models/video_detail_res.dart';
|
||||||
import '../introduction/index.dart';
|
import '../introduction/index.dart';
|
||||||
|
import 'package:marquee/marquee.dart';
|
||||||
|
|
||||||
class HeaderControl extends StatefulWidget implements PreferredSizeWidget {
|
class HeaderControl extends StatefulWidget implements PreferredSizeWidget {
|
||||||
const HeaderControl({
|
const HeaderControl({
|
||||||
@@ -49,29 +51,30 @@ class _HeaderControlState extends State<HeaderControl> {
|
|||||||
final Box<dynamic> videoStorage = GStrorage.video;
|
final Box<dynamic> videoStorage = GStrorage.video;
|
||||||
late List<double> speedsList;
|
late List<double> speedsList;
|
||||||
double buttonSpace = 8;
|
double buttonSpace = 8;
|
||||||
bool showTitle = false;
|
bool isFullScreen = false;
|
||||||
late String heroTag;
|
late String heroTag;
|
||||||
late VideoIntroController videoIntroController;
|
late VideoIntroController videoIntroController;
|
||||||
late VideoDetailData videoDetail;
|
late VideoDetailData videoDetail;
|
||||||
|
late StreamSubscription<bool> fullScreenStatusListener;
|
||||||
|
late bool horizontalScreen;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
videoInfo = widget.videoDetailCtr!.data;
|
videoInfo = widget.videoDetailCtr!.data;
|
||||||
speedsList = widget.controller!.speedsList;
|
speedsList = widget.controller!.speedsList;
|
||||||
fullScreenStatusListener();
|
listenFullScreenStatus();
|
||||||
heroTag = Get.arguments['heroTag'];
|
heroTag = Get.arguments['heroTag'];
|
||||||
videoIntroController = Get.put(VideoIntroController(), tag: heroTag);
|
videoIntroController = Get.put(VideoIntroController(), tag: heroTag);
|
||||||
|
horizontalScreen =
|
||||||
|
setting.get(SettingBoxKey.horizontalScreen, defaultValue: false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void fullScreenStatusListener() {
|
void listenFullScreenStatus() {
|
||||||
widget.videoDetailCtr!.plPlayerController.isFullScreen
|
fullScreenStatusListener = widget
|
||||||
.listen((bool isFullScreen) {
|
.videoDetailCtr!.plPlayerController.isFullScreen
|
||||||
if (isFullScreen) {
|
.listen((bool status) {
|
||||||
showTitle = true;
|
isFullScreen = status;
|
||||||
} else {
|
|
||||||
showTitle = false;
|
|
||||||
}
|
|
||||||
setState(() {});
|
setState(() {});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -79,8 +82,10 @@ class _HeaderControlState extends State<HeaderControl> {
|
|||||||
@override
|
@override
|
||||||
void dispose() {
|
void dispose() {
|
||||||
widget.floating?.dispose();
|
widget.floating?.dispose();
|
||||||
|
fullScreenStatusListener.cancel();
|
||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// 设置面板
|
/// 设置面板
|
||||||
void showSettingSheet() {
|
void showSettingSheet() {
|
||||||
showModalBottomSheet(
|
showModalBottomSheet(
|
||||||
@@ -1085,6 +1090,7 @@ class _HeaderControlState extends State<HeaderControl> {
|
|||||||
titleSpacing: 14,
|
titleSpacing: 14,
|
||||||
title: Row(
|
title: Row(
|
||||||
children: [
|
children: [
|
||||||
|
// SizedBox(width: MediaQuery.of(context).padding.left,),
|
||||||
ComBtn(
|
ComBtn(
|
||||||
icon: const Icon(
|
icon: const Icon(
|
||||||
FontAwesomeIcons.arrowLeft,
|
FontAwesomeIcons.arrowLeft,
|
||||||
@@ -1098,8 +1104,7 @@ class _HeaderControlState extends State<HeaderControl> {
|
|||||||
<void>{
|
<void>{
|
||||||
if (MediaQuery.of(context).orientation ==
|
if (MediaQuery.of(context).orientation ==
|
||||||
Orientation.landscape &&
|
Orientation.landscape &&
|
||||||
!setting.get(SettingBoxKey.horizontalScreen,
|
!horizontalScreen)
|
||||||
defaultValue: false))
|
|
||||||
{
|
{
|
||||||
verticalScreen(),
|
verticalScreen(),
|
||||||
},
|
},
|
||||||
@@ -1108,18 +1113,34 @@ class _HeaderControlState extends State<HeaderControl> {
|
|||||||
},
|
},
|
||||||
),
|
),
|
||||||
SizedBox(width: buttonSpace),
|
SizedBox(width: buttonSpace),
|
||||||
if (showTitle && isLandscape) ...[
|
if (isFullScreen ||
|
||||||
|
(!isFullScreen && isLandscape && !horizontalScreen)) ...[
|
||||||
Column(
|
Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
ConstrainedBox(
|
ConstrainedBox(
|
||||||
constraints: BoxConstraints(maxWidth: 200),
|
constraints: BoxConstraints(
|
||||||
child: Text(
|
maxWidth: isLandscape ? 400 : 100, maxHeight: 20),
|
||||||
videoIntroController.videoDetail.value.title!,
|
child: Marquee(
|
||||||
|
text: videoIntroController.videoDetail.value.title!,
|
||||||
style: const TextStyle(
|
style: const TextStyle(
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
fontSize: 16,
|
fontSize: 16,
|
||||||
),
|
),
|
||||||
|
scrollAxis: Axis.horizontal,
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
blankSpace: 200,
|
||||||
|
velocity: 40,
|
||||||
|
startAfter: const Duration(seconds: 1),
|
||||||
|
showFadingOnlyWhenScrolling: true,
|
||||||
|
fadingEdgeStartFraction: 0.1,
|
||||||
|
fadingEdgeEndFraction: 0.1,
|
||||||
|
numberOfRounds: 1,
|
||||||
|
startPadding: 0,
|
||||||
|
accelerationDuration: const Duration(seconds: 1),
|
||||||
|
accelerationCurve: Curves.linear,
|
||||||
|
decelerationDuration: const Duration(milliseconds: 500),
|
||||||
|
decelerationCurve: Curves.easeOut,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
if (videoIntroController.isShowOnlineTotal)
|
if (videoIntroController.isShowOnlineTotal)
|
||||||
@@ -1159,19 +1180,21 @@ class _HeaderControlState extends State<HeaderControl> {
|
|||||||
// fuc: () => _.screenshot(),
|
// fuc: () => _.screenshot(),
|
||||||
// ),
|
// ),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: 56,
|
width: 34,
|
||||||
height: 34,
|
height: 34,
|
||||||
child: TextButton(
|
child: IconButton(
|
||||||
style: ButtonStyle(
|
style: ButtonStyle(
|
||||||
padding: MaterialStateProperty.all(EdgeInsets.zero),
|
padding: MaterialStateProperty.all(EdgeInsets.zero),
|
||||||
),
|
),
|
||||||
onPressed: () => showShootDanmakuSheet(),
|
onPressed: () => showShootDanmakuSheet(),
|
||||||
child: const Text(
|
icon: const Icon(
|
||||||
'发弹幕',
|
Icons.add_card_outlined,
|
||||||
style: textStyle,
|
size: 19,
|
||||||
|
color: Colors.white,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
SizedBox(width: buttonSpace),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: 34,
|
width: 34,
|
||||||
height: 34,
|
height: 34,
|
||||||
@@ -1225,7 +1248,7 @@ class _HeaderControlState extends State<HeaderControl> {
|
|||||||
],
|
],
|
||||||
Obx(
|
Obx(
|
||||||
() => SizedBox(
|
() => SizedBox(
|
||||||
width: 45,
|
width: 34,
|
||||||
height: 34,
|
height: 34,
|
||||||
child: TextButton(
|
child: TextButton(
|
||||||
style: ButtonStyle(
|
style: ButtonStyle(
|
||||||
|
|||||||
16
pubspec.lock
16
pubspec.lock
@@ -465,6 +465,14 @@ packages:
|
|||||||
url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/"
|
url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "6.2.1"
|
version: "6.2.1"
|
||||||
|
fading_edge_scrollview:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: fading_edge_scrollview
|
||||||
|
sha256: c25c2231652ce774cc31824d0112f11f653881f43d7f5302c05af11942052031
|
||||||
|
url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/"
|
||||||
|
source: hosted
|
||||||
|
version: "3.0.0"
|
||||||
fake_async:
|
fake_async:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -830,6 +838,14 @@ packages:
|
|||||||
url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/"
|
url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "6.0.1"
|
version: "6.0.1"
|
||||||
|
marquee:
|
||||||
|
dependency: "direct main"
|
||||||
|
description:
|
||||||
|
name: marquee
|
||||||
|
sha256: "4b5243d2804373bdc25fc93d42c3b402d6ec1f4ee8d0bb72276edd04ae7addb8"
|
||||||
|
url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/"
|
||||||
|
source: hosted
|
||||||
|
version: "2.2.3"
|
||||||
matcher:
|
matcher:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
|||||||
@@ -142,6 +142,7 @@ dependencies:
|
|||||||
path: 1.8.3
|
path: 1.8.3
|
||||||
#瀑布流
|
#瀑布流
|
||||||
waterfall_flow: ^3.0.3
|
waterfall_flow: ^3.0.3
|
||||||
|
marquee: ^2.2.3
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
flutter_test:
|
flutter_test:
|
||||||
|
|||||||
Reference in New Issue
Block a user