fix custom client settings tab visibility (#8752)

* fix custom client settings tab visibility

only control with tabKeys

Signed-off-by: 21pages <sunboeasy@gmail.com>

* fix preset-user-name typo

Signed-off-by: 21pages <sunboeasy@gmail.com>

---------

Signed-off-by: 21pages <sunboeasy@gmail.com>
This commit is contained in:
21pages 2024-07-18 22:27:31 +08:00 committed by GitHub
parent 2be05608d8
commit 04c175c62e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 33 additions and 18 deletions

View File

@ -61,9 +61,13 @@ class DesktopSettingPage extends StatefulWidget {
final SettingsTabKey initialTabkey;
static final List<SettingsTabKey> tabKeys = [
SettingsTabKey.general,
if (!bind.isOutgoingOnly() && !bind.isDisableSettings())
if (!bind.isOutgoingOnly() &&
!bind.isDisableSettings() &&
bind.mainGetLocalOption(key: "hide-security-settings") != 'Y')
SettingsTabKey.safety,
if (!bind.isDisableSettings()) SettingsTabKey.network,
if (!bind.isDisableSettings() &&
bind.mainGetLocalOption(key: "hide-network-settings") != 'Y')
SettingsTabKey.network,
if (!bind.isIncomingOnly()) SettingsTabKey.display,
if (!isWeb && !bind.isIncomingOnly() && bind.pluginFeatureIsEnabled())
SettingsTabKey.plugin,
@ -173,21 +177,32 @@ class _DesktopSettingPageState extends State<DesktopSettingPage>
}
List<Widget> _children() {
final hideSecurity =
bind.mainGetLocalOption(key: "hide-security-settings") == 'Y';
final hideNetwork =
bind.mainGetLocalOption(key: "hide-network-settings") == 'Y';
final children = [
_General(),
if (!bind.isOutgoingOnly() && !bind.isDisableSettings() && !hideSecurity)
_Safety(),
if (!bind.isDisableSettings() && !hideNetwork) _Network(),
if (!bind.isIncomingOnly()) _Display(),
if (!isWeb && !bind.isIncomingOnly() && bind.pluginFeatureIsEnabled())
_Plugin(),
if (!bind.isDisableAccount()) _Account(),
_About(),
];
final children = List<Widget>.empty(growable: true);
for (final tab in DesktopSettingPage.tabKeys) {
switch (tab) {
case SettingsTabKey.general:
children.add(const _General());
break;
case SettingsTabKey.safety:
children.add(const _Safety());
break;
case SettingsTabKey.network:
children.add(const _Network());
break;
case SettingsTabKey.display:
children.add(const _Display());
break;
case SettingsTabKey.plugin:
children.add(const _Plugin());
break;
case SettingsTabKey.account:
children.add(const _Account());
break;
case SettingsTabKey.about:
children.add(const _About());
break;
}
}
return children;
}

View File

@ -2096,7 +2096,7 @@ pub mod keys {
pub const OPTION_KEY: &str = "key";
pub const OPTION_PRESET_ADDRESS_BOOK_NAME: &str = "preset-address-book-name";
pub const OPTION_PRESET_ADDRESS_BOOK_TAG: &str = "preset-address-book-tag";
pub const OPTION_PRESET_USERNAME: &str = "preset-username";
pub const OPTION_PRESET_USERNAME: &str = "preset-user-name";
pub const OPTION_PRESET_STRATEGY_NAME: &str = "preset-strategy-name";
pub const OPTION_ENABLE_DIRECTX_CAPTURE: &str = "enable-directx-capture";
pub const OPTION_ENABLE_ANDROID_SOFTWARE_ENCODING_HALF_SCALE: &str =