diff --git a/lib/pages/media/view.dart b/lib/pages/media/view.dart index f21ee4a3..32c3318f 100644 --- a/lib/pages/media/view.dart +++ b/lib/pages/media/view.dart @@ -64,6 +64,7 @@ class _MediaPageState extends State toolbarHeight: 30, ), body: SingleChildScrollView( + physics: const AlwaysScrollableScrollPhysics(), controller: mediaController.scrollController, child: Column( children: [ @@ -183,6 +184,9 @@ class _MediaPageState extends State height: MediaQuery.textScalerOf(context).scale(200), child: Obx(() => _buildBody(mediaController.loadingState.value)), ), + SizedBox( + height: MediaQuery.paddingOf(context).bottom + 100, + ) ], ); } diff --git a/lib/pages/setting/extra_setting.dart b/lib/pages/setting/extra_setting.dart index c18d8112..c3b3aa02 100644 --- a/lib/pages/setting/extra_setting.dart +++ b/lib/pages/setting/extra_setting.dart @@ -223,6 +223,12 @@ class _ExtraSettingState extends State { setKey: SettingBoxKey.showViewPoints, defaultVal: true, ), + SetSwitchItem( + title: '视频页显示相关视频', + leading: Icon(Icons.recommend_outlined), + setKey: SettingBoxKey.showRelatedVideo, + defaultVal: true, + ), Obx( () => ListTile( enableFeedback: true, diff --git a/lib/pages/video/detail/controller.dart b/lib/pages/video/detail/controller.dart index f80c0843..ffc54c37 100644 --- a/lib/pages/video/detail/controller.dart +++ b/lib/pages/video/detail/controller.dart @@ -216,6 +216,8 @@ class VideoDetailController extends GetxController late String cacheSecondDecode; late int cacheAudioQa; + late final showRelatedVideo = GStorage.showRelatedVideo; + late final bool enableSponsorBlock; PlayerStatus? playerStatus; StreamSubscription? positionSubscription; @@ -236,6 +238,8 @@ class VideoDetailController extends GetxController RxString sourceType = 'normal'.obs; List mediaList = []; RxString watchLaterTitle = ''.obs; + bool get isPlayAll => + sourceType.value == 'watchLater' || sourceType.value == 'fav'; @override void onInit() { @@ -366,9 +370,11 @@ class VideoDetailController extends GetxController ..bvid = bvid ..queryVideoIntro(); - Get.find(tag: heroTag) - ..bvid = bvid - ..onRefresh(); + if (showRelatedVideo) { + Get.find(tag: heroTag) + ..bvid = bvid + ..onRefresh(); + } } catch (_) {} } diff --git a/lib/pages/video/detail/introduction/controller.dart b/lib/pages/video/detail/introduction/controller.dart index 13404ef6..d94eb503 100644 --- a/lib/pages/video/detail/introduction/controller.dart +++ b/lib/pages/video/detail/introduction/controller.dart @@ -550,12 +550,13 @@ class VideoIntroController extends GetxController videoDetailCtr.danmakuCid.value = cid; videoDetailCtr.queryVideoUrl(); // 重新请求相关视频 - try { - final RelatedController relatedCtr = - Get.find(tag: heroTag); - relatedCtr.bvid = bvid; - relatedCtr.queryData(); - } catch (_) {} + if (videoDetailCtr.showRelatedVideo) { + try { + Get.find(tag: heroTag) + ..bvid = bvid + ..queryData(); + } catch (_) {} + } // 重新请求评论 try { final VideoReplyController videoReplyCtr = @@ -652,8 +653,7 @@ class VideoIntroController extends GetxController final VideoDetailController videoDetailCtr = Get.find(tag: heroTag); - if (videoDetailController.sourceType.value == 'watchLater' || - videoDetailController.sourceType.value == 'fav') { + if (videoDetailController.isPlayAll) { episodes.addAll(videoDetailCtr.mediaList); } else if ((videoDetail.value.pages?.length ?? 0) > 1) { isPages = true; @@ -671,7 +671,8 @@ class VideoIntroController extends GetxController final PlayRepeat platRepeat = videoDetailCtr.plPlayerController.playRepeat; if (episodes.isEmpty) { - if (platRepeat == PlayRepeat.autoPlayRelated) { + if (platRepeat == PlayRepeat.autoPlayRelated && + videoDetailCtr.showRelatedVideo) { return playRelated(); } return false; @@ -692,7 +693,8 @@ class VideoIntroController extends GetxController if (nextIndex >= episodes.length) { if (platRepeat == PlayRepeat.listCycle) { nextIndex = 0; - } else if (platRepeat == PlayRepeat.autoPlayRelated) { + } else if (platRepeat == PlayRepeat.autoPlayRelated && + videoDetailCtr.showRelatedVideo) { return playRelated(); } else { return false; diff --git a/lib/pages/video/detail/view.dart b/lib/pages/video/detail/view.dart index 625d82b6..779d0c5a 100644 --- a/lib/pages/video/detail/view.dart +++ b/lib/pages/video/detail/view.dart @@ -795,7 +795,8 @@ class _VideoDetailPageState extends State SearchType.media_bangumi, '相关视频', videoDetailController.videoType == - SearchType.media_bangumi, + SearchType.media_bangumi || + videoDetailController.showRelatedVideo.not, ), Expanded( child: TabBarView( @@ -803,7 +804,8 @@ class _VideoDetailPageState extends State controller: videoDetailController.tabCtr, children: [ if (videoDetailController.videoType == - SearchType.video) + SearchType.video && + videoDetailController.showRelatedVideo) CustomScrollView( controller: _introController, slivers: [ @@ -1296,7 +1298,7 @@ class _VideoDetailPageState extends State showIntroDetail: showIntroDetail, showEpisodes: showEpisodes, ), - if (needRelated) ...[ + if (needRelated && videoDetailController.showRelatedVideo) ...[ SliverToBoxAdapter( child: Padding( padding: const EdgeInsets.only( @@ -1323,12 +1325,18 @@ class _VideoDetailPageState extends State ), ), SliverToBoxAdapter( - child: SizedBox(height: MediaQuery.paddingOf(context).bottom), + child: SizedBox( + height: MediaQuery.paddingOf(context).bottom + + (videoDetailController.isPlayAll && + MediaQuery.orientationOf(context) == + Orientation.landscape + ? 75 + : 0), + ), ) ], ); - if (videoDetailController.sourceType.value == 'watchLater' || - videoDetailController.sourceType.value == 'fav') { + if (videoDetailController.isPlayAll) { return Stack( children: [ introPanel(), diff --git a/lib/utils/storage.dart b/lib/utils/storage.dart index 8c86e0bb..7cf792d8 100644 --- a/lib/utils/storage.dart +++ b/lib/utils/storage.dart @@ -113,6 +113,9 @@ class GStorage { static bool get showViewPoints => setting.get(SettingBoxKey.showViewPoints, defaultValue: true); + static bool get showRelatedVideo => + setting.get(SettingBoxKey.showRelatedVideo, defaultValue: true); + static List get dynamicDetailRatio => setting.get(SettingBoxKey.dynamicDetailRatio, defaultValue: [60.0, 40.0]); @@ -306,6 +309,7 @@ class SettingBoxKey { schemeVariant = 'schemeVariant', grpcReply = 'grpcReply', showViewPoints = 'showViewPoints', + showRelatedVideo = 'showRelatedVideo', // Sponsor Block enableSponsorBlock = 'enableSponsorBlock',