From a7fb8f600760947c81bf9370c5f43263f96e37ab Mon Sep 17 00:00:00 2001 From: bggRGjQaUbCoE Date: Wed, 25 Dec 2024 16:03:26 +0800 Subject: [PATCH] opt: video tabbar, settings icon Signed-off-by: bggRGjQaUbCoE --- lib/pages/setting/extra_setting.dart | 35 +++-- lib/pages/video/detail/controller.dart | 133 +++++++++++------- lib/pages/video/detail/view.dart | 2 +- .../video/detail/widgets/header_control.dart | 14 +- lib/plugin/pl_player/view.dart | 5 +- 5 files changed, 122 insertions(+), 67 deletions(-) diff --git a/lib/pages/setting/extra_setting.dart b/lib/pages/setting/extra_setting.dart index cbe65fdf..568fa8a2 100644 --- a/lib/pages/setting/extra_setting.dart +++ b/lib/pages/setting/extra_setting.dart @@ -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 { 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 { 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 { 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 { 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, ), diff --git a/lib/pages/video/detail/controller.dart b/lib/pages/video/detail/controller.dart index 191f27b5..a4e8bcf9 100644 --- a/lib/pages/video/detail/controller.dart +++ b/lib/pages/video/detail/controller.dart @@ -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 ?? []; - 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 ?? + []; + if (positionSubscription == + null) { + _initSkip(); + } + } else { + SmartDialog.showToast( + '提交失败: ${{ + 400: '参数错误', + 403: '被自动审核机制拒绝', + 429: '重复提交太快', + 409: '重复提交' + }[res.statusCode]}', + ); + } + }, + ); + }, + child: const Text('确定提交'), + ), + ], + ), ); }, child: Icon(Icons.check), diff --git a/lib/pages/video/detail/view.dart b/lib/pages/video/detail/view.dart index f3eedbc3..6eb8c88f 100644 --- a/lib/pages/video/detail/view.dart +++ b/lib/pages/video/detail/view.dart @@ -1256,7 +1256,7 @@ class _VideoDetailPageState extends State const Spacer() else Flexible( - flex: 1, + flex: length == 3 ? 2 : 1, child: showReply ? Obx(() => tabbar()) : tabbar(), ), Flexible( diff --git a/lib/pages/video/detail/widgets/header_control.dart b/lib/pages/video/detail/widgets/header_control.dart index 74ecb2eb..859217a2 100644 --- a/lib/pages/video/detail/widgets/header_control.dart +++ b/lib/pages/video/detail/widgets/header_control.dart @@ -1760,10 +1760,16 @@ class _HeaderControlState extends State { 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, + ), + ], ), ), ), diff --git a/lib/plugin/pl_player/view.dart b/lib/plugin/pl_player/view.dart index ec6ad1ce..691a8e7c 100644 --- a/lib/plugin/pl_player/view.dart +++ b/lib/plugin/pl_player/view.dart @@ -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 child: ComBtn( icon: Transform.rotate( angle: pi / 2, - child: const Icon( - Icons.reorder, + child: Icon( + MdiIcons.viewHeadline, semanticLabel: '分段信息', size: 22, color: Colors.white,