Sferum button hide option

This commit is contained in:
ivan2282
2025-11-30 21:53:45 +03:00
parent a935bd396d
commit 42cb4774b5
2 changed files with 35 additions and 2 deletions

View File

@@ -99,9 +99,16 @@ class _ChatsScreenState extends State<ChatsScreen>
StreamSubscription<String>? _connectionStateSubscription;
bool _isAccountsExpanded = false;
late SharedPreferences prefs;
Future<void> _initializePrefs() async {
prefs = await SharedPreferences.getInstance();
}
@override
void initState() {
super.initState();
_initializePrefs();
_loadMyProfile();
_chatsFuture = (() async {
try {
@@ -118,6 +125,9 @@ class _ChatsScreenState extends State<ChatsScreen>
rethrow;
}
})();
_listenForUpdates();
_searchAnimationController = AnimationController(
@@ -155,6 +165,7 @@ class _ChatsScreenState extends State<ChatsScreen>
_loadChannels();
}
});
final prefs = SharedPreferences.getInstance();
}
@override
@@ -3582,7 +3593,8 @@ class _ChatsScreenState extends State<ChatsScreen>
),
]
: [
IconButton(
if (prefs.getBool('show_sferum_button') ?? true)
IconButton(
icon: Image.asset(
'assets/images/spermum.png',
width: 28,
@@ -4508,7 +4520,7 @@ class _SferumWebViewPanelState extends State<SferumWebViewPanel> {
color: colors.surface,
child: const Center(
child: Text(
'Сферум временно не доступен на линуксе,\nмы думаем как это исправить.',
'Веб приложения временно не доступны на линуксе,\nмы думаем как это исправить.',
textAlign: TextAlign.center,
style: TextStyle(fontSize: 18, fontWeight: FontWeight.w600),
),

View File

@@ -18,6 +18,7 @@ class _KometMiscScreenState extends State<KometMiscScreen> {
bool _showUpdateNotification = true;
bool _enableWebVersionCheck = false;
bool _showSpoofUpdateDialog = true;
bool _showSferumButton = true;
@override
void initState() {
@@ -36,6 +37,8 @@ class _KometMiscScreenState extends State<KometMiscScreen> {
prefs.getBool('enable_web_version_check') ?? false;
_showSpoofUpdateDialog =
prefs.getBool('show_spoof_update_dialog') ?? true;
_showSferumButton =
prefs.getBool('show_sferum_button') ?? true;
});
}
@@ -225,6 +228,24 @@ class _KometMiscScreenState extends State<KometMiscScreen> {
_updateSettings('show_spoof_update_dialog', value);
},
),
const Divider(height: 1),
SwitchListTile(
secondary: Icon(
Icons.remove_red_eye,
color: Theme.of(context).colorScheme.primary,
),
title: const Text("Показывать кнопку Сферум?"),
subtitle: const Text(
"Показывать кнопку Сферум в главном меню. Для применения нужен перезапуск приложения.",
),
value: _showSferumButton,
onChanged: (bool value) {
setState(() {
_showSferumButton = value;
});
_updateSettings('show_sferum_button', value);
},
),
],
),
),