opt: video sheet

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-04-06 15:49:40 +08:00
parent f9b844fb1a
commit a8daf02610
6 changed files with 1504 additions and 1576 deletions

View File

@@ -97,7 +97,6 @@ class VideoDetailController extends GetxController
bool enableHeart = true;
Floating? floating;
late final headerCtrKey = GlobalKey<HeaderControlState>();
late PreferredSizeWidget headerControl;
Box get setting => GStorage.setting;
@@ -288,13 +287,6 @@ class VideoDetailController extends GetxController
if (Platform.isAndroid) {
floating = Floating();
}
headerControl = HeaderControl(
key: headerCtrKey,
controller: plPlayerController,
videoDetailCtr: this,
floating: floating,
heroTag: heroTag,
);
// CDN优化
// enableCDN = setting.get(SettingBoxKey.enableCDN, defaultValue: true);
@@ -1104,9 +1096,6 @@ class VideoDetailController extends GetxController
_getDmTrend();
}
/// 开启自动全屏时在player初始化完成后立即传入headerControl
plPlayerController.headerControl = headerControl;
if (defaultST != null) {
defaultST = null;
}

View File

@@ -1540,7 +1540,13 @@ class _VideoDetailPageVState extends State<VideoDetailPageV>
SearchType.media_bangumi
? bangumiIntroController
: null,
headerControl: videoDetailController.headerControl,
headerControl: HeaderControl(
key: videoDetailController.headerCtrKey,
controller: videoDetailController.plPlayerController,
videoDetailCtr: videoDetailController,
floating: videoDetailController.floating,
heroTag: heroTag,
),
danmuWidget: Obx(
() => PlDanmaku(
key: Key(

File diff suppressed because it is too large Load Diff

View File

@@ -137,10 +137,6 @@ class PlPlayerController {
{'attr': BoxFit.scaleDown, 'desc': '限制', 'toast': '仅超出时缩小至播放器尺寸'},
];
PreferredSizeWidget? headerControl;
PreferredSizeWidget? bottomControl;
Widget? danmuWidget;
String get bvid => _bvid;
int get cid => _cid;

View File

@@ -47,7 +47,7 @@ class PLVideoPlayer extends StatefulWidget {
this.videoDetailController,
this.videoIntroController,
this.bangumiIntroController,
this.headerControl,
required this.headerControl,
this.bottomControl,
this.danmuWidget,
this.customWidget,
@@ -63,7 +63,7 @@ class PLVideoPlayer extends StatefulWidget {
final VideoDetailController? videoDetailController;
final VideoIntroController? videoIntroController;
final BangumiIntroController? bangumiIntroController;
final PreferredSizeWidget? headerControl;
final PreferredSizeWidget headerControl;
final PreferredSizeWidget? bottomControl;
final Widget? danmuWidget;
// List<Widget> or Widget
@@ -170,9 +170,6 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
videoController = plPlayerController.videoController!;
videoIntroController = widget.videoIntroController;
bangumiIntroController = widget.bangumiIntroController;
plPlayerController.headerControl = widget.headerControl;
plPlayerController.bottomControl = widget.bottomControl;
plPlayerController.danmuWidget = widget.danmuWidget;
defaultBtmProgressBehavior = GStorage.setting.get(
SettingBoxKey.btmProgressBehavior,
defaultValue: BtmProgressBehavior.values.first.code);
@@ -1289,29 +1286,25 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
child: ClipRect(
child: Column(
children: [
if (widget.headerControl != null ||
plPlayerController.headerControl != null)
AppBarAni(
controller: animationController,
visible: !plPlayerController.controlsLock.value &&
plPlayerController.showControls.value,
position: 'top',
child: widget.headerControl ??
plPlayerController.headerControl!,
),
AppBarAni(
controller: animationController,
visible: !plPlayerController.controlsLock.value &&
plPlayerController.showControls.value,
position: 'top',
child: widget.headerControl,
),
const Spacer(),
if (plPlayerController.showControls.value)
AppBarAni(
controller: animationController,
visible: !plPlayerController.controlsLock.value &&
plPlayerController.showControls.value,
position: 'bottom',
child: widget.bottomControl ??
BottomControl(
controller: plPlayerController,
buildBottomControl: buildBottomControl,
),
),
AppBarAni(
controller: animationController,
visible: !plPlayerController.controlsLock.value &&
plPlayerController.showControls.value,
position: 'bottom',
child: widget.bottomControl ??
BottomControl(
controller: plPlayerController,
buildBottomControl: buildBottomControl,
),
),
],
),
),

View File

@@ -572,17 +572,7 @@ class Utils {
child: Column(
children: [
const Spacer(flex: 3),
Expanded(
flex: 7,
child: MediaQuery.removePadding(
context: context,
removeTop: true,
removeBottom: true,
removeLeft: true,
removeRight: true,
child: child,
),
),
Expanded(flex: 7, child: child),
if (isFullScreen() && padding != null)
SizedBox(height: padding),
],
@@ -592,16 +582,7 @@ class Utils {
child: Row(
children: [
const Spacer(),
Expanded(
child: MediaQuery.removePadding(
context: context,
removeTop: true,
removeBottom: true,
removeLeft: true,
removeRight: true,
child: child,
),
),
Expanded(child: child),
],
),
);