opt: video tool bar

Closes #528

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-03-27 15:43:08 +08:00
parent 6ff83e34f3
commit 3a6b6614a4
3 changed files with 89 additions and 56 deletions

View File

@@ -95,6 +95,7 @@ class VideoDetailController extends GetxController
// 默认记录历史记录
bool enableHeart = true;
Floating? floating;
late final headerCtrKey = GlobalKey<HeaderControlState>();
late PreferredSizeWidget headerControl;
Box get setting => GStorage.setting;
@@ -291,6 +292,7 @@ class VideoDetailController extends GetxController
floating = Floating();
}
headerControl = HeaderControl(
key: headerCtrKey,
controller: plPlayerController,
videoDetailCtr: this,
floating: floating,

View File

@@ -856,17 +856,19 @@ class _VideoDetailPageVState extends State<VideoDetailPageV>
],
),
),
if (videoDetailController.playedTime ==
null)
Align(
alignment: Alignment.centerRight,
child: PopupMenuButton<String>(
child: videoDetailController
.playedTime ==
null
? PopupMenuButton<String>(
icon: Icon(
Icons.more_vert,
color: themeData
.colorScheme.onSurface,
),
onSelected: (String type) async {
onSelected:
(String type) async {
switch (type) {
case 'later':
await videoIntroController
@@ -878,7 +880,8 @@ class _VideoDetailPageVState extends State<VideoDetailPageV>
SmartDialog.showToast(
'账号未登录');
} else {
Get.toNamed('/webview',
Get.toNamed(
'/webview',
parameters: {
'url':
'https://www.bilibili.com/appeal/?avid=${IdUtils.bv2av(videoDetailController.bvid)}&bvid=${videoDetailController.bvid}'
@@ -887,12 +890,13 @@ class _VideoDetailPageVState extends State<VideoDetailPageV>
break;
case 'note':
videoDetailController
.showNoteList(context);
.showNoteList(
context);
break;
}
},
itemBuilder:
(BuildContext context) =>
itemBuilder: (BuildContext
context) =>
<PopupMenuEntry<String>>[
const PopupMenuItem<String>(
value: 'later',
@@ -901,7 +905,8 @@ class _VideoDetailPageVState extends State<VideoDetailPageV>
if (videoDetailController
.epId ==
null)
const PopupMenuItem<String>(
const PopupMenuItem<
String>(
value: 'note',
child: Text('查看笔记'),
),
@@ -910,6 +915,32 @@ class _VideoDetailPageVState extends State<VideoDetailPageV>
child: Text('举报'),
),
],
)
: SizedBox(
width: 42,
height: 34,
child: IconButton(
tooltip: "更多设置",
style: ButtonStyle(
padding:
WidgetStateProperty
.all(EdgeInsets
.zero),
),
onPressed: () {
videoDetailController
.headerCtrKey
.currentState
?.showSettingSheet();
},
icon: Icon(
Icons.more_vert_outlined,
size: 19,
color: themeData
.colorScheme
.onSurface,
),
),
),
),
],

View File

@@ -53,13 +53,13 @@ class HeaderControl extends StatefulWidget implements PreferredSizeWidget {
final String heroTag;
@override
State<HeaderControl> createState() => _HeaderControlState();
State<HeaderControl> createState() => HeaderControlState();
@override
Size get preferredSize => throw UnimplementedError();
}
class _HeaderControlState extends State<HeaderControl> {
class HeaderControlState extends State<HeaderControl> {
PlayUrlModel get videoInfo => videoDetailCtr.data;
static const TextStyle subTitleStyle = TextStyle(fontSize: 12);
static const TextStyle titleStyle = TextStyle(fontSize: 14);