Signed-off-by: dom <githubaccount56556@proton.me>
This commit is contained in:
dom
2026-08-01 17:07:51 +08:00
parent 2a99d967fd
commit 6cb8a8e060
35 changed files with 1876 additions and 1799 deletions

View File

@@ -1767,363 +1767,354 @@ class HeaderControlState extends State<HeaderControl>
title = const Spacer();
}
const btnWidth = 40.0;
const btnWidth = 42.0;
const btnHeight = 34.0;
const btnStyle = ButtonStyle(padding: WidgetStatePropertyAll(.zero));
return AppBar(
elevation: 0,
scrolledUnderElevation: 0,
backgroundColor: Colors.transparent,
foregroundColor: Colors.white,
primary: false,
automaticallyImplyLeading: false,
toolbarHeight: showFSActionItem ? 112 : null,
flexibleSpace: Column(
mainAxisSize: MainAxisSize.min,
children: [
const SizedBox(height: 11),
Row(
children: [
return Column(
mainAxisSize: .min,
children: [
const SizedBox(height: 12),
Row(
children: [
SizedBox(
width: btnWidth,
height: btnHeight,
child: IconButton(
tooltip: '返回',
style: btnStyle,
icon: const Icon(
FontAwesomeIcons.arrowLeft,
size: 15,
color: Colors.white,
),
onPressed: () =>
plPlayerController.onPopInvokedWithResult(false, null),
),
),
if (!plPlayerController.isDesktopPip &&
(!isFullScreen || !isPortrait))
SizedBox(
width: btnWidth,
height: btnHeight,
child: IconButton(
tooltip: '返回',
tooltip: '返回主页',
style: btnStyle,
icon: const Icon(
FontAwesomeIcons.arrowLeft,
FontAwesomeIcons.house,
size: 15,
color: Colors.white,
),
onPressed: () =>
plPlayerController.onPopInvokedWithResult(false, null),
onPressed: plPlayerController.onCloseAll,
),
),
if (!plPlayerController.isDesktopPip &&
(!isFullScreen || !isPortrait))
SizedBox(
title,
// show current datetime
...?timeBatteryWidgets,
if (PlatformUtils.isDesktop && !plPlayerController.isDesktopPip)
Obx(() {
final isAlwaysOnTop = plPlayerController.isAlwaysOnTop.value;
return SizedBox(
width: btnWidth,
height: btnHeight,
child: IconButton(
tooltip: '返回主页',
style: btnStyle,
icon: const Icon(
FontAwesomeIcons.house,
size: 15,
color: Colors.white,
),
onPressed: plPlayerController.onCloseAll,
tooltip: '${isAlwaysOnTop ? '取消' : ''}置顶',
onPressed: () =>
plPlayerController.setAlwaysOnTop(!isAlwaysOnTop),
icon: isAlwaysOnTop
? const Icon(
size: 19,
Icons.push_pin,
color: Colors.white,
)
: const Icon(
size: 19,
Icons.push_pin_outlined,
color: Colors.white,
),
),
),
title,
// show current datetime
...?timeBatteryWidgets,
if (PlatformUtils.isDesktop && !plPlayerController.isDesktopPip)
Obx(() {
final isAlwaysOnTop = plPlayerController.isAlwaysOnTop.value;
return SizedBox(
width: btnWidth,
height: btnHeight,
child: IconButton(
style: btnStyle,
tooltip: '${isAlwaysOnTop ? '取消' : ''}置顶',
onPressed: () =>
plPlayerController.setAlwaysOnTop(!isAlwaysOnTop),
icon: isAlwaysOnTop
? const Icon(
size: 19,
Icons.push_pin,
color: Colors.white,
)
: const Icon(
size: 19,
Icons.push_pin_outlined,
color: Colors.white,
),
),
);
}),
if (!isFileSource) ...[
if (!isFSOrPip) ...[
if (videoDetailCtr.isUgc)
SizedBox(
width: btnWidth,
height: btnHeight,
child: IconButton(
tooltip: '听音频',
style: btnStyle,
onPressed: videoDetailCtr.toAudioPage,
icon: const Icon(
Icons.headphones_outlined,
size: 19,
color: Colors.white,
),
),
),
);
}),
if (!isFileSource) ...[
if (!isFSOrPip) ...[
if (videoDetailCtr.isUgc)
SizedBox(
width: btnWidth,
height: btnHeight,
child: IconButton(
tooltip: '投屏',
tooltip: '听音频',
style: btnStyle,
onPressed: videoDetailCtr.onCast,
onPressed: videoDetailCtr.toAudioPage,
icon: const Icon(
Icons.cast,
Icons.headphones_outlined,
size: 19,
color: Colors.white,
),
),
),
],
if (plPlayerController.enableSponsorBlock)
SizedBox(
width: btnWidth,
height: btnHeight,
child: IconButton(
tooltip: '提交片段',
style: btnStyle,
onPressed: () => videoDetailCtr.onBlock(context),
icon: const Icon(
CustomIcons.shield_play_arrow,
size: 20,
color: Colors.white,
),
SizedBox(
width: btnWidth,
height: btnHeight,
child: IconButton(
tooltip: '投屏',
style: btnStyle,
onPressed: videoDetailCtr.onCast,
icon: const Icon(
Icons.cast,
size: 19,
color: Colors.white,
),
),
Obx(
() => videoDetailCtr.segmentProgressList.isNotEmpty
? SizedBox(
width: btnWidth,
height: btnHeight,
child: IconButton(
tooltip: '片段信息',
style: btnStyle,
onPressed: videoDetailCtr.showSBDetail,
icon: const Icon(
MdiIcons.advertisements,
size: 19,
color: Colors.white,
),
),
],
if (plPlayerController.enableSponsorBlock)
SizedBox(
width: btnWidth,
height: btnHeight,
child: IconButton(
tooltip: '提交片段',
style: btnStyle,
onPressed: () => videoDetailCtr.onBlock(context),
icon: const Icon(
CustomIcons.shield_play_arrow,
size: 20,
color: Colors.white,
),
),
),
Obx(
() => videoDetailCtr.segmentProgressList.isNotEmpty
? SizedBox(
width: btnWidth,
height: btnHeight,
child: IconButton(
tooltip: '片段信息',
style: btnStyle,
onPressed: videoDetailCtr.showSBDetail,
icon: const Icon(
MdiIcons.advertisements,
size: 19,
color: Colors.white,
),
)
: const SizedBox.shrink(),
),
],
if (!isPortrait || isFullScreen || PlatformUtils.isDesktop) ...[
SizedBox(
width: btnWidth,
height: btnHeight,
child: IconButton(
tooltip: '发弹幕',
style: btnStyle,
onPressed: videoDetailCtr.showShootDanmakuSheet,
icon: const Icon(
Icons.comment_outlined,
size: 19,
color: Colors.white,
),
),
),
SizedBox(
width: btnWidth,
height: btnHeight,
child: Obx(
() {
final enableShowDanmaku =
plPlayerController.enableShowDanmaku.value;
return IconButton(
tooltip: "${enableShowDanmaku ? '关闭' : '开启'}弹幕",
style: btnStyle,
onPressed: () {
final newVal = !enableShowDanmaku;
plPlayerController.enableShowDanmaku.value = newVal;
if (!plPlayerController.tempPlayerConf) {
setting.put(
SettingBoxKey.enableShowDanmaku,
newVal,
);
}
},
icon: enableShowDanmaku
? const Icon(
size: 20,
CustomIcons.dm_on,
color: Colors.white,
)
: const Icon(
size: 20,
CustomIcons.dm_off,
color: Colors.white,
),
);
},
),
),
],
SizedBox(
width: btnWidth,
height: btnHeight,
child: IconButton(
tooltip: '弹幕设置',
style: btnStyle,
onPressed: showSetDanmaku,
icon: const Icon(
size: 20,
CustomIcons.dm_settings,
color: Colors.white,
),
),
),
)
: const SizedBox.shrink(),
),
if (Platform.isAndroid ||
(PlatformUtils.isDesktop && !isFullScreen))
SizedBox(
width: btnWidth,
height: btnHeight,
child: IconButton(
tooltip: '画中画',
style: btnStyle,
onPressed: () {
if (PlatformUtils.isDesktop) {
plPlayerController.toggleDesktopPip();
return;
}
if (AndroidHelper.isPipAvailable) {
plPlayerController.enterPip();
}
},
icon: const Icon(
Icons.picture_in_picture_outlined,
size: 19,
color: Colors.white,
),
),
),
],
if (!isPortrait || isFullScreen || PlatformUtils.isDesktop) ...[
SizedBox(
width: btnWidth,
height: btnHeight,
child: IconButton(
tooltip: "更多设置",
tooltip: '发弹幕',
style: btnStyle,
onPressed: showSettingSheet,
onPressed: videoDetailCtr.showShootDanmakuSheet,
icon: const Icon(
Icons.more_vert_outlined,
Icons.comment_outlined,
size: 19,
color: Colors.white,
),
),
),
SizedBox(
width: btnWidth,
height: btnHeight,
child: Obx(
() {
final enableShowDanmaku =
plPlayerController.enableShowDanmaku.value;
return IconButton(
tooltip: "${enableShowDanmaku ? '关闭' : '开启'}弹幕",
style: btnStyle,
onPressed: () {
final newVal = !enableShowDanmaku;
plPlayerController.enableShowDanmaku.value = newVal;
if (!plPlayerController.tempPlayerConf) {
setting.put(
SettingBoxKey.enableShowDanmaku,
newVal,
);
}
},
icon: enableShowDanmaku
? const Icon(
size: 20,
CustomIcons.dm_on,
color: Colors.white,
)
: const Icon(
size: 20,
CustomIcons.dm_off,
color: Colors.white,
),
);
},
),
),
],
),
if (showFSActionItem)
Row(
mainAxisAlignment: MainAxisAlignment.end,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SizedBox(
width: btnWidth,
height: btnHeight,
child: Obx(
() => ActionItem(
expand: false,
icon: const Icon(
FontAwesomeIcons.thumbsUp,
color: Colors.white,
),
selectIcon: const Icon(FontAwesomeIcons.solidThumbsUp),
selectStatus: introController.hasLike.value,
semanticsLabel: '点赞',
animation: introController.tripleAnimation,
onStartTriple: () {
plPlayerController.tripling = true;
introController.onStartTriple();
},
onCancelTriple: ([bool isTapUp = false]) {
plPlayerController
..tripling = false
..hideTaskControls();
introController.onCancelTriple(isTapUp);
},
),
SizedBox(
width: btnWidth,
height: btnHeight,
child: IconButton(
tooltip: '弹幕设置',
style: btnStyle,
onPressed: showSetDanmaku,
icon: const Icon(
size: 20,
CustomIcons.dm_settings,
color: Colors.white,
),
),
),
if (Platform.isAndroid ||
(PlatformUtils.isDesktop && !isFullScreen))
SizedBox(
width: btnWidth,
height: btnHeight,
child: IconButton(
tooltip: '画中画',
style: btnStyle,
onPressed: () {
if (PlatformUtils.isDesktop) {
plPlayerController.toggleDesktopPip();
return;
}
if (AndroidHelper.isPipAvailable) {
plPlayerController.enterPip();
}
},
icon: const Icon(
Icons.picture_in_picture_outlined,
size: 19,
color: Colors.white,
),
),
if (introController case final UgcIntroController ugc)
SizedBox(
width: btnWidth,
height: btnHeight,
child: Obx(
() => ActionItem(
expand: false,
icon: const Icon(
FontAwesomeIcons.thumbsDown,
color: Colors.white,
),
selectIcon: const Icon(
FontAwesomeIcons.solidThumbsDown,
),
onTap: () => ugc.handleAction(ugc.actionDislikeVideo),
selectStatus: ugc.hasDislike.value,
semanticsLabel: '点踩',
),
),
),
SizedBox(
width: btnWidth,
height: btnHeight,
child: Obx(
() => ActionItem(
expand: false,
animation: introController.tripleAnimation,
icon: const Icon(
FontAwesomeIcons.b,
color: Colors.white,
),
selectIcon: const Icon(FontAwesomeIcons.b),
onTap: introController.actionCoinVideo,
selectStatus: introController.hasCoin,
semanticsLabel: '投币',
),
),
),
SizedBox(
width: btnWidth,
height: btnHeight,
child: IconButton(
tooltip: "更多设置",
style: btnStyle,
onPressed: showSettingSheet,
icon: const Icon(
Icons.more_vert_outlined,
size: 19,
color: Colors.white,
),
SizedBox(
width: btnWidth,
height: btnHeight,
child: Obx(
() => ActionItem(
expand: false,
animation: introController.tripleAnimation,
icon: const Icon(
FontAwesomeIcons.star,
color: Colors.white,
),
selectIcon: const Icon(FontAwesomeIcons.solidStar),
onTap: () => introController.showFavBottomSheet(context),
onLongPress: () => introController.showFavBottomSheet(
context,
isLongPress: true,
),
selectStatus: introController.hasFav.value,
semanticsLabel: '收藏',
),
),
),
SizedBox(
width: btnWidth,
height: btnHeight,
child: ActionItem(
),
),
],
),
if (showFSActionItem)
Row(
mainAxisAlignment: .end,
crossAxisAlignment: .start,
children: [
SizedBox(
width: btnWidth,
height: btnHeight,
child: Obx(
() => ActionItem(
expand: false,
icon: const Icon(
FontAwesomeIcons.shareFromSquare,
FontAwesomeIcons.thumbsUp,
color: Colors.white,
),
onTap: () => introController.actionShareVideo(context),
semanticsLabel: '分享',
selectIcon: const Icon(FontAwesomeIcons.solidThumbsUp),
selectStatus: introController.hasLike.value,
semanticsLabel: '点赞',
animation: introController.tripleAnimation,
onStartTriple: () {
plPlayerController.tripling = true;
introController.onStartTriple();
},
onCancelTriple: ([bool isTapUp = false]) {
plPlayerController
..tripling = false
..hideTaskControls();
introController.onCancelTriple(isTapUp);
},
),
),
],
),
],
),
),
if (introController case final UgcIntroController ugc)
SizedBox(
width: btnWidth,
height: btnHeight,
child: Obx(
() => ActionItem(
expand: false,
icon: const Icon(
FontAwesomeIcons.thumbsDown,
color: Colors.white,
),
selectIcon: const Icon(
FontAwesomeIcons.solidThumbsDown,
),
onTap: () => ugc.handleAction(ugc.actionDislikeVideo),
selectStatus: ugc.hasDislike.value,
semanticsLabel: '点踩',
),
),
),
SizedBox(
width: btnWidth,
height: btnHeight,
child: Obx(
() => ActionItem(
expand: false,
animation: introController.tripleAnimation,
icon: const Icon(
FontAwesomeIcons.b,
color: Colors.white,
),
selectIcon: const Icon(FontAwesomeIcons.b),
onTap: introController.actionCoinVideo,
selectStatus: introController.hasCoin,
semanticsLabel: '投币',
),
),
),
SizedBox(
width: btnWidth,
height: btnHeight,
child: Obx(
() => ActionItem(
expand: false,
animation: introController.tripleAnimation,
icon: const Icon(
FontAwesomeIcons.star,
color: Colors.white,
),
selectIcon: const Icon(FontAwesomeIcons.solidStar),
onTap: () => introController.showFavBottomSheet(context),
onLongPress: () => introController.showFavBottomSheet(
context,
isLongPress: true,
),
selectStatus: introController.hasFav.value,
semanticsLabel: '收藏',
),
),
),
SizedBox(
width: btnWidth,
height: btnHeight,
child: ActionItem(
expand: false,
icon: const Icon(
FontAwesomeIcons.shareFromSquare,
color: Colors.white,
),
onTap: () => introController.actionShareVideo(context),
semanticsLabel: '分享',
),
),
],
),
],
);
}
}