opt: video tabbar, settings icon

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2024-12-25 16:03:26 +08:00
parent 6810aaeba1
commit a7fb8f6007
5 changed files with 122 additions and 67 deletions

View File

@@ -12,6 +12,7 @@ import 'package:PiliPalaX/models/common/dynamics_type.dart';
import 'package:PiliPalaX/models/common/reply_sort_type.dart';
import 'package:PiliPalaX/pages/setting/widgets/select_dialog.dart';
import 'package:PiliPalaX/utils/storage.dart';
import 'package:material_design_icons_flutter/material_design_icons_flutter.dart';
import '../home/index.dart';
import 'controller.dart';
@@ -144,7 +145,17 @@ class _ExtraSettingState extends State<ExtraSetting> {
SetSwitchItem(
title: '空降助手',
subTitle: '点击配置',
leading: Icon(Icons.block),
leading: Stack(
alignment: Alignment.center,
children: [
const Icon(Icons.shield),
Icon(
Icons.play_arrow_rounded,
size: 18,
color: Theme.of(context).colorScheme.surface,
),
],
),
setKey: SettingBoxKey.enableSponsorBlock,
defaultVal: false,
onTap: () => Get.toNamed('/sponsorBlock'),
@@ -152,7 +163,7 @@ class _ExtraSettingState extends State<ExtraSetting> {
SetSwitchItem(
title: '检查未读动态',
subTitle: '点击设置检查周期(min)',
leading: Icon(Icons.notifications_none),
leading: const Icon(Icons.notifications_none),
setKey: SettingBoxKey.checkDynamic,
defaultVal: true,
onChanged: (value) {
@@ -207,7 +218,11 @@ class _ExtraSettingState extends State<ExtraSetting> {
SetSwitchItem(
title: '使用gRPC加载评论',
subTitle: '如无法加载评论,可关闭\n非gRPC楼中楼无法定位评论、按热度/时间排序、查看对话',
leading: Icon(Icons.reply),
leading: SizedBox(
height: 24,
width: 24,
child: Icon(MdiIcons.google, size: 20),
),
setKey: SettingBoxKey.grpcReply,
defaultVal: true,
onChanged: (value) {
@@ -218,44 +233,44 @@ class _ExtraSettingState extends State<ExtraSetting> {
title: '显示视频分段信息',
leading: Transform.rotate(
angle: pi / 2,
child: Icon(Icons.reorder),
child: Icon(MdiIcons.viewHeadline),
),
setKey: SettingBoxKey.showViewPoints,
defaultVal: true,
),
SetSwitchItem(
title: '视频页显示相关视频',
leading: Icon(Icons.recommend_outlined),
leading: Icon(MdiIcons.motionPlayOutline),
setKey: SettingBoxKey.showRelatedVideo,
defaultVal: true,
),
SetSwitchItem(
title: '显示视频评论',
leading: Icon(Icons.reply_all),
leading: Icon(MdiIcons.commentTextOutline),
setKey: SettingBoxKey.showVideoReply,
defaultVal: true,
),
SetSwitchItem(
title: '显示番剧评论',
leading: Icon(Icons.reply_all),
leading: Icon(MdiIcons.commentTextOutline),
setKey: SettingBoxKey.showBangumiReply,
defaultVal: true,
),
SetSwitchItem(
title: '默认展开视频简介',
leading: Icon(Icons.expand_more),
leading: const Icon(Icons.expand_more),
setKey: SettingBoxKey.alwaysExapndIntroPanel,
defaultVal: false,
),
SetSwitchItem(
title: '横屏自动展开视频简介',
leading: Icon(Icons.expand_more),
leading: const Icon(Icons.expand_more),
setKey: SettingBoxKey.exapndIntroPanelH,
defaultVal: false,
),
SetSwitchItem(
title: '横屏分P/合集列表显示在Tab栏',
leading: Icon(Icons.format_list_numbered_rtl_sharp),
leading: const Icon(Icons.format_list_numbered_rtl_sharp),
setKey: SettingBoxKey.horizontalSeasonPanel,
defaultVal: false,
),

View File

@@ -1578,56 +1578,89 @@ class VideoDetailController extends GetxController
child: FloatingActionButton(
tooltip: '提交',
onPressed: () {
Request()
.post(
'${GStorage.blockServer}/api/skipSegments',
queryParameters: {
'videoID': bvid,
'cid': cid.value,
'userID': GStorage.blockUserID,
'userAgent': Constants.userAgent,
'videoDuration':
plPlayerController.durationSeconds.value,
},
data: {
'segments': list!
.map(
(item) => {
'segment': [
item.segment.first,
item.segment.second,
],
'category': item.category.name,
'actionType': item.actionType.name,
},
)
.toList(),
},
options: _options,
)
.then(
(res) {
if (res.statusCode == 200) {
Get.back();
SmartDialog.showToast('提交成功');
list?.clear();
_handleSBData(res);
plPlayerController.segmentList.value =
_segmentProgressList ?? <Segment>[];
if (positionSubscription == null) {
_initSkip();
}
} else {
SmartDialog.showToast(
'提交失败: ${{
400: '参数错误',
403: '被自动审核机制拒绝',
429: '重复提交太快',
409: '重复提交'
}[res.statusCode]}',
);
}
},
showDialog(
context: context,
builder: (context) => AlertDialog(
title: const Text(
'确定无误再提交',
style: TextStyle(fontSize: 18),
),
actions: [
TextButton(
onPressed: Get.back,
child: Text(
'取消',
style: TextStyle(
color: Theme.of(context)
.colorScheme
.outline,
),
),
),
TextButton(
onPressed: () {
Get.back();
Request()
.post(
'${GStorage.blockServer}/api/skipSegments',
queryParameters: {
'videoID': bvid,
'cid': cid.value,
'userID': GStorage.blockUserID,
'userAgent': Constants.userAgent,
'videoDuration': plPlayerController
.durationSeconds.value,
},
data: {
'segments': list!
.map(
(item) => {
'segment': [
item.segment.first,
item.segment.second,
],
'category':
item.category.name,
'actionType':
item.actionType.name,
},
)
.toList(),
},
options: _options,
)
.then(
(res) {
if (res.statusCode == 200) {
Get.back();
SmartDialog.showToast('提交成功');
list?.clear();
_handleSBData(res);
plPlayerController
.segmentList.value =
_segmentProgressList ??
<Segment>[];
if (positionSubscription ==
null) {
_initSkip();
}
} else {
SmartDialog.showToast(
'提交失败: ${{
400: '参数错误',
403: '被自动审核机制拒绝',
429: '重复提交太快',
409: '重复提交'
}[res.statusCode]}',
);
}
},
);
},
child: const Text('确定提交'),
),
],
),
);
},
child: Icon(Icons.check),

View File

@@ -1256,7 +1256,7 @@ class _VideoDetailPageState extends State<VideoDetailPage>
const Spacer()
else
Flexible(
flex: 1,
flex: length == 3 ? 2 : 1,
child: showReply ? Obx(() => tabbar()) : tabbar(),
),
Flexible(

View File

@@ -1760,10 +1760,16 @@ class _HeaderControlState extends State<HeaderControl> {
padding: WidgetStateProperty.all(EdgeInsets.zero),
),
onPressed: () => widget.videoDetailCtr?.onBlock(context),
icon: const Icon(
Icons.block,
size: 19,
color: Colors.white,
icon: Stack(
alignment: Alignment.center,
children: [
Icon(Icons.shield, size: 18),
Icon(
Icons.play_arrow_rounded,
size: 17,
color: Colors.black87,
),
],
),
),
),

View File

@@ -12,6 +12,7 @@ import 'package:flutter_volume_controller/flutter_volume_controller.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:get/get.dart';
import 'package:hive/hive.dart';
import 'package:material_design_icons_flutter/material_design_icons_flutter.dart';
import 'package:media_kit/media_kit.dart';
import 'package:media_kit_video/media_kit_video.dart';
import 'package:PiliPalaX/plugin/pl_player/controller.dart';
@@ -347,8 +348,8 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
child: ComBtn(
icon: Transform.rotate(
angle: pi / 2,
child: const Icon(
Icons.reorder,
child: Icon(
MdiIcons.viewHeadline,
semanticLabel: '分段信息',
size: 22,
color: Colors.white,