opt: expand intro panel

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2024-12-24 12:03:53 +08:00
parent f29e49dc4c
commit 23ba9ad8c1
3 changed files with 19 additions and 8 deletions

View File

@@ -244,7 +244,13 @@ class _ExtraSettingState extends State<ExtraSetting> {
SetSwitchItem( SetSwitchItem(
title: '默认展开视频简介', title: '默认展开视频简介',
leading: Icon(Icons.expand_more), leading: Icon(Icons.expand_more),
setKey: SettingBoxKey.exapndIntroPanel, setKey: SettingBoxKey.alwaysExapndIntroPanel,
defaultVal: false,
),
SetSwitchItem(
title: '横屏自动展开视频简介',
leading: Icon(Icons.expand_more),
setKey: SettingBoxKey.exapndIntroPanelH,
defaultVal: false, defaultVal: false,
), ),
Obx( Obx(

View File

@@ -171,15 +171,16 @@ class _VideoInfoState extends State<VideoInfo> with TickerProviderStateMixin {
loadingStatus = widget.loadingStatus; loadingStatus = widget.loadingStatus;
enableAi = setting.get(SettingBoxKey.enableAi, defaultValue: true); enableAi = setting.get(SettingBoxKey.enableAi, defaultValue: true);
bool exapndIntroPanel = GStorage.exapndIntroPanel; bool alwaysExapndIntroPanel = GStorage.alwaysExapndIntroPanel;
_expandableCtr = ExpandableController( _expandableCtr = ExpandableController(
initialExpanded: exapndIntroPanel, initialExpanded: alwaysExapndIntroPanel,
); );
if (exapndIntroPanel.not) { if (alwaysExapndIntroPanel.not && GStorage.exapndIntroPanelH) {
WidgetsBinding.instance.addPostFrameCallback((_) { WidgetsBinding.instance.addPostFrameCallback((_) {
if (context.orientation == Orientation.landscape) { if (context.orientation == Orientation.landscape &&
_expandableCtr.expanded.not) {
_expandableCtr.toggle(); _expandableCtr.toggle();
} }
}); });

View File

@@ -122,8 +122,11 @@ class GStorage {
static bool get showBangumiReply => static bool get showBangumiReply =>
setting.get(SettingBoxKey.showBangumiReply, defaultValue: true); setting.get(SettingBoxKey.showBangumiReply, defaultValue: true);
static bool get exapndIntroPanel => static bool get alwaysExapndIntroPanel =>
setting.get(SettingBoxKey.exapndIntroPanel, defaultValue: false); setting.get(SettingBoxKey.alwaysExapndIntroPanel, defaultValue: false);
static bool get exapndIntroPanelH =>
setting.get(SettingBoxKey.exapndIntroPanelH, defaultValue: false);
static List<double> get dynamicDetailRatio => static List<double> get dynamicDetailRatio =>
setting.get(SettingBoxKey.dynamicDetailRatio, defaultValue: [60.0, 40.0]); setting.get(SettingBoxKey.dynamicDetailRatio, defaultValue: [60.0, 40.0]);
@@ -321,7 +324,8 @@ class SettingBoxKey {
showRelatedVideo = 'showRelatedVideo', showRelatedVideo = 'showRelatedVideo',
showVideoReply = 'showVideoReply', showVideoReply = 'showVideoReply',
showBangumiReply = 'showBangumiReply', showBangumiReply = 'showBangumiReply',
exapndIntroPanel = 'exapndIntroPanel', alwaysExapndIntroPanel = 'alwaysExapndIntroPanel',
exapndIntroPanelH = 'exapndIntroPanelH',
// Sponsor Block // Sponsor Block
enableSponsorBlock = 'enableSponsorBlock', enableSponsorBlock = 'enableSponsorBlock',