From 7d358bea1ad62f7b38235134b6a138b40446d6b4 Mon Sep 17 00:00:00 2001 From: orz12 Date: Thu, 4 Apr 2024 10:55:43 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=96=B0=E5=A2=9E=E6=92=AD=E6=94=BE?= =?UTF-8?q?=E9=A1=B5=E9=BB=98=E8=AE=A4=E5=B1=95=E7=A4=BA=E8=AF=84=E8=AE=BA?= =?UTF-8?q?=E5=8C=BA=E8=AE=BE=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/pages/setting/style_setting.dart | 6 ++++++ lib/pages/video/detail/controller.dart | 5 ++++- lib/utils/storage.dart | 3 ++- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/lib/pages/setting/style_setting.dart b/lib/pages/setting/style_setting.dart index d37f5507..1d3b46ab 100644 --- a/lib/pages/setting/style_setting.dart +++ b/lib/pages/setting/style_setting.dart @@ -263,6 +263,12 @@ class _StyleSettingState extends State { '当前主题:${colorSelectController.type.value == 0 ? '动态取色' : '指定颜色'}', style: subTitleStyle)), ), + const SetSwitchItem( + title: '默认展示评论区', + subTitle: '在视频详情页默认切换至评论区页', + setKey: SettingBoxKey.defaultShowComment, + defaultVal: false, + ), ListTile( dense: false, onTap: () => settingController.seteDefaultHomePage(context), diff --git a/lib/pages/video/detail/controller.dart b/lib/pages/video/detail/controller.dart index 3c2a6eda..1ec5f337 100644 --- a/lib/pages/video/detail/controller.dart +++ b/lib/pages/video/detail/controller.dart @@ -110,7 +110,10 @@ class VideoDetailController extends GetxController videoItem['pic'] = argMap['pic']; } } - tabCtr = TabController(length: 2, vsync: this); + bool defaultShowComment = + setting.get(SettingBoxKey.defaultShowComment, defaultValue: false); + tabCtr = TabController( + length: 2, vsync: this, initialIndex: defaultShowComment ? 1 : 0); autoPlay.value = setting.get(SettingBoxKey.autoPlayEnable, defaultValue: true); enableHA.value = setting.get(SettingBoxKey.enableHA, defaultValue: true); diff --git a/lib/utils/storage.dart b/lib/utils/storage.dart index 8828f0a5..767de0e5 100644 --- a/lib/utils/storage.dart +++ b/lib/utils/storage.dart @@ -150,7 +150,8 @@ class SettingBoxKey { tabbarSort = 'tabbarSort', // 首页tabbar dynamicBadgeMode = 'dynamicBadgeMode', hiddenSettingUnlocked = 'hiddenSettingUnlocked', - enableGradientBg = 'enableGradientBg'; + enableGradientBg = 'enableGradientBg', + defaultShowComment = 'defaultShowComment'; } class LocalCacheKey {